This logic allows a compare instruction to infer the condition of another compare with matching operands without having to use ValueTracking directly.
Chad
Paths
| Differential D19330
Refactor implied condition logic from ValueTracking directly into CmpInst. NFC. ClosedPublic Authored by mcrosier on Apr 20 2016, 9:03 AM.
Details Summary This logic allows a compare instruction to infer the condition of another compare with matching operands without having to use ValueTracking directly. Chad
Diff Detail
Event Timelinemcrosier retitled this revision from to Refactor implied condition logic from ValueTracking directly into CmpInst. NFC.. mcrosier updated this object. This revision now requires changes to proceed.Apr 20 2016, 10:56 AM mcrosier edited edge metadata. Comment ActionsMove the remaining bit of logic into CmpInst, per Sanjoy's suggestion. sanjoy edited edge metadata. Comment ActionsGiven that this passes all the checked in tests then I'm okay signing off on this for now (with a FIXME stating what remains to be done); but depending on how much time you're willing to commit here, I think we can make this code more comprehensive. I've added a comment inline about some of the missing cases, but there is a useful litmus test here: we should be able to implement isFalseWhenOperandsMatch(X, Y) exactly as isTrueWhenOperandsMatch(X, getInversePredicate(Y)). Any situation where that doesn't work is a missing case.
This revision is now accepted and ready to land.Apr 20 2016, 10:54 PM Closed by commit rL266987: Refactor implied condition logic from ValueTracking directly into CmpInst. NFC. (authored by mcrosier). · Explain WhyApr 21 2016, 7:10 AM This revision was automatically updated to reflect the committed changes. Comment Actions
Yes, the code can be more comprehensive. I'll post a patch shortly as I'd like for this work to be complete. Thanks, Sanjoy.
Revision Contents
Diff 54497 llvm/trunk/include/llvm/IR/InstrTypes.h
llvm/trunk/lib/Analysis/ValueTracking.cpp
llvm/trunk/lib/IR/Instructions.cpp
|