summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-06-24 00:28:59 +0000
committerDan Gohman <gohman@apple.com>2009-06-24 00:28:59 +0000
commitf522a4e03405182ce4d79ca71195d939a5fec3cb (patch)
tree5a3d557ae13a7681d95c4a9c94c11f04e918e3f5 /llvm/lib/Transforms
parentd2e8adfc75996140ace5e19f65c7e098ba771054 (diff)
downloadbcm5719-llvm-f522a4e03405182ce4d79ca71195d939a5fec3cb.tar.gz
bcm5719-llvm-f522a4e03405182ce4d79ca71195d939a5fec3cb.zip
Don't emit a redundant BitCastInst if the value to be defined in the
preheader is already an instruction. llvm-svn: 74031
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index ba600584865..312b957948b 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -1642,7 +1642,8 @@ void LoopStrengthReduce::StrengthReduceStridedIVUsers(const SCEV* const &Stride,
// 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",
OpenPOWER on IntegriCloud