[PATCH] D154342: [InstCombine] Test cases for D154206

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 5 01:29:23 PDT 2023


nikic added inline comments.


================
Comment at: llvm/test/Transforms/InstCombine/icmp-usub-sat.ll:53
+  %sub = call i64 @llvm.usub.sat.i64(i64 %arg, i64 5)
+  %cmp = icmp ult i64 %sub, 1
+  ret i1 %cmp
----------------
`ult 1` is `eq 0` which is a special case. I'd adjust the constant to be 2 here.


================
Comment at: llvm/test/Transforms/InstCombine/icmp-usub-sat.ll:178
+; CHECK-SAME: (i8 [[ARG:%.*]]) {
+; CHECK-NEXT:    ret i1 false
+;
----------------
Pick different constants so it's not always false?


================
Comment at: llvm/test/Transforms/InstCombine/icmp-usub-sat.ll:257
+  %ret = trunc i8 %add to i1
+  ret i1 %ret
+}
----------------
The standard pattern for multi-use tests is `call void @use(i8 %sub)`. Avoids any funny folds.


================
Comment at: llvm/test/Transforms/InstCombine/icmp-usub-sat.ll:276
+  ret i1 %ret
+}
+
----------------
As you don't allow multi-use folds, it's enough to have a single test to cover this -- there's no much in point in having 10 tests that all show the same thing.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154342/new/

https://reviews.llvm.org/D154342



More information about the llvm-commits mailing list