[PATCH] D23296: [ValueTracking] Improve ValueTracking on left shift with nsw flag
Sanjoy Das via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 22 10:19:33 PDT 2016
sanjoy requested changes to this revision.
sanjoy added a comment.
This revision now requires changes to proceed.
Comments inline.
================
Comment at: lib/Analysis/ValueTracking.cpp:803
@@ +802,3 @@
+ KnownZero.clearAllBits();
+ KnownOne.clearAllBits();
+ }
----------------
This looks excessively pessimistic -- why can't we `KnownOne &= ~KnownZero` or `KnownZero &= ~KnownOne` instead? Both seem better than what we have here.
================
Comment at: lib/Analysis/ValueTracking.cpp:1078
@@ -1069,1 +1077,3 @@
APInt::getLowBitsSet(BitWidth, ShiftAmt); // Low bits known 0.
+ // If this shift has "nsw" keyword, then the result is either a poison
+ // value or has the same sign bit as the first operand.
----------------
Indent is off.
https://reviews.llvm.org/D23296
More information about the llvm-commits
mailing list