From: Michael Zolotukhin Date: Sat, 28 May 2016 01:40:14 +0000 (+0000) Subject: [LoopUnrollAnalyzer] Add a comment to visitCastInst. X-Git-Tag: android-x86-7.1-r4~32639 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=a8ae9257741abeb7d6ab3d4f41768e42391ae71c;p=android-x86%2Fexternal-llvm.git [LoopUnrollAnalyzer] Add a comment to visitCastInst. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271086 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/LoopUnrollAnalyzer.cpp b/lib/Analysis/LoopUnrollAnalyzer.cpp index 8a97a9f9522..f9e02078501 100644 --- a/lib/Analysis/LoopUnrollAnalyzer.cpp +++ b/lib/Analysis/LoopUnrollAnalyzer.cpp @@ -141,6 +141,12 @@ bool UnrolledInstAnalyzer::visitCastInst(CastInst &I) { Constant *COp = dyn_cast(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())) {