[llvm] Match range check pattern with SExt (PR #118910)
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 6 13:34:25 PST 2024
================
@@ -695,14 +695,27 @@ Value *InstCombinerImpl::simplifyRangeCheck(ICmpInst *Cmp0, ICmpInst *Cmp1,
Cmp1->getPredicate());
Value *Input = Cmp0->getOperand(0);
+ Value *Cmp1Op0 = Cmp1->getOperand(0);
+ Value *Cmp1Op1 = Cmp1->getOperand(1);
Value *RangeEnd;
- if (Cmp1->getOperand(0) == Input) {
+ if (Cmp1Op0 == Input) {
// For the upper range compare we have: icmp x, n
- RangeEnd = Cmp1->getOperand(1);
- } else if (Cmp1->getOperand(1) == Input) {
+ RangeEnd = Cmp1Op1;
+ } else if (isa<SExtInst>(Cmp1Op0) &&
----------------
MatzeB wrote:
ok
https://github.com/llvm/llvm-project/pull/118910
More information about the llvm-commits
mailing list