Skip to content

Commit 997d7d1

Browse files
committed
InstCombine: Convert some tests to opaque pointers
Needed manual fixes: 2008-01-06-VoidCast.ll alias.ll @0 type lost pr27703.ll totally confused pr44242.ll phi and update_test_checks pr44245.ll phi and update_test_checks Needed re-running update_test_checks: 2009-01-08-AlignAlloca.ll 2009-02-20-InstCombine-SROA.ll addrspacecast.ll alloca-cast-debuginfo.ll alloca-in-non-alloca-as.ll alloca.ll icmp-gep.ll icmp-custom-dl.ll lifetime-no-null-opt.ll non-integral-pointers.ll pr33689_same_bitwidth.ll pr39908.ll scalable-cast-of-alloc.ll select-cmp-br.ll unpack-fca.ll Converted to generated checks: 2012-6-7-vselect-bitcast.ll
1 parent 8be07f6 commit 997d7d1

25 files changed

+1241
-1456
lines changed

llvm/test/Transforms/InstCombine/2008-01-06-VoidCast.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ define void @f(i16 %y) {
66

77
define i32 @g(i32 %y) {
88
; CHECK-LABEL: @g(
9-
; CHECK: call i32 bitcast
10-
%x = call i32 bitcast (void (i16)* @f to i32 (i32)*)( i32 %y ) ; <i32> [#uses=1]
9+
; CHECK-NEXT %x = call i32 @f(i32 %y) ; <i32> [#uses=1]
10+
%x = call i32 @f( i32 %y ) ; <i32> [#uses=1]
1111
ret i32 %x
1212
}

llvm/test/Transforms/InstCombine/2009-01-08-AlignAlloca.ll

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,36 @@
44
; rdar://6480438
55
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
66
target triple = "i386-apple-darwin9.6"
7-
%struct.Key = type { { i32, i32 } }
8-
%struct.anon = type <{ i8, [3 x i8], i32 }>
7+
%struct.Key = type { { i32, i32 } }
8+
%struct.anon = type <{ i8, [3 x i8], i32 }>
99

1010
define i32 @bar(i64 %key_token2) nounwind {
1111
; CHECK-LABEL: @bar(
1212
; CHECK-NEXT: entry:
1313
; CHECK-NEXT: [[IOSPEC:%.*]] = alloca [[STRUCT_KEY:%.*]], align 8
1414
; CHECK-NEXT: [[RET:%.*]] = alloca i32, align 4
15-
; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[STRUCT_KEY]], %struct.Key* [[IOSPEC]], i32 0, i32 0, i32 0
16-
; CHECK-NEXT: store i32 0, i32* [[TMP0]], align 8
17-
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[STRUCT_KEY]], %struct.Key* [[IOSPEC]], i32 0, i32 0, i32 1
18-
; CHECK-NEXT: store i32 0, i32* [[TMP1]], align 4
19-
; CHECK-NEXT: [[TMP2:%.*]] = bitcast %struct.Key* [[IOSPEC]] to i64*
20-
; CHECK-NEXT: store i64 [[KEY_TOKEN2:%.*]], i64* [[TMP2]], align 8
21-
; CHECK-NEXT: [[TMP3:%.*]] = call i32 (...) @foo(%struct.Key* nonnull byval(%struct.Key) align 4 [[IOSPEC]], i32* nonnull [[RET]]) [[ATTR0:#.*]]
22-
; CHECK-NEXT: [[TMP4:%.*]] = load i32, i32* [[RET]], align 4
23-
; CHECK-NEXT: ret i32 [[TMP4]]
15+
; CHECK-NEXT: store i32 0, ptr [[IOSPEC]], align 8
16+
; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds { i32, i32 }, ptr [[IOSPEC]], i32 0, i32 1
17+
; CHECK-NEXT: store i32 0, ptr [[TMP0]], align 4
18+
; CHECK-NEXT: store i64 [[KEY_TOKEN2:%.*]], ptr [[IOSPEC]], align 8
19+
; CHECK-NEXT: [[TMP1:%.*]] = call i32 (...) @foo(ptr nonnull byval([[STRUCT_KEY]]) align 4 [[IOSPEC]], ptr nonnull [[RET]]) #[[ATTR0:[0-9]+]]
20+
; CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[RET]], align 4
21+
; CHECK-NEXT: ret i32 [[TMP2]]
2422
;
2523
entry:
26-
%iospec = alloca %struct.Key ; <%struct.Key*> [#uses=3]
27-
%ret = alloca i32 ; <i32*> [#uses=2]
24+
%iospec = alloca %struct.Key ; <ptr> [#uses=3]
25+
%ret = alloca i32 ; <ptr> [#uses=2]
2826
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
29-
%0 = getelementptr %struct.Key, %struct.Key* %iospec, i32 0, i32 0 ; <{ i32, i32 }*> [#uses=2]
30-
%1 = getelementptr { i32, i32 }, { i32, i32 }* %0, i32 0, i32 0 ; <i32*> [#uses=1]
31-
store i32 0, i32* %1, align 4
32-
%2 = getelementptr { i32, i32 }, { i32, i32 }* %0, i32 0, i32 1 ; <i32*> [#uses=1]
33-
store i32 0, i32* %2, align 4
34-
%3 = getelementptr %struct.Key, %struct.Key* %iospec, i32 0, i32 0 ; <{ i32, i32 }*> [#uses=1]
35-
%4 = bitcast { i32, i32 }* %3 to i64* ; <i64*> [#uses=1]
36-
store i64 %key_token2, i64* %4, align 4
37-
%5 = call i32 (...) @foo(%struct.Key* byval(%struct.Key) align 4 %iospec, i32* %ret) nounwind ; <i32> [#uses=0]
38-
%6 = load i32, i32* %ret, align 4 ; <i32> [#uses=1]
39-
ret i32 %6
27+
%0 = getelementptr %struct.Key, ptr %iospec, i32 0, i32 0 ; <ptr> [#uses=2]
28+
%1 = getelementptr { i32, i32 }, ptr %0, i32 0, i32 0 ; <ptr> [#uses=1]
29+
store i32 0, ptr %1, align 4
30+
%2 = getelementptr { i32, i32 }, ptr %0, i32 0, i32 1 ; <ptr> [#uses=1]
31+
store i32 0, ptr %2, align 4
32+
%3 = getelementptr %struct.Key, ptr %iospec, i32 0, i32 0 ; <ptr> [#uses=1]
33+
store i64 %key_token2, ptr %3, align 4
34+
%4 = call i32 (...) @foo(ptr byval(%struct.Key) align 4 %iospec, ptr %ret) nounwind ; <i32> [#uses=0]
35+
%5 = load i32, ptr %ret, align 4 ; <i32> [#uses=1]
36+
ret i32 %5
4037
}
4138

4239
declare i32 @foo(...)

llvm/test/Transforms/InstCombine/2009-02-20-InstCombine-SROA.ll

Lines changed: 308 additions & 344 deletions
Large diffs are not rendered by default.
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
2-
; CHECK: bitcast
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2+
; RUN: opt -S -passes=instcombine < %s | FileCheck %s
33

4-
define void @foo(<16 x i8> %a, <16 x i8> %b, <4 x i32>* %c) {
4+
define void @foo(<16 x i8> %a, <16 x i8> %b, ptr %c) {
5+
; CHECK-LABEL: @foo(
6+
; CHECK-NEXT: store <16 x i8> [[B:%.*]], ptr [[C:%.*]], align 4
7+
; CHECK-NEXT: ret void
8+
;
59
%aa = bitcast <16 x i8> %a to <4 x i32>
610
%bb = bitcast <16 x i8> %b to <4 x i32>
711
%select_v = select <4 x i1> zeroinitializer, <4 x i32> %aa, <4 x i32> %bb
8-
store <4 x i32> %select_v, <4 x i32>* %c, align 4
12+
store <4 x i32> %select_v, ptr %c, align 4
913
ret void
1014
}
1115

0 commit comments

Comments
 (0)