[PATCH] D25785: [InstSimplify] folds for negation of sign-bit

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 19 13:28:16 PDT 2016

efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.


Comment at: lib/Analysis/InstructionSimplify.cpp:692
+    APInt KnownOne(BitWidth, 0);
+    computeKnownBits(Op1, KnownZero, KnownOne, Q.DL, 0, Q.AC, Q.CxtI, Q.DT);
+    if (KnownZero == ~APInt::getSignBit(BitWidth)) {
I'm sort of concerned that calling computeKnownBits here could lead to compile-time performance problems, given that instsimplify is supposed to be inexpensive, and the condition is very unlikely to succeed in most code.  I don't have any evidence it's actually an issue, though; maybe computeKnownBits is cheap enough that it doesn't matter.


More information about the llvm-commits mailing list