[llvm] 3937599 - DivRemPairs: Convert tests to use opaque pointers
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 28 06:08:45 PST 2022
Author: Matt Arsenault
Date: 2022-11-28T09:08:31-05:00
New Revision: 393759933c347c477ae7ba125f012b8e1eea5275
URL: https://github.com/llvm/llvm-project/commit/393759933c347c477ae7ba125f012b8e1eea5275
DIFF: https://github.com/llvm/llvm-project/commit/393759933c347c477ae7ba125f012b8e1eea5275.diff
LOG: DivRemPairs: Convert tests to use opaque pointers
Added:
Modified:
llvm/test/Transforms/DivRemPairs/X86/div-expanded-rem-pair.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/DivRemPairs/X86/div-expanded-rem-pair.ll b/llvm/test/Transforms/DivRemPairs/X86/div-expanded-rem-pair.ll
index 685d15458b43c..74fa3a8b7badd 100644
--- a/llvm/test/Transforms/DivRemPairs/X86/div-expanded-rem-pair.ll
+++ b/llvm/test/Transforms/DivRemPairs/X86/div-expanded-rem-pair.ll
@@ -206,26 +206,26 @@ end:
}
; Test for hoisting a udiv to dominate a urem to allow udivrem.
-define i64 @remainder_triangle_i64(i64 %a, i64 %b, i64* %rp) {
+define i64 @remainder_triangle_i64(i64 %a, i64 %b, ptr %rp) {
; CHECK-LABEL: @remainder_triangle_i64(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[CMP:%.*]] = icmp ne i64* [[RP:%.*]], null
+; CHECK-NEXT: [[CMP:%.*]] = icmp ne ptr [[RP:%.*]], null
; CHECK-NEXT: [[DIV:%.*]] = udiv i64 [[A:%.*]], [[B:%.*]]
; CHECK-NEXT: [[REM:%.*]] = urem i64 [[A]], [[B]]
; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[END:%.*]]
; CHECK: if.then:
-; CHECK-NEXT: store i64 [[REM]], i64* [[RP]], align 4
+; CHECK-NEXT: store i64 [[REM]], ptr [[RP]], align 4
; CHECK-NEXT: br label [[END]]
; CHECK: end:
; CHECK-NEXT: ret i64 [[DIV]]
;
entry:
- %cmp = icmp ne i64* %rp, null
+ %cmp = icmp ne ptr %rp, null
br i1 %cmp, label %if.then, label %end
if.then:
%rem = urem i64 %a, %b
- store i64 %rem, i64* %rp
+ store i64 %rem, ptr %rp
br label %end
end:
@@ -235,10 +235,10 @@ end:
; Test for hoisting a udiv to dominate a urem to allow the urem to be expanded
; into mul+sub.
-define i128 @remainder_triangle_i128(i128 %a, i128 %b, i128* %rp) {
+define i128 @remainder_triangle_i128(i128 %a, i128 %b, ptr %rp) {
; CHECK-LABEL: @remainder_triangle_i128(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[CMP:%.*]] = icmp ne i128* [[RP:%.*]], null
+; CHECK-NEXT: [[CMP:%.*]] = icmp ne ptr [[RP:%.*]], null
; CHECK-NEXT: [[A_FROZEN:%.*]] = freeze i128 [[A:%.*]]
; CHECK-NEXT: [[B_FROZEN:%.*]] = freeze i128 [[B:%.*]]
; CHECK-NEXT: [[DIV:%.*]] = udiv i128 [[A_FROZEN]], [[B_FROZEN]]
@@ -246,18 +246,18 @@ define i128 @remainder_triangle_i128(i128 %a, i128 %b, i128* %rp) {
; CHECK: if.then:
; CHECK-NEXT: [[TMP0:%.*]] = mul i128 [[DIV]], [[B_FROZEN]]
; CHECK-NEXT: [[REM_DECOMPOSED:%.*]] = sub i128 [[A_FROZEN]], [[TMP0]]
-; CHECK-NEXT: store i128 [[REM_DECOMPOSED]], i128* [[RP]], align 4
+; CHECK-NEXT: store i128 [[REM_DECOMPOSED]], ptr [[RP]], align 4
; CHECK-NEXT: br label [[END]]
; CHECK: end:
; CHECK-NEXT: ret i128 [[DIV]]
;
entry:
- %cmp = icmp ne i128* %rp, null
+ %cmp = icmp ne ptr %rp, null
br i1 %cmp, label %if.then, label %end
if.then:
%rem = urem i128 %a, %b
- store i128 %rem, i128* %rp
+ store i128 %rem, ptr %rp
br label %end
end:
@@ -265,7 +265,7 @@ end:
ret i128 %div
}
-define i64 @remainder_triangle_i64_multiple_rem_edges(i64 %a, i64 %b, i64 %c, i64* %rp) {
+define i64 @remainder_triangle_i64_multiple_rem_edges(i64 %a, i64 %b, i64 %c, ptr %rp) {
; CHECK-LABEL: @remainder_triangle_i64_multiple_rem_edges(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[DIV:%.*]] = udiv i64 [[A:%.*]], [[B:%.*]]
@@ -275,7 +275,7 @@ define i64 @remainder_triangle_i64_multiple_rem_edges(i64 %a, i64 %b, i64 %c, i6
; CHECK-NEXT: i64 2, label [[SW_BB]]
; CHECK-NEXT: ]
; CHECK: sw.bb:
-; CHECK-NEXT: store i64 [[REM]], i64* [[RP:%.*]], align 4
+; CHECK-NEXT: store i64 [[REM]], ptr [[RP:%.*]], align 4
; CHECK-NEXT: br label [[SW_DEFAULT]]
; CHECK: sw.default:
; CHECK-NEXT: ret i64 [[DIV]]
@@ -288,7 +288,7 @@ entry:
sw.bb: ; preds = %entry, %entry
%rem = urem i64 %a, %b
- store i64 %rem, i64* %rp
+ store i64 %rem, ptr %rp
br label %sw.default
sw.default: ; preds = %entry, %sw.bb
@@ -296,7 +296,7 @@ sw.default: ; preds = %entry, %sw.bb
ret i64 %div
}
-define i64 @remainder_triangle_i64_multiple_div_edges(i64 %a, i64 %b, i64 %c, i64* %rp) {
+define i64 @remainder_triangle_i64_multiple_div_edges(i64 %a, i64 %b, i64 %c, ptr %rp) {
; CHECK-LABEL: @remainder_triangle_i64_multiple_div_edges(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[DIV:%.*]] = udiv i64 [[A:%.*]], [[B:%.*]]
@@ -306,7 +306,7 @@ define i64 @remainder_triangle_i64_multiple_div_edges(i64 %a, i64 %b, i64 %c, i6
; CHECK-NEXT: i64 2, label [[SW_BB]]
; CHECK-NEXT: ]
; CHECK: sw.default:
-; CHECK-NEXT: store i64 [[REM]], i64* [[RP:%.*]], align 4
+; CHECK-NEXT: store i64 [[REM]], ptr [[RP:%.*]], align 4
; CHECK-NEXT: br label [[SW_BB]]
; CHECK: sw.bb:
; CHECK-NEXT: ret i64 [[DIV]]
@@ -319,7 +319,7 @@ entry:
sw.default: ; preds = %entry, %entry
%rem = urem i64 %a, %b
- store i64 %rem, i64* %rp
+ store i64 %rem, ptr %rp
br label %sw.bb
sw.bb: ; preds = %entry, %sw.default
@@ -331,28 +331,28 @@ declare void @maythrow()
; Negative test. make sure we don't transform if there are instructions before
; the rem that might throw.
-define i64 @remainder_triangle_i64_maythrow_rem(i64 %a, i64 %b, i64* %rp) {
+define i64 @remainder_triangle_i64_maythrow_rem(i64 %a, i64 %b, ptr %rp) {
; CHECK-LABEL: @remainder_triangle_i64_maythrow_rem(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[CMP:%.*]] = icmp ne i64* [[RP:%.*]], null
+; CHECK-NEXT: [[CMP:%.*]] = icmp ne ptr [[RP:%.*]], null
; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[END:%.*]]
; CHECK: if.then:
; CHECK-NEXT: call void @maythrow()
; CHECK-NEXT: [[REM:%.*]] = urem i64 [[A:%.*]], [[B:%.*]]
-; CHECK-NEXT: store i64 [[REM]], i64* [[RP]], align 4
+; CHECK-NEXT: store i64 [[REM]], ptr [[RP]], align 4
; CHECK-NEXT: br label [[END]]
; CHECK: end:
; CHECK-NEXT: [[DIV:%.*]] = udiv i64 [[A]], [[B]]
; CHECK-NEXT: ret i64 [[DIV]]
;
entry:
- %cmp = icmp ne i64* %rp, null
+ %cmp = icmp ne ptr %rp, null
br i1 %cmp, label %if.then, label %end
if.then:
call void @maythrow()
%rem = urem i64 %a, %b
- store i64 %rem, i64* %rp
+ store i64 %rem, ptr %rp
br label %end
end:
@@ -362,14 +362,14 @@ end:
; Negative test. make sure we don't transform if there are instructions before
; the div that might throw.
-define i64 @remainder_triangle_i64_maythrow_div(i64 %a, i64 %b, i64* %rp) {
+define i64 @remainder_triangle_i64_maythrow_div(i64 %a, i64 %b, ptr %rp) {
; CHECK-LABEL: @remainder_triangle_i64_maythrow_div(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[CMP:%.*]] = icmp ne i64* [[RP:%.*]], null
+; CHECK-NEXT: [[CMP:%.*]] = icmp ne ptr [[RP:%.*]], null
; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[END:%.*]]
; CHECK: if.then:
; CHECK-NEXT: [[REM:%.*]] = urem i64 [[A:%.*]], [[B:%.*]]
-; CHECK-NEXT: store i64 [[REM]], i64* [[RP]], align 4
+; CHECK-NEXT: store i64 [[REM]], ptr [[RP]], align 4
; CHECK-NEXT: br label [[END]]
; CHECK: end:
; CHECK-NEXT: call void @maythrow()
@@ -377,12 +377,12 @@ define i64 @remainder_triangle_i64_maythrow_div(i64 %a, i64 %b, i64* %rp) {
; CHECK-NEXT: ret i64 [[DIV]]
;
entry:
- %cmp = icmp ne i64* %rp, null
+ %cmp = icmp ne ptr %rp, null
br i1 %cmp, label %if.then, label %end
if.then:
%rem = urem i64 %a, %b
- store i64 %rem, i64* %rp
+ store i64 %rem, ptr %rp
br label %end
end:
@@ -393,28 +393,28 @@ end:
; Negative test, Make sure we don't transform if there are instructions before
; the rem that might throw.
-define i128 @remainder_triangle_i128_maythrow_rem(i128 %a, i128 %b, i128* %rp) {
+define i128 @remainder_triangle_i128_maythrow_rem(i128 %a, i128 %b, ptr %rp) {
; CHECK-LABEL: @remainder_triangle_i128_maythrow_rem(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[CMP:%.*]] = icmp ne i128* [[RP:%.*]], null
+; CHECK-NEXT: [[CMP:%.*]] = icmp ne ptr [[RP:%.*]], null
; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[END:%.*]]
; CHECK: if.then:
; CHECK-NEXT: call void @maythrow()
; CHECK-NEXT: [[REM:%.*]] = urem i128 [[A:%.*]], [[B:%.*]]
-; CHECK-NEXT: store i128 [[REM]], i128* [[RP]], align 4
+; CHECK-NEXT: store i128 [[REM]], ptr [[RP]], align 4
; CHECK-NEXT: br label [[END]]
; CHECK: end:
; CHECK-NEXT: [[DIV:%.*]] = udiv i128 [[A]], [[B]]
; CHECK-NEXT: ret i128 [[DIV]]
;
entry:
- %cmp = icmp ne i128* %rp, null
+ %cmp = icmp ne ptr %rp, null
br i1 %cmp, label %if.then, label %end
if.then:
call void @maythrow()
%rem = urem i128 %a, %b
- store i128 %rem, i128* %rp
+ store i128 %rem, ptr %rp
br label %end
end:
@@ -424,14 +424,14 @@ end:
; Negative test. Make sure we don't transform if there are instructions before
; the div that might throw.
-define i128 @remainder_triangle_i128_maythrow_div(i128 %a, i128 %b, i128* %rp) {
+define i128 @remainder_triangle_i128_maythrow_div(i128 %a, i128 %b, ptr %rp) {
; CHECK-LABEL: @remainder_triangle_i128_maythrow_div(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[CMP:%.*]] = icmp ne i128* [[RP:%.*]], null
+; CHECK-NEXT: [[CMP:%.*]] = icmp ne ptr [[RP:%.*]], null
; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[END:%.*]]
; CHECK: if.then:
; CHECK-NEXT: [[REM:%.*]] = urem i128 [[A:%.*]], [[B:%.*]]
-; CHECK-NEXT: store i128 [[REM]], i128* [[RP]], align 4
+; CHECK-NEXT: store i128 [[REM]], ptr [[RP]], align 4
; CHECK-NEXT: br label [[END]]
; CHECK: end:
; CHECK-NEXT: call void @maythrow()
@@ -439,12 +439,12 @@ define i128 @remainder_triangle_i128_maythrow_div(i128 %a, i128 %b, i128* %rp) {
; CHECK-NEXT: ret i128 [[DIV]]
;
entry:
- %cmp = icmp ne i128* %rp, null
+ %cmp = icmp ne ptr %rp, null
br i1 %cmp, label %if.then, label %end
if.then:
%rem = urem i128 %a, %b
- store i128 %rem, i128* %rp
+ store i128 %rem, ptr %rp
br label %end
end:
@@ -455,7 +455,7 @@ end:
; Negative test. The common predecessor has another successor so we can't hoist
; the udiv to the common predecessor.
-define i64 @remainder_not_triangle_i32(i64 %a, i64 %b, i64 %c, i64*%rp) {
+define i64 @remainder_not_triangle_i32(i64 %a, i64 %b, i64 %c, ptr %rp) {
; CHECK-LABEL: @remainder_not_triangle_i32(
; CHECK-NEXT: entry:
; CHECK-NEXT: switch i64 [[C:%.*]], label [[RETURN:%.*]] [
@@ -464,7 +464,7 @@ define i64 @remainder_not_triangle_i32(i64 %a, i64 %b, i64 %c, i64*%rp) {
; CHECK-NEXT: ]
; CHECK: sw.bb:
; CHECK-NEXT: [[REM:%.*]] = urem i64 [[A:%.*]], [[B:%.*]]
-; CHECK-NEXT: store i64 [[REM]], i64* [[RP:%.*]], align 4
+; CHECK-NEXT: store i64 [[REM]], ptr [[RP:%.*]], align 4
; CHECK-NEXT: br label [[SW_BB1]]
; CHECK: sw.bb1:
; CHECK-NEXT: [[DIV:%.*]] = udiv i64 [[A]], [[B]]
@@ -481,7 +481,7 @@ entry:
sw.bb: ; preds = %entry
%rem = urem i64 %a, %b
- store i64 %rem, i64* %rp
+ store i64 %rem, ptr %rp
br label %sw.bb1
sw.bb1: ; preds = %entry, %sw.bb
@@ -494,14 +494,14 @@ return: ; preds = %entry, %sw.bb1
}
; Negative test. The urem block has a successor that isn't udiv.
-define i64 @remainder_not_triangle_i32_2(i64 %a, i64 %b, i64 %c, i64* %rp) {
+define i64 @remainder_not_triangle_i32_2(i64 %a, i64 %b, i64 %c, ptr %rp) {
; CHECK-LABEL: @remainder_not_triangle_i32_2(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq i64* [[RP:%.*]], null
+; CHECK-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq ptr [[RP:%.*]], null
; CHECK-NEXT: br i1 [[TOBOOL_NOT]], label [[IF_END3:%.*]], label [[IF_THEN:%.*]]
; CHECK: if.then:
; CHECK-NEXT: [[REM:%.*]] = urem i64 [[A:%.*]], [[B:%.*]]
-; CHECK-NEXT: store i64 [[REM]], i64* [[RP]], align 4
+; CHECK-NEXT: store i64 [[REM]], ptr [[RP]], align 4
; CHECK-NEXT: [[TOBOOL1_NOT:%.*]] = icmp eq i64 [[C:%.*]], 0
; CHECK-NEXT: br i1 [[TOBOOL1_NOT]], label [[IF_END3]], label [[RETURN:%.*]]
; CHECK: if.end3:
@@ -512,12 +512,12 @@ define i64 @remainder_not_triangle_i32_2(i64 %a, i64 %b, i64 %c, i64* %rp) {
; CHECK-NEXT: ret i64 [[RETVAL_0]]
;
entry:
- %tobool.not = icmp eq i64* %rp, null
+ %tobool.not = icmp eq ptr %rp, null
br i1 %tobool.not, label %if.end3, label %if.then
if.then: ; preds = %entry
%rem = urem i64 %a, %b
- store i64 %rem, i64* %rp
+ store i64 %rem, ptr %rp
%tobool1.not = icmp eq i64 %c, 0
br i1 %tobool1.not, label %if.end3, label %return
More information about the llvm-commits
mailing list