Skip to content

Commit 4df6f3f

Browse files
committed
InstCombine: Stop using grep in some tests
Switch to FileCheck and generated checks.
1 parent 66cf61a commit 4df6f3f

File tree

2 files changed

+43
-21
lines changed

2 files changed

+43
-21
lines changed
Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
12
;; The bitcast cannot be eliminated because byval arguments need
23
;; the correct type, or at least a type of the correct size.
3-
; RUN: opt < %s -passes=instcombine -S | grep bitcast
4+
; RUN: opt -S -passes=instcombine < %s | FileCheck %s
45
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"
56
target triple = "i386-apple-darwin9"
6-
%struct.NSRect = type { [4 x float] }
7+
8+
%struct.NSRect = type { [4 x float] }
79

810
define void @foo(i8* %context) nounwind {
11+
; CHECK-LABEL: @foo(
12+
; CHECK-NEXT: entry:
13+
; CHECK-NEXT: [[TMP1:%.*]] = bitcast i8* [[CONTEXT:%.*]] to %struct.NSRect*
14+
; CHECK-NEXT: call void (i32, ...) @bar(i32 3, %struct.NSRect* byval([[STRUCT_NSRECT:%.*]]) align 4 [[TMP1]]) #[[ATTR0:[0-9]+]]
15+
; CHECK-NEXT: ret void
16+
;
917
entry:
10-
%tmp1 = bitcast i8* %context to %struct.NSRect* ; <%struct.NSRect*> [#uses=1]
11-
call void (i32, ...) @bar( i32 3, %struct.NSRect* byval(%struct.NSRect) align 4 %tmp1 ) nounwind
12-
ret void
18+
%tmp1 = bitcast i8* %context to %struct.NSRect* ; <%struct.NSRect*> [#uses=1]
19+
call void (i32, ...) @bar( i32 3, %struct.NSRect* byval(%struct.NSRect) align 4 %tmp1 ) nounwind
20+
ret void
1321
}
1422

1523
declare void @bar(i32, ...)
Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,42 @@
1-
; RUN: opt < %s -passes=instcombine -S | \
2-
; RUN: grep "call float bitcast" | count 1
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2+
; RUN: opt -S -passes=instcombine < %s | FileCheck %s
3+
; Check that there's a call one call to @objc_msgSend_fpret with a
4+
; float result
5+
36
target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
4-
%struct.NSObject = type { %struct.objc_class* }
5-
%struct.NSArray = type { %struct.NSObject }
6-
%struct.objc_class = type opaque
7-
%struct.objc_selector = type opaque
7+
%struct.NSObject = type { %struct.objc_class* }
8+
%struct.NSArray = type { %struct.NSObject }
9+
%struct.objc_class = type opaque
10+
%struct.objc_selector = type opaque
811

912
@"\01L_OBJC_METH_VAR_NAME_112" = internal global [15 x i8] c"whiteComponent\00", section "__TEXT,__cstring,cstring_literals"
1013
@"\01L_OBJC_SELECTOR_REFERENCES_81" = internal global %struct.objc_selector* bitcast ([15 x i8]* @"\01L_OBJC_METH_VAR_NAME_112" to %struct.objc_selector*), section "__OBJC,__message_refs,literal_pointers,no_dead_strip"
1114

1215
define void @bork() nounwind {
16+
; CHECK-LABEL: @bork(
17+
; CHECK-NEXT: entry:
18+
; CHECK-NEXT: [[COLOR:%.*]] = alloca %struct.NSArray*, align 8
19+
; CHECK-NEXT: [[TMP103:%.*]] = load %struct.NSArray*, %struct.NSArray** [[COLOR]], align 8
20+
; CHECK-NEXT: [[TMP103104:%.*]] = getelementptr [[STRUCT_NSARRAY:%.*]], %struct.NSArray* [[TMP103]], i64 0, i32 0
21+
; CHECK-NEXT: [[TMP105:%.*]] = load %struct.objc_selector*, %struct.objc_selector** @"\01L_OBJC_SELECTOR_REFERENCES_81", align 8
22+
; CHECK-NEXT: [[TMP107:%.*]] = call float bitcast (void (%struct.NSObject*, ...)* @objc_msgSend_fpret to float (%struct.NSObject*, %struct.objc_selector*)*)(%struct.NSObject* [[TMP103104]], %struct.objc_selector* [[TMP105]]) #[[ATTR0:[0-9]+]]
23+
; CHECK-NEXT: br label [[EXIT:%.*]]
24+
; CHECK: exit:
25+
; CHECK-NEXT: ret void
26+
;
1327
entry:
14-
%color = alloca %struct.NSArray*
15-
%color.466 = alloca %struct.NSObject*
16-
%tmp103 = load %struct.NSArray*, %struct.NSArray** %color, align 4
17-
%tmp103104 = getelementptr %struct.NSArray, %struct.NSArray* %tmp103, i32 0, i32 0
18-
store %struct.NSObject* %tmp103104, %struct.NSObject** %color.466, align 4
19-
%tmp105 = load %struct.objc_selector*, %struct.objc_selector** @"\01L_OBJC_SELECTOR_REFERENCES_81", align 4
20-
%tmp106 = load %struct.NSObject*, %struct.NSObject** %color.466, align 4
21-
%tmp107 = call float bitcast (void (%struct.NSObject*, ...)* @objc_msgSend_fpret to float (%struct.NSObject*, %struct.objc_selector*)*)( %struct.NSObject* %tmp106, %struct.objc_selector* %tmp105 ) nounwind
22-
br label %exit
28+
%color = alloca %struct.NSArray*
29+
%color.466 = alloca %struct.NSObject*
30+
%tmp103 = load %struct.NSArray*, %struct.NSArray** %color, align 4
31+
%tmp103104 = getelementptr %struct.NSArray, %struct.NSArray* %tmp103, i32 0, i32 0
32+
store %struct.NSObject* %tmp103104, %struct.NSObject** %color.466, align 4
33+
%tmp105 = load %struct.objc_selector*, %struct.objc_selector** @"\01L_OBJC_SELECTOR_REFERENCES_81", align 4
34+
%tmp106 = load %struct.NSObject*, %struct.NSObject** %color.466, align 4
35+
%tmp107 = call float bitcast (void (%struct.NSObject*, ...)* @objc_msgSend_fpret to float (%struct.NSObject*, %struct.objc_selector*)*)( %struct.NSObject* %tmp106, %struct.objc_selector* %tmp105 ) nounwind
36+
br label %exit
2337

2438
exit:
25-
ret void
39+
ret void
2640
}
2741

2842
declare void @objc_msgSend_fpret(%struct.NSObject*, ...)

0 commit comments

Comments
 (0)