[PATCH] D36247: [LVI] Constant-propagate a zero extension of the switch condition value through case edges

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 3 12:40:55 PDT 2017


sanjoy accepted this revision.
sanjoy added a comment.
This revision is now accepted and ready to land.

lgtm



================
Comment at: lib/Analysis/LazyValueInfo.cpp:1509
         // some cases. There is no need to perform difference for those cases.
-        if (Case.getCaseSuccessor() != BBTo)
+        // Also currently limit this to the Condition == Val case only though
+        // there are cases where this would make sense even for the
----------------
I would be somewhat more explicit here:

```
We know Condition != EdgeVal in BBTo.  In some cases we can use this to infer Val == f(Condition) is != f(EdgeVal).  For now, we only do this when f is identity (i.e. Val == Condition), but we should be able to do this for any injective f.
```

The "There is no need to perform difference for those cases." comment is also somewhat misleading -- it is not just that there is no need, we //cannot// perform the difference in these cases.  Can you please update that comment since you're touching nearby code anyway?


https://reviews.llvm.org/D36247





More information about the llvm-commits mailing list