Improve comment. Thanks for Andrew for the suggestion.
authorRafael Espindola <rafael.espindola@gmail.com>
Wed, 22 Feb 2012 03:44:46 +0000 (03:44 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Wed, 22 Feb 2012 03:44:46 +0000 (03:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151127 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ScalarEvolutionExpander.cpp

index a9473b4c49a1c3f0930b881b9b700ba708ceef8b..d5f3b7451697ea1a76cd53134f019e1e13ca5b38 100644 (file)
@@ -53,8 +53,9 @@ Value *SCEVExpander::ReuseOrCreateCast(Value *V, Type *Ty,
     if (U->getType() == Ty)
       if (CastInst *CI = dyn_cast<CastInst>(U))
         if (CI->getOpcode() == Op) {
-          // If the cast isn't where we want it or if it doesn't dominate
-          // a use in BIP, fix it.
+          // If the cast isn't where we want it, create a new cast at IP.
+          // Likewise, do not reuse a cast at BIP because it must dominate
+          // instructions that might be inserted before BIP.
           if (BasicBlock::iterator(CI) != IP || BIP == IP) {
             // Create a new cast, and leave the old cast in place in case
             // it is being used as an insert point. Clear its operand