[PATCH] D89317: [InstructionSimplify] icmp simplification
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 13 07:05:42 PDT 2020
lebedev.ri added inline comments.
================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:2882
+ // C + B == C + D -> B == D
+ if (A == C && CB && CD && CB->getSExtValue() <= CD->getSExtValue())
+ return true;
----------------
Please compare APInt's themselves, otherwise this will crash with an assertion for e.g. i65.
================
Comment at: llvm/test/Transforms/InstSimplify/compare.ll:1712
+; Test simplifications for: icmp (X+Y), (X+Z) -> icmp Y,Z
+; Test the overflow check when the RHS has NSW set and constant Z is greater
----------------
Please precommit the tests.
================
Comment at: llvm/test/Transforms/InstSimplify/compare.ll:1774
+
+define i1 @icmp_nsw_6(i32 %V) {
+; CHECK-LABEL: @icmp_nsw_6(
----------------
At least this one is already folded away by instcombine,
so likely there's some code to be moved/refactored/shared.
https://godbolt.org/z/Yo3d6h
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89317/new/
https://reviews.llvm.org/D89317
More information about the llvm-commits
mailing list