[llvm] [ValueTracking] [ValueTracking] Add more conditions in `isTruePredicate` (PR #86083)

via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 20 22:08:57 PDT 2024


================
@@ -216,7 +222,13 @@ define i1 @test13(i32 %length.i, i32 %x) {
 
 define i1 @test14(i32 %length.i, i32 %x.full) {
 ; CHECK-LABEL: @test14(
-; CHECK-NEXT:    ret i1 true
+; CHECK-NEXT:    [[X:%.*]] = and i32 [[X_FULL:%.*]], -61681
+; CHECK-NEXT:    [[LARGE:%.*]] = or i32 [[X]], 8224
+; CHECK-NEXT:    [[SMALL:%.*]] = or i32 [[X]], 4112
+; CHECK-NEXT:    [[KNOWN:%.*]] = icmp ult i32 [[LARGE]], [[LENGTH_I:%.*]]
+; CHECK-NEXT:    [[TO_PROVE:%.*]] = icmp ult i32 [[SMALL]], [[LENGTH_I]]
+; CHECK-NEXT:    [[RES:%.*]] = icmp ule i1 [[KNOWN]], [[TO_PROVE]]
+; CHECK-NEXT:    ret i1 [[RES]]
----------------
goldsteinn wrote:

These two regressions are b.c I removed the bespoke `or disjoint` detection logic. I figure its certainly more inline with our philosphy for these functions to rely on flags.
Note that if you run `InstCombine` (not just `InstSimplify`), these both get simplified to `true`.

https://github.com/llvm/llvm-project/pull/86083


More information about the llvm-commits mailing list