[PATCH] [InstCombine] call SimplifyICmpInst with correct context
Jingyue Wu
jingyue at google.com
Wed Jun 24 21:38:44 PDT 2015
IIUC, your proposed solution would essentially prevent `SimplifyICmpInst` from leveraging any `@llvm.assume` because `computeKnownBitsFromAssume` does nothing when `Q.CxtI == nullptr`.
It sounds an overkill to me, because `SimplifyICmpInst` does want to leverage `@llvm.assume`s that don't use the compare instruction. For instance,
b = (a > 1);
__builtin_assume(b);
return a > 0;
it's desirable to replace the second compare `a > 0` with `true` while keeping `__builtin_assume(b)` just in case we need `__builtin_assume(b)` in the future.
b = (a > 1);
__builtin_assume(b);
return true;
and the current patch can do this.
What the current patch prevents is `SimplifyICmpInst` leveraging an assume to simplify its ephemeral values (see `isEphemeralValueOf` <http://llvm.org/docs/doxygen/html/ValueTracking_8cpp_source.html#l00372>). That ensures LLVM won't remove `__builtin_assume(b)` because `__builtin_assume(b)` is an ephemeral value of `b`.
http://reviews.llvm.org/D10695
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list