[PATCH] D23296: [ValueTracking] Improve ValueTracking on left shift with nsw flag

Li Huang via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 22 14:50:32 PDT 2016


lihuang added inline comments.

================
Comment at: lib/Analysis/ValueTracking.cpp:798-802
@@ -797,1 +797,7 @@
     KnownOne  = KOF(KnownOne, ShiftAmt);
+    // If there is conflict between KnownZero and KnownOne, this must be an 
+    // overflowing left shift, so the shift result is undefined. We can return
+    // arbitrary values.
+    if ((KnownZero & KnownOne) != 0) 
+      KnownOne &= ~KnownZero;
+    
----------------
majnemer wrote:
> This goes against the ethos of ComputeKnownValues.  Conflicts should return "I don't know" so that we can transform stuff into undef.
Hi David, I'm not familiar with this part but can we transform "i don't know" to undef?  What if we just cannot infer anything from this value? 


https://reviews.llvm.org/D23296





More information about the llvm-commits mailing list