minor cleanup to SROA: when lowering type unsafe accesses to

large integers, the first inserted value would always create
an 'or X, 0'.  Even though this is trivially zapped by
instcombine, don't bother creating this pointless instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106979 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2010-06-27 07:58:26 +00:00
parent 41c9c0ea32
commit 1495247f51

View File

@ -1655,7 +1655,12 @@ void SROA::RewriteLoadUserOfWholeAlloca(LoadInst *LI, AllocaInst *AI,
SrcField = BinaryOperator::CreateShl(SrcField, ShiftVal, "", LI);
}
ResultVal = BinaryOperator::CreateOr(SrcField, ResultVal, "", LI);
// Don't create an 'or x, 0' on the first iteration.
if (!isa<Constant>(ResultVal) ||
!cast<Constant>(ResultVal)->isNullValue())
ResultVal = BinaryOperator::CreateOr(SrcField, ResultVal, "", LI);
else
ResultVal = SrcField;
}
// Handle tail padding by truncating the result