[PATCH] D65017: [InstCombine] Teach foldOrOfICmps to allow icmp eq MIN_INT/MAX to be part of a range comparision.
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 20 02:37:56 PDT 2019
nikic added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2262
+ case ICmpInst::ICMP_SGT:
+ // We can treat equality of MIN_SINT as being ULE MIN_SINT.
+ if (LHSC->isMinValue(true))
----------------
ULE -> SLE
================
Comment at: llvm/test/Transforms/InstCombine/and-or-icmps.ll:316
+; CHECK-NEXT: [[TMP1:%.*]] = icmp ugt i32 [[X_OFF]], 2147483645
+; CHECK-NEXT: ret i1 [[TMP1]]
;
----------------
This seems like a weird choice that the range check code is making. We could also generate
```
%x.off = add i32 %x, 1
%c = icmp ult i32 %x.off, -2147483646
```
with smaller constants.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65017/new/
https://reviews.llvm.org/D65017
More information about the llvm-commits
mailing list