[LoopUnrollAnalyzer] Add a comment to visitCastInst.

llvm-svn: 271086
This commit is contained in:
Michael Zolotukhin 2016-05-28 01:40:14 +00:00
parent e31e778160
commit d69cd1e086
1 changed files with 6 additions and 0 deletions

View 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())) {