aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-08-02 03:31:14 +0000
committerChris Lattner <sabre@nondot.org>2005-08-02 03:31:14 +0000
commit8105c76da440280779a0b658318ac45edf5fccaa (patch)
treea77b433c4c14ac996748b362c6eeebf17cc40b4c /lib/Transforms/Scalar/LoopStrengthReduce.cpp
parent64fe58490d28b7f7ba3ecb78fd9290688ded8f0c (diff)
Like the comment says, do not insert cast instructions before phi nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22586 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r--lib/Transforms/Scalar/LoopStrengthReduce.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index fcb7ad3dfd..33714a2ad2 100644
--- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -232,6 +232,10 @@ void LoopStrengthReduce::AnalyzeGetElementPtrUsers(GetElementPtrInst *GEP,
else
++InsertPt;
}
+
+ // Do not insert casts into the middle of PHI node blocks.
+ while (isa<PHINode>(InsertPt)) ++InsertPt;
+
BP = new CastInst(GEP->getOperand(0), UIntPtrTy,
GEP->getOperand(0)->getName(), InsertPt);
}