An unsigned comparision is equivalent to is corresponding signed version
if both the operands being compared are positive. Teach SCEV to use
this fact when profitable.
Details
Diff Detail
Event Timeline
LGTM w/comments addressed.
Q: Does InstCombine have similar logic? If it doesn't, it really should.
lib/Analysis/ScalarEvolution.cpp | ||
---|---|---|
7455 | I'm pretty sure this function already exists somewhere. If it doesn't, it should be a utility on ICmpInst or something. | |
7458 | Make this an assert? I'd rather see the calling code as isUnsignedCmp, followed by a call to this with an assert inside it. Less error prone. | |
7534 | This code is obviously correct, but it only handles one of the two cases immediately above it. I'd suggest in a separate change, pulling out the two cases above into a lambda, and then calling it twice, once with FoundPred, once with the signed compare if legal. |
LGTM
include/llvm/IR/InstrTypes.h | ||
---|---|---|
1035 ↗ | (On Diff #37386) | I believe we're moving away from this style of doxygen comment even when in code surrounded by similar. the "/// brief. long" style has seemingly become the norm. |
I'm pretty sure this function already exists somewhere. If it doesn't, it should be a utility on ICmpInst or something.