diff options
author | Chris Lattner <sabre@nondot.org> | 2010-06-27 07:58:26 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-06-27 07:58:26 +0000 |
commit | 25a843fcd2e9909f60d3d679dd028b2488d0e262 (patch) | |
tree | beb60b495fbd860ce609b74140f77ab03dcb656d /llvm/lib/Transforms/Scalar | |
parent | 818efb64a346c7fec250498d028d25331f1bd766 (diff) | |
download | bcm5719-llvm-25a843fcd2e9909f60d3d679dd028b2488d0e262.tar.gz bcm5719-llvm-25a843fcd2e9909f60d3d679dd028b2488d0e262.zip |
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
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r-- | llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp index eefcbb44dbc..cae21e95fd5 100644 --- a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -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 |