[PATCH] D34029: Infer lowest bits of an integer Multiply when the low bits of the operands are known

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 14 15:01:59 PDT 2017


efriedma requested changes to this revision.
efriedma added a comment.
This revision now requires changes to proceed.

> I recall this coming up as something we may not be able to do in the face of undef, etc.

I can't see anything special here compared to, for example, computeKnownBitsAddSub.



================
Comment at: lib/Analysis/ValueTracking.cpp:383
+                        Bottom1.getLoBits(TrailBitsKnown);
+    unsigned TrailKnown = std::min(BottomKnown.getActiveBits(), Known.getBitWidth());
+    Known.Zero |= (~BottomKnown).getLoBits(TrailKnown);
----------------
TrailKnown is wrong.  http://rise4fun.com/Alive/s2b

Conservatively, you could just use "TrailKnown = TrailBitsKnown".  Or maybe you could get a little more aggressive with some trickery involving trailing zeros; I haven't worked out the exact math.


https://reviews.llvm.org/D34029





More information about the llvm-commits mailing list