[llvm-commits] [llvm] r74031 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Dan Gohman
gohman at apple.com
Tue Jun 23 17:29:00 PDT 2009
Author: djg
Date: Tue Jun 23 19:28:59 2009
New Revision: 74031
URL: http://llvm.org/viewvc/llvm-project?rev=74031&view=rev
Log:
Don't emit a redundant BitCastInst if the value to be defined in the
preheader is already an instruction.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=74031&r1=74030&r2=74031&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Tue Jun 23 19:28:59 2009
@@ -1642,7 +1642,8 @@
// the preheader, instead of being forward substituted into the uses. We
// do this by forcing a BitCast (noop cast) to be inserted into the
// preheader in this case.
- if (!fitsInAddressMode(Base, getAccessType(Inst), TLI, false)) {
+ if (!fitsInAddressMode(Base, getAccessType(Inst), TLI, false) &&
+ !isa<Instruction>(BaseV)) {
// We want this constant emitted into the preheader! This is just
// using cast as a copy so BitCast (no-op cast) is appropriate
BaseV = new BitCastInst(BaseV, BaseV->getType(), "preheaderinsert",
More information about the llvm-commits
mailing list