AllocaInst should store Align instead of MaybeAlign.

Along the lines of D77454 and D79968.  Unlike loads and stores, the
default alignment is getPrefTypeAlign, to match the existing handling in
various places, including SelectionDAG and InstCombine.

Differential Revision: https://reviews.llvm.org/D80044
This commit is contained in:
Eli Friedman
2020-05-15 13:23:14 -07:00
parent abaf334b9d
commit 3a9c279a90
50 changed files with 345 additions and 390 deletions
+7 -1
View File
@@ -4826,7 +4826,13 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
const DataLayout &DL = TheModule->getDataLayout();
unsigned AS = DL.getAllocaAddrSpace();
AllocaInst *AI = new AllocaInst(Ty, AS, Size, Align);
SmallPtrSet<Type *, 4> Visited;
if (!Align && !Ty->isSized(&Visited))
return error("alloca of unsized type");
if (!Align)
Align = DL.getPrefTypeAlign(Ty);
AllocaInst *AI = new AllocaInst(Ty, AS, Size, *Align);
AI->setUsedWithInAlloca(InAlloca);
AI->setSwiftError(SwiftError);
I = AI;