Skip to content

Commit 4eefa5e

Browse files
committed
[InstCombine] Improve header comments
1 parent 68c86f4 commit 4eefa5e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5780,10 +5780,14 @@ Instruction *InstCombinerImpl::foldICmpWithMinMax(Instruction &I,
57805780
return nullptr;
57815781
}
57825782

5783-
// Transform patterns like:
5784-
// icmp eq/ne X, min(max(X, Lo), Hi)
5785-
// Into:
5786-
// (X - Lo) u< (Hi - Lo + 1)
5783+
/// Match and fold patterns like:
5784+
/// icmp eq/ne X, min(max(X, Lo), Hi)
5785+
/// which represents a range check and can be repsented as a ConstantRange.
5786+
///
5787+
/// For icmp eq, build ConstantRange [Lo, Hi + 1) and convert to:
5788+
/// (X - Lo) u< (Hi + 1 - Lo)
5789+
/// For icmp ne, build ConstantRange [Hi + 1, Lo) and convert to:
5790+
/// (X - (Hi + 1)) u< (Lo - (Hi + 1))
57875791
Instruction *InstCombinerImpl::foldICmpWithClamp(ICmpInst &I, Value *X,
57885792
MinMaxIntrinsic *Min) {
57895793
if (!I.isEquality() || !Min->hasOneUse())

0 commit comments

Comments
 (0)