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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user