[llvm] 39d1c58 - [GVNSink] Make tests more robust (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 10 03:40:21 PST 2023
Author: Nikita Popov
Date: 2023-01-10T12:40:10+01:00
New Revision: 39d1c5897a5e0f3c6c20249decd802a6dcbc8477
URL: https://github.com/llvm/llvm-project/commit/39d1c5897a5e0f3c6c20249decd802a6dcbc8477
DIFF: https://github.com/llvm/llvm-project/commit/39d1c5897a5e0f3c6c20249decd802a6dcbc8477.diff
LOG: [GVNSink] Make tests more robust (NFC)
Avoid use of no-op GEPs.
Added:
Modified:
llvm/test/Transforms/GVNSink/sink-common-code.ll
llvm/test/Transforms/GVNSink/struct.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/GVNSink/sink-common-code.ll b/llvm/test/Transforms/GVNSink/sink-common-code.ll
index cb4fde0953422..8f2db59eb11cc 100644
--- a/llvm/test/Transforms/GVNSink/sink-common-code.ll
+++ b/llvm/test/Transforms/GVNSink/sink-common-code.ll
@@ -207,7 +207,7 @@ if.end:
; CHECK: add
; CHECK: add
-%struct.anon = type { i32, i32 }
+%struct.anon = type { i32, i32, i32 }
; The GEP indexes a struct type so cannot have a variable last index.
define i32 @test10(i1 zeroext %flag, i32 %x, i32* %y, %struct.anon* %s) {
@@ -216,13 +216,13 @@ entry:
if.then:
%dummy = add i32 %x, 5
- %gepa = getelementptr inbounds %struct.anon, %struct.anon* %s, i32 0, i32 0
+ %gepa = getelementptr inbounds %struct.anon, %struct.anon* %s, i32 0, i32 1
store volatile i32 %x, i32* %gepa
br label %if.end
if.else:
%dummy1 = add i32 %x, 6
- %gepb = getelementptr inbounds %struct.anon, %struct.anon* %s, i32 0, i32 1
+ %gepb = getelementptr inbounds %struct.anon, %struct.anon* %s, i32 0, i32 2
store volatile i32 %x, i32* %gepb
br label %if.end
diff --git a/llvm/test/Transforms/GVNSink/struct.ll b/llvm/test/Transforms/GVNSink/struct.ll
index 60b6a36108cb0..f7eef1b280cb4 100644
--- a/llvm/test/Transforms/GVNSink/struct.ll
+++ b/llvm/test/Transforms/GVNSink/struct.ll
@@ -1,6 +1,6 @@
; RUN: opt -passes=gvn-sink -S < %s | FileCheck %s
-%struct = type {i32, i32}
+%struct = type {i32, i32, i32}
%struct2 = type { [ 2 x i32], i32 }
; Struct indices cannot be variant.
@@ -17,11 +17,11 @@ bb1: ; preds = %bb
br label %bb4
bb2: ; preds = %bb
- %tmp3 = getelementptr inbounds %struct, %struct* null, i64 0, i32 0
+ %tmp3 = getelementptr inbounds %struct, %struct* null, i64 0, i32 2
br label %bb4
bb4: ; preds = %bb2, %bb1
- %tmp5 = phi i32 [ 1, %bb1 ], [ 0, %bb2 ]
+ %tmp5 = phi i32 [ 1, %bb1 ], [ 2, %bb2 ]
ret void
}
@@ -39,11 +39,11 @@ bb1: ; preds = %bb
br label %bb4
bb2: ; preds = %bb
- %tmp3 = getelementptr inbounds %struct2, %struct2* null, i64 0, i32 0, i32 0
+ %tmp3 = getelementptr inbounds %struct2, %struct2* null, i64 0, i32 0, i32 2
br label %bb4
bb4: ; preds = %bb2, %bb1
- %tmp5 = phi i32 [ 1, %bb1 ], [ 0, %bb2 ]
+ %tmp5 = phi i32 [ 1, %bb1 ], [ 2, %bb2 ]
ret void
}
@@ -58,14 +58,14 @@ bb:
br i1 undef, label %bb2, label %bb1
bb1: ; preds = %bb
- %tmp = getelementptr inbounds %struct, %struct* null, i32 0, i32 0
+ %tmp = getelementptr inbounds %struct, %struct* null, i32 1, i32 0
br label %bb4
bb2: ; preds = %bb
- %tmp3 = getelementptr inbounds %struct, %struct* null, i32 1, i32 0
+ %tmp3 = getelementptr inbounds %struct, %struct* null, i32 2, i32 0
br label %bb4
bb4: ; preds = %bb2, %bb1
- %tmp5 = phi i32 [ 0, %bb1 ], [ 1, %bb2 ]
+ %tmp5 = phi i32 [ 1, %bb1 ], [ 2, %bb2 ]
ret void
}
More information about the llvm-commits
mailing list