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.

llvm-svn: 106979
This commit is contained in:
Chris Lattner 2010-06-27 07:58:26 +00:00
parent c0f3393cf7
commit d3a1ef7fea

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