[llvm] 979720a - [DSE,MSSA] Add additional merging test cases (NFC).
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 15 07:46:31 PDT 2020
Author: Florian Hahn
Date: 2020-06-15T15:45:07+01:00
New Revision: 979720a9bbcfff1e0d3f1e6e4e9ba67aeed71def
URL: https://github.com/llvm/llvm-project/commit/979720a9bbcfff1e0d3f1e6e4e9ba67aeed71def
DIFF: https://github.com/llvm/llvm-project/commit/979720a9bbcfff1e0d3f1e6e4e9ba67aeed71def.diff
LOG: [DSE,MSSA] Add additional merging test cases (NFC).
Additional tests added ahead of partial overlapping store merging.
Added:
Modified:
llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-partial.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-partial.ll b/llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-partial.ll
index 86f9f8fc4710..81184fee69a9 100644
--- a/llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-partial.ll
+++ b/llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-partial.ll
@@ -3,11 +3,10 @@
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
-
-define void @second_store_smaller(i32* noalias %P) {
-; CHECK-LABEL: @second_store_smaller(
+define void @second_store_smaller_1(i32* noalias %P, i1 %c) {
+; CHECK-LABEL: @second_store_smaller_1(
; CHECK-NEXT: store i32 1, i32* [[P:%.*]], align 4
-; CHECK-NEXT: br i1 true, label [[BB1:%.*]], label [[BB2:%.*]]
+; CHECK-NEXT: br i1 [[C:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
; CHECK: bb1:
; CHECK-NEXT: br label [[BB3:%.*]]
; CHECK: bb2:
@@ -18,7 +17,7 @@ define void @second_store_smaller(i32* noalias %P) {
; CHECK-NEXT: ret void
;
store i32 1, i32* %P
- br i1 true, label %bb1, label %bb2
+ br i1 %c, label %bb1, label %bb2
bb1:
br label %bb3
bb2:
@@ -29,10 +28,124 @@ bb3:
ret void
}
+define void @second_store_smaller_2(i32* noalias %P, i1 %c) {
+; CHECK-LABEL: @second_store_smaller_2(
+; CHECK-NEXT: store i32 1, i32* [[P:%.*]], align 4
+; CHECK-NEXT: br i1 [[C:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
+; CHECK: bb1:
+; CHECK-NEXT: br label [[BB3:%.*]]
+; CHECK: bb2:
+; CHECK-NEXT: br label [[BB3]]
+; CHECK: bb3:
+; CHECK-NEXT: [[P_I16:%.*]] = bitcast i32* [[P]] to i16*
+; CHECK-NEXT: store i16 12345, i16* [[P_I16]], align 2
+; CHECK-NEXT: ret void
+;
+ store i32 1, i32* %P
+ br i1 %c, label %bb1, label %bb2
+bb1:
+ br label %bb3
+bb2:
+ br label %bb3
+bb3:
+ %P.i16 = bitcast i32* %P to i16*
+ store i16 12345, i16* %P.i16
+ ret void
+}
+
+declare void @use(i16) readnone
+declare void @use.i8(i8) readnone
+
+define void @second_store_smaller_3(i32* noalias %P, i1 %c) {
+; CHECK-LABEL: @second_store_smaller_3(
+; CHECK-NEXT: store i32 1, i32* [[P:%.*]], align 4
+; CHECK-NEXT: [[P_I16:%.*]] = bitcast i32* [[P]] to i16*
+; CHECK-NEXT: br i1 [[C:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
+; CHECK: bb1:
+; CHECK-NEXT: [[L1:%.*]] = load i16, i16* [[P_I16]], align 2
+; CHECK-NEXT: call void @use(i16 [[L1]])
+; CHECK-NEXT: br label [[BB3:%.*]]
+; CHECK: bb2:
+; CHECK-NEXT: br label [[BB3]]
+; CHECK: bb3:
+; CHECK-NEXT: store i16 -31073, i16* [[P_I16]], align 2
+; CHECK-NEXT: ret void
+;
+ store i32 1, i32* %P
+ %P.i16 = bitcast i32* %P to i16*
+ br i1 %c, label %bb1, label %bb2
+
+bb1:
+ %l1 = load i16, i16* %P.i16
+ call void @use(i16 %l1)
+ br label %bb3
+bb2:
+ br label %bb3
+bb3:
+ store i16 -31073, i16* %P.i16
+ ret void
+}
+
+define void @second_store_smaller_4(i32* noalias %P, i1 %c) {
+; CHECK-LABEL: @second_store_smaller_4(
+; CHECK-NEXT: store i32 1, i32* [[P:%.*]], align 4
+; CHECK-NEXT: br i1 [[C:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
+; CHECK: bb1:
+; CHECK-NEXT: [[P_I8:%.*]] = bitcast i32* [[P]] to i8*
+; CHECK-NEXT: [[L1:%.*]] = load i8, i8* [[P_I8]], align 1
+; CHECK-NEXT: call void @use.i8(i8 [[L1]])
+; CHECK-NEXT: br label [[BB3:%.*]]
+; CHECK: bb2:
+; CHECK-NEXT: br label [[BB3]]
+; CHECK: bb3:
+; CHECK-NEXT: [[P_I16:%.*]] = bitcast i32* [[P]] to i16*
+; CHECK-NEXT: store i16 -31073, i16* [[P_I16]], align 2
+; CHECK-NEXT: ret void
+;
+ store i32 1, i32* %P
+ br i1 %c, label %bb1, label %bb2
+
+bb1:
+ %P.i8 = bitcast i32* %P to i8*
+ %l1 = load i8, i8* %P.i8
+ call void @use.i8(i8 %l1)
+ br label %bb3
+bb2:
+ br label %bb3
+bb3:
+ %P.i16 = bitcast i32* %P to i16*
+ store i16 -31073, i16* %P.i16
+ ret void
+}
+
+define void @second_store_smaller_5(i32* noalias %P, i16 %x, i1 %c) {
+; CHECK-LABEL: @second_store_smaller_5(
+; CHECK-NEXT: store i32 1, i32* [[P:%.*]], align 4
+; CHECK-NEXT: br i1 [[C:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
+; CHECK: bb1:
+; CHECK-NEXT: br label [[BB3:%.*]]
+; CHECK: bb2:
+; CHECK-NEXT: br label [[BB3]]
+; CHECK: bb3:
+; CHECK-NEXT: [[P_I16:%.*]] = bitcast i32* [[P]] to i16*
+; CHECK-NEXT: store i16 [[X:%.*]], i16* [[P_I16]], align 2
+; CHECK-NEXT: ret void
+;
+ store i32 1, i32* %P
+ br i1 %c, label %bb1, label %bb2
+bb1:
+ br label %bb3
+bb2:
+ br label %bb3
+bb3:
+ %P.i16 = bitcast i32* %P to i16*
+ store i16 %x, i16* %P.i16
+ ret void
+}
-define void @second_store_bigger(i32* noalias %P) {
+define void @second_store_bigger(i32* noalias %P, i1 %c) {
; CHECK-LABEL: @second_store_bigger(
-; CHECK-NEXT: br i1 true, label [[BB1:%.*]], label [[BB2:%.*]]
+; CHECK-NEXT: br i1 [[C:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
; CHECK: bb1:
; CHECK-NEXT: br label [[BB3:%.*]]
; CHECK: bb2:
@@ -43,7 +156,7 @@ define void @second_store_bigger(i32* noalias %P) {
; CHECK-NEXT: ret void
;
store i32 1, i32* %P
- br i1 true, label %bb1, label %bb2
+ br i1 %c, label %bb1, label %bb2
bb1:
br label %bb3
bb2:
@@ -53,4 +166,3 @@ bb3:
store i64 0, i64* %P.i64
ret void
}
-
More information about the llvm-commits
mailing list