diff options
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index fcb7ad3dfde..33714a2ad20 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/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); } |

