[llvm] f1bc1a8 - [ValueTracking] Add additional non-zero add recurrence test (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 14 10:06:28 PDT 2021
Author: Nikita Popov
Date: 2021-04-14T19:06:18+02:00
New Revision: f1bc1a82cf718a67d3271fc74c28f5845f0f1526
URL: https://github.com/llvm/llvm-project/commit/f1bc1a82cf718a67d3271fc74c28f5845f0f1526
DIFF: https://github.com/llvm/llvm-project/commit/f1bc1a82cf718a67d3271fc74c28f5845f0f1526.diff
LOG: [ValueTracking] Add additional non-zero add recurrence test (NFC)
Also drop a number of unused parameters from existing tests.
Added:
Modified:
llvm/test/Analysis/ValueTracking/monotonic-phi.ll
Removed:
################################################################################
diff --git a/llvm/test/Analysis/ValueTracking/monotonic-phi.ll b/llvm/test/Analysis/ValueTracking/monotonic-phi.ll
index af8ad2931e10f..fb7865d1c323b 100644
--- a/llvm/test/Analysis/ValueTracking/monotonic-phi.ll
+++ b/llvm/test/Analysis/ValueTracking/monotonic-phi.ll
@@ -1,7 +1,7 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -instsimplify -S < %s | FileCheck %s
-define i1 @test_add_nsw(i8 %p, i8* %pq, i8 %n, i8 %r) {
+define i1 @test_add_nsw(i8 %n, i8 %r) {
; CHECK-LABEL: @test_add_nsw(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
@@ -26,7 +26,7 @@ exit:
ret i1 %cmp
}
-define i1 @test_add_may_wrap(i8 %p, i8* %pq, i8 %n, i8 %r) {
+define i1 @test_add_may_wrap(i8 %n, i8 %r) {
; CHECK-LABEL: @test_add_may_wrap(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
@@ -53,7 +53,7 @@ exit:
ret i1 %cmp
}
-define i1 @test_add_nuw(i8 %p, i8* %pq, i8 %n, i8 %r) {
+define i1 @test_add_nuw(i8 %n, i8 %r) {
; CHECK-LABEL: @test_add_nuw(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
@@ -78,7 +78,34 @@ exit:
ret i1 %cmp
}
-define i1 @test_add_zero_start(i8 %p, i8* %pq, i8 %n, i8 %r) {
+define i1 @test_add_nuw_unknown_step(i8 %n, i8 %r, i8 %s) {
+; CHECK-LABEL: @test_add_nuw_unknown_step(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br label [[LOOP:%.*]]
+; CHECK: loop:
+; CHECK-NEXT: [[A:%.*]] = phi i8 [ 1, [[ENTRY:%.*]] ], [ [[NEXT:%.*]], [[LOOP]] ]
+; CHECK-NEXT: [[NEXT]] = add nuw i8 [[A]], [[S:%.*]]
+; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i8 [[A]], [[N:%.*]]
+; CHECK-NEXT: br i1 [[CMP1]], label [[EXIT:%.*]], label [[LOOP]]
+; CHECK: exit:
+; CHECK-NEXT: [[ADD:%.*]] = or i8 [[A]], [[R:%.*]]
+; CHECK-NEXT: [[CMP:%.*]] = icmp eq i8 [[ADD]], 0
+; CHECK-NEXT: ret i1 [[CMP]]
+;
+entry:
+ br label %loop
+loop:
+ %A = phi i8 [ 1, %entry ], [ %next, %loop ]
+ %next = add nuw i8 %A, %s
+ %cmp1 = icmp eq i8 %A, %n
+ br i1 %cmp1, label %exit, label %loop
+exit:
+ %add = or i8 %A, %r
+ %cmp = icmp eq i8 %add, 0
+ ret i1 %cmp
+}
+
+define i1 @test_add_zero_start(i8 %n, i8 %r) {
; CHECK-LABEL: @test_add_zero_start(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
@@ -105,7 +132,7 @@ exit:
ret i1 %cmp
}
-define i1 @test_add_nuw_negative_start(i8 %p, i8* %pq, i8 %n, i8 %r) {
+define i1 @test_add_nuw_negative_start(i8 %n, i8 %r) {
; CHECK-LABEL: @test_add_nuw_negative_start(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
@@ -130,7 +157,7 @@ exit:
ret i1 %cmp
}
-define i1 @test_add_nsw_negative_start(i8 %p, i8* %pq, i8 %n, i8 %r) {
+define i1 @test_add_nsw_negative_start(i8 %n, i8 %r) {
; CHECK-LABEL: @test_add_nsw_negative_start(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
@@ -157,7 +184,7 @@ exit:
ret i1 %cmp
}
-define i1 @test_add_nsw_negative_start_and_step(i8 %p, i8* %pq, i8 %n, i8 %r) {
+define i1 @test_add_nsw_negative_start_and_step(i8 %n, i8 %r) {
; CHECK-LABEL: @test_add_nsw_negative_start_and_step(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
@@ -182,7 +209,7 @@ exit:
ret i1 %cmp
}
-define i1 @test_mul_nsw(i8 %p, i8* %pq, i8 %n) {
+define i1 @test_mul_nsw(i8 %n) {
; CHECK-LABEL: @test_mul_nsw(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
@@ -206,7 +233,7 @@ exit:
ret i1 %cmp
}
-define i1 @test_mul_may_wrap(i8 %p, i8* %pq, i8 %n) {
+define i1 @test_mul_may_wrap(i8 %n) {
; CHECK-LABEL: @test_mul_may_wrap(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
@@ -231,7 +258,7 @@ exit:
ret i1 %cmp
}
-define i1 @test_mul_nuw(i8 %p, i8* %pq, i8 %n) {
+define i1 @test_mul_nuw(i8 %n) {
; CHECK-LABEL: @test_mul_nuw(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
@@ -255,7 +282,7 @@ exit:
ret i1 %cmp
}
-define i1 @test_mul_zero_start(i8 %p, i8* %pq, i8 %n) {
+define i1 @test_mul_zero_start(i8 %n) {
; CHECK-LABEL: @test_mul_zero_start(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
@@ -280,7 +307,7 @@ exit:
ret i1 %cmp
}
-define i1 @test_mul_nuw_negative_step(i8 %p, i8* %pq, i8 %n) {
+define i1 @test_mul_nuw_negative_step(i8 %n) {
; CHECK-LABEL: @test_mul_nuw_negative_step(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
@@ -304,7 +331,7 @@ exit:
ret i1 %cmp
}
-define i1 @test_mul_nsw_negative_step(i8 %p, i8* %pq, i8 %n) {
+define i1 @test_mul_nsw_negative_step(i8 %n) {
; CHECK-LABEL: @test_mul_nsw_negative_step(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
@@ -329,7 +356,7 @@ exit:
ret i1 %cmp
}
-define i1 @test_mul_nuw_negative_start(i8 %p, i8* %pq, i8 %n) {
+define i1 @test_mul_nuw_negative_start(i8 %n) {
; CHECK-LABEL: @test_mul_nuw_negative_start(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
@@ -353,7 +380,7 @@ exit:
ret i1 %cmp
}
-define i1 @test_shl_nuw(i8 %p, i8* %pq, i8 %n) {
+define i1 @test_shl_nuw(i8 %n) {
; CHECK-LABEL: @test_shl_nuw(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
@@ -377,7 +404,7 @@ exit:
ret i1 %cmp
}
-define i1 @test_shl_nsw(i8 %p, i8* %pq, i8 %n) {
+define i1 @test_shl_nsw(i8 %n) {
; CHECK-LABEL: @test_shl_nsw(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
@@ -401,7 +428,7 @@ exit:
ret i1 %cmp
}
-define i1 @test_shl_dynamic_shift(i8 %p, i8* %pq, i8 %n, i8 %shift) {
+define i1 @test_shl_dynamic_shift(i8 %n, i8 %shift) {
; CHECK-LABEL: @test_shl_dynamic_shift(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
@@ -425,7 +452,7 @@ exit:
ret i1 %cmp
}
-define i1 @test_shl_may_wrap(i8 %p, i8* %pq, i8 %n) {
+define i1 @test_shl_may_wrap(i8 %n) {
; CHECK-LABEL: @test_shl_may_wrap(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
@@ -450,7 +477,7 @@ exit:
ret i1 %cmp
}
-define i1 @test_shl_zero_start(i8 %p, i8* %pq, i8 %n) {
+define i1 @test_shl_zero_start(i8 %n) {
; CHECK-LABEL: @test_shl_zero_start(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
@@ -476,7 +503,7 @@ exit:
}
-define i1 @test_lshr_exact(i8 %p, i8* %pq, i8 %n) {
+define i1 @test_lshr_exact(i8 %n) {
; CHECK-LABEL: @test_lshr_exact(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
@@ -500,7 +527,7 @@ exit:
ret i1 %cmp
}
-define i1 @test_lshr_may_wrap(i8 %p, i8* %pq, i8 %n) {
+define i1 @test_lshr_may_wrap(i8 %n) {
; CHECK-LABEL: @test_lshr_may_wrap(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
@@ -525,7 +552,7 @@ exit:
ret i1 %cmp
}
-define i1 @test_lshr_zero_start(i8 %p, i8* %pq, i8 %n) {
+define i1 @test_lshr_zero_start(i8 %n) {
; CHECK-LABEL: @test_lshr_zero_start(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
@@ -550,7 +577,7 @@ exit:
ret i1 %cmp
}
-define i1 @test_ashr_exact(i8 %p, i8* %pq, i8 %n) {
+define i1 @test_ashr_exact(i8 %n) {
; CHECK-LABEL: @test_ashr_exact(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
@@ -574,7 +601,7 @@ exit:
ret i1 %cmp
}
-define i1 @test_ashr_may_wrap(i8 %p, i8* %pq, i8 %n) {
+define i1 @test_ashr_may_wrap(i8 %n) {
; CHECK-LABEL: @test_ashr_may_wrap(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
@@ -599,7 +626,7 @@ exit:
ret i1 %cmp
}
-define i1 @test_ashr_zero_start(i8 %p, i8* %pq, i8 %n) {
+define i1 @test_ashr_zero_start(i8 %n) {
; CHECK-LABEL: @test_ashr_zero_start(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
More information about the llvm-commits
mailing list