forked from OSchip/llvm-project
[InstCombine] Remove unnecessary MaybeAlign use (NFC)
Alloca align is required now.
This commit is contained in:
parent
97a670958c
commit
a4953db530
|
@ -365,7 +365,6 @@ Instruction *InstCombiner::visitAllocaInst(AllocaInst &AI) {
|
|||
}
|
||||
}
|
||||
|
||||
if (AI.getAlignment()) {
|
||||
// Check to see if this allocation is only modified by a memcpy/memmove from
|
||||
// a constant whose alignment is equal to or exceeds that of the allocation.
|
||||
// If this is the case, we can change all users to use the constant global
|
||||
|
@ -374,10 +373,10 @@ Instruction *InstCombiner::visitAllocaInst(AllocaInst &AI) {
|
|||
// read.
|
||||
SmallVector<Instruction *, 4> ToDelete;
|
||||
if (MemTransferInst *Copy = isOnlyCopiedFromConstantMemory(AA, &AI, ToDelete)) {
|
||||
MaybeAlign AllocaAlign = AI.getAlign();
|
||||
Align AllocaAlign = AI.getAlign();
|
||||
Align SourceAlign = getOrEnforceKnownAlignment(
|
||||
Copy->getSource(), AllocaAlign, DL, &AI, &AC, &DT);
|
||||
if ((!AllocaAlign || *AllocaAlign <= SourceAlign) &&
|
||||
if (AllocaAlign <= SourceAlign &&
|
||||
isDereferenceableForAllocaSize(Copy->getSource(), &AI, DL)) {
|
||||
LLVM_DEBUG(dbgs() << "Found alloca equal to global: " << AI << '\n');
|
||||
LLVM_DEBUG(dbgs() << " memcpy = " << *Copy << '\n');
|
||||
|
@ -402,7 +401,6 @@ Instruction *InstCombiner::visitAllocaInst(AllocaInst &AI) {
|
|||
++NumGlobalCopies;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// At last, use the generic allocation site handler to aggressively remove
|
||||
// unused allocas.
|
||||
|
|
Loading…
Reference in New Issue