[PATCH] D23296: [ValueTracking] Improve ValueTracking on left shift with nsw flag
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 22 14:05:19 PDT 2016
majnemer requested changes to this revision.
This revision now requires changes to proceed.
================
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;
+
----------------
This goes against the ethos of ComputeKnownValues. Conflicts should return "I don't know" so that we can transform stuff into undef.
https://reviews.llvm.org/D23296
More information about the llvm-commits
mailing list