diff options
| author | Dan Gohman <gohman@apple.com> | 2009-06-24 00:28:59 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2009-06-24 00:28:59 +0000 |
| commit | a7d79b39bb73115516186a25be15f74099a4f48b (patch) | |
| tree | 2688f1a7def163981a4096929dc4b6fbbc06fed0 /lib | |
| parent | be1f86cac8c3207ff43caae38ec2303117d16545 (diff) | |
| download | external_llvm-a7d79b39bb73115516186a25be15f74099a4f48b.zip external_llvm-a7d79b39bb73115516186a25be15f74099a4f48b.tar.gz external_llvm-a7d79b39bb73115516186a25be15f74099a4f48b.tar.bz2 | |
Don't emit a redundant BitCastInst if the value to be defined in the
preheader is already an instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74031 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index ba60058..312b957 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/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", |
