[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 13:53:54 PDT 2017


sanjoy added inline comments.


================
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
----------------
yamauchi wrote:
> sanjoy wrote:
> > 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?
> Done. I assumed by EdgeVal you meant CaseValue where EdgeVal = f(CaseValue).
Yes, thanks!


https://reviews.llvm.org/D36247





More information about the llvm-commits mailing list