OSDN Git Service

[LoopUnrollAnalyzer] Add a comment to visitCastInst.
authorMichael Zolotukhin <mzolotukhin@apple.com>
Sat, 28 May 2016 01:40:14 +0000 (01:40 +0000)
committerMichael Zolotukhin <mzolotukhin@apple.com>
Sat, 28 May 2016 01:40:14 +0000 (01:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271086 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/LoopUnrollAnalyzer.cpp

index 8a97a9f..f9e0207 100644 (file)
@@ -141,6 +141,12 @@ bool UnrolledInstAnalyzer::visitCastInst(CastInst &I) {
   Constant *COp = dyn_cast<Constant>(I.getOperand(0));
   if (!COp)
     COp = SimplifiedValues.lookup(I.getOperand(0));
+
+  // If we know a simplified value for this operand and cast is valid, save the
+  // result to SimplifiedValues.
+  // The cast can be invalid, because SimplifiedValues contains results of SCEV
+  // analysis, which operates on integers (and, e.g., might convert i8* null to
+  // i32 0).
   if (COp && CastInst::castIsValid(I.getOpcode(), COp, I.getType())) {
     if (Constant *C =
             ConstantExpr::getCast(I.getOpcode(), COp, I.getType())) {