2015-06-26 00:26:44 +00:00
|
|
|
; RUN: llc -mcpu=corei7 -no-stack-coloring=false < %s | FileCheck %s --check-prefix=YESCOLOR --check-prefix=CHECK
|
|
|
|
; RUN: llc -mcpu=corei7 -no-stack-coloring=true < %s | FileCheck %s --check-prefix=NOCOLOR --check-prefix=CHECK
|
2012-09-06 09:17:37 +00:00
|
|
|
|
|
|
|
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
|
|
|
target triple = "x86_64-apple-macosx10.8.0"
|
|
|
|
|
2015-06-26 00:26:44 +00:00
|
|
|
;CHECK-LABEL: myCall_w2:
|
2013-10-15 23:33:07 +00:00
|
|
|
;YESCOLOR: subq $144, %rsp
|
|
|
|
;NOCOLOR: subq $272, %rsp
|
2012-09-06 09:17:37 +00:00
|
|
|
|
|
|
|
define i32 @myCall_w2(i32 %in) {
|
|
|
|
entry:
|
|
|
|
%a = alloca [17 x i8*], align 8
|
|
|
|
%a2 = alloca [16 x i8*], align 8
|
|
|
|
%b = bitcast [17 x i8*]* %a to i8*
|
|
|
|
%b2 = bitcast [16 x i8*]* %a2 to i8*
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %b)
|
|
|
|
%t1 = call i32 @foo(i32 %in, i8* %b)
|
|
|
|
%t2 = call i32 @foo(i32 %in, i8* %b)
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %b)
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %b2)
|
|
|
|
%t3 = call i32 @foo(i32 %in, i8* %b2)
|
|
|
|
%t4 = call i32 @foo(i32 %in, i8* %b2)
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %b2)
|
|
|
|
%t5 = add i32 %t1, %t2
|
|
|
|
%t6 = add i32 %t3, %t4
|
|
|
|
%t7 = add i32 %t5, %t6
|
|
|
|
ret i32 %t7
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-26 00:26:44 +00:00
|
|
|
;CHECK-LABEL: myCall2_no_merge
|
2012-09-06 09:17:37 +00:00
|
|
|
;YESCOLOR: subq $272, %rsp
|
|
|
|
;NOCOLOR: subq $272, %rsp
|
|
|
|
|
|
|
|
define i32 @myCall2_no_merge(i32 %in, i1 %d) {
|
|
|
|
entry:
|
|
|
|
%a = alloca [17 x i8*], align 8
|
|
|
|
%a2 = alloca [16 x i8*], align 8
|
|
|
|
%b = bitcast [17 x i8*]* %a to i8*
|
|
|
|
%b2 = bitcast [16 x i8*]* %a2 to i8*
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %b)
|
|
|
|
%t1 = call i32 @foo(i32 %in, i8* %b)
|
|
|
|
%t2 = call i32 @foo(i32 %in, i8* %b)
|
|
|
|
br i1 %d, label %bb2, label %bb3
|
|
|
|
bb2:
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %b2)
|
|
|
|
%t3 = call i32 @foo(i32 %in, i8* %b2)
|
|
|
|
%t4 = call i32 @foo(i32 %in, i8* %b2)
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %b2)
|
|
|
|
%t5 = add i32 %t1, %t2
|
|
|
|
%t6 = add i32 %t3, %t4
|
|
|
|
%t7 = add i32 %t5, %t6
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %b)
|
|
|
|
ret i32 %t7
|
|
|
|
bb3:
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %b)
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
2015-06-26 00:26:44 +00:00
|
|
|
;CHECK-LABEL: myCall2_w2
|
2012-09-06 09:17:37 +00:00
|
|
|
;YESCOLOR: subq $144, %rsp
|
|
|
|
;NOCOLOR: subq $272, %rsp
|
|
|
|
|
|
|
|
define i32 @myCall2_w2(i32 %in, i1 %d) {
|
|
|
|
entry:
|
|
|
|
%a = alloca [17 x i8*], align 8
|
|
|
|
%a2 = alloca [16 x i8*], align 8
|
|
|
|
%b = bitcast [17 x i8*]* %a to i8*
|
|
|
|
%b2 = bitcast [16 x i8*]* %a2 to i8*
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %b)
|
|
|
|
%t1 = call i32 @foo(i32 %in, i8* %b)
|
|
|
|
%t2 = call i32 @foo(i32 %in, i8* %b)
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %b)
|
|
|
|
br i1 %d, label %bb2, label %bb3
|
|
|
|
bb2:
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %b2)
|
|
|
|
%t3 = call i32 @foo(i32 %in, i8* %b2)
|
|
|
|
%t4 = call i32 @foo(i32 %in, i8* %b2)
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %b2)
|
|
|
|
%t5 = add i32 %t1, %t2
|
|
|
|
%t6 = add i32 %t3, %t4
|
|
|
|
%t7 = add i32 %t5, %t6
|
|
|
|
ret i32 %t7
|
|
|
|
bb3:
|
|
|
|
ret i32 0
|
|
|
|
}
|
2015-06-26 00:26:44 +00:00
|
|
|
|
|
|
|
;CHECK-LABEL: myCall_w4:
|
2013-07-25 18:35:14 +00:00
|
|
|
;YESCOLOR: subq $200, %rsp
|
|
|
|
;NOCOLOR: subq $408, %rsp
|
2012-09-06 09:17:37 +00:00
|
|
|
|
|
|
|
define i32 @myCall_w4(i32 %in) {
|
|
|
|
entry:
|
|
|
|
%a1 = alloca [14 x i8*], align 8
|
|
|
|
%a2 = alloca [13 x i8*], align 8
|
|
|
|
%a3 = alloca [12 x i8*], align 8
|
|
|
|
%a4 = alloca [11 x i8*], align 8
|
|
|
|
%b1 = bitcast [14 x i8*]* %a1 to i8*
|
|
|
|
%b2 = bitcast [13 x i8*]* %a2 to i8*
|
|
|
|
%b3 = bitcast [12 x i8*]* %a3 to i8*
|
|
|
|
%b4 = bitcast [11 x i8*]* %a4 to i8*
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %b4)
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %b1)
|
|
|
|
%t1 = call i32 @foo(i32 %in, i8* %b1)
|
|
|
|
%t2 = call i32 @foo(i32 %in, i8* %b1)
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %b1)
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %b2)
|
|
|
|
%t9 = call i32 @foo(i32 %in, i8* %b2)
|
|
|
|
%t8 = call i32 @foo(i32 %in, i8* %b2)
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %b2)
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %b3)
|
|
|
|
%t3 = call i32 @foo(i32 %in, i8* %b3)
|
|
|
|
%t4 = call i32 @foo(i32 %in, i8* %b3)
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %b3)
|
|
|
|
%t11 = call i32 @foo(i32 %in, i8* %b4)
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %b4)
|
|
|
|
%t5 = add i32 %t1, %t2
|
|
|
|
%t6 = add i32 %t3, %t4
|
|
|
|
%t7 = add i32 %t5, %t6
|
|
|
|
ret i32 %t7
|
|
|
|
}
|
|
|
|
|
2015-06-26 00:26:44 +00:00
|
|
|
;CHECK-LABEL: myCall2_w4:
|
2012-09-06 09:17:37 +00:00
|
|
|
;YESCOLOR: subq $112, %rsp
|
|
|
|
;NOCOLOR: subq $400, %rsp
|
|
|
|
|
|
|
|
define i32 @myCall2_w4(i32 %in) {
|
|
|
|
entry:
|
|
|
|
%a1 = alloca [14 x i8*], align 8
|
|
|
|
%a2 = alloca [13 x i8*], align 8
|
|
|
|
%a3 = alloca [12 x i8*], align 8
|
|
|
|
%a4 = alloca [11 x i8*], align 8
|
|
|
|
%b1 = bitcast [14 x i8*]* %a1 to i8*
|
|
|
|
%b2 = bitcast [13 x i8*]* %a2 to i8*
|
|
|
|
%b3 = bitcast [12 x i8*]* %a3 to i8*
|
|
|
|
%b4 = bitcast [11 x i8*]* %a4 to i8*
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %b1)
|
|
|
|
%t1 = call i32 @foo(i32 %in, i8* %b1)
|
|
|
|
%t2 = call i32 @foo(i32 %in, i8* %b1)
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %b1)
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %b2)
|
|
|
|
%t9 = call i32 @foo(i32 %in, i8* %b2)
|
|
|
|
%t8 = call i32 @foo(i32 %in, i8* %b2)
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %b2)
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %b3)
|
|
|
|
%t3 = call i32 @foo(i32 %in, i8* %b3)
|
|
|
|
%t4 = call i32 @foo(i32 %in, i8* %b3)
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %b3)
|
|
|
|
br i1 undef, label %bb2, label %bb3
|
|
|
|
bb2:
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %b4)
|
|
|
|
%t11 = call i32 @foo(i32 %in, i8* %b4)
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %b4)
|
|
|
|
%t5 = add i32 %t1, %t2
|
|
|
|
%t6 = add i32 %t3, %t4
|
|
|
|
%t7 = add i32 %t5, %t6
|
|
|
|
ret i32 %t7
|
|
|
|
bb3:
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-26 00:26:44 +00:00
|
|
|
;CHECK-LABEL: myCall2_noend:
|
2012-09-06 09:17:37 +00:00
|
|
|
;YESCOLOR: subq $144, %rsp
|
|
|
|
;NOCOLOR: subq $272, %rsp
|
|
|
|
|
|
|
|
|
|
|
|
define i32 @myCall2_noend(i32 %in, i1 %d) {
|
|
|
|
entry:
|
|
|
|
%a = alloca [17 x i8*], align 8
|
|
|
|
%a2 = alloca [16 x i8*], align 8
|
|
|
|
%b = bitcast [17 x i8*]* %a to i8*
|
|
|
|
%b2 = bitcast [16 x i8*]* %a2 to i8*
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %b)
|
|
|
|
%t1 = call i32 @foo(i32 %in, i8* %b)
|
|
|
|
%t2 = call i32 @foo(i32 %in, i8* %b)
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %b)
|
|
|
|
br i1 %d, label %bb2, label %bb3
|
|
|
|
bb2:
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %b2)
|
|
|
|
%t3 = call i32 @foo(i32 %in, i8* %b2)
|
|
|
|
%t4 = call i32 @foo(i32 %in, i8* %b2)
|
|
|
|
%t5 = add i32 %t1, %t2
|
|
|
|
%t6 = add i32 %t3, %t4
|
|
|
|
%t7 = add i32 %t5, %t6
|
|
|
|
ret i32 %t7
|
|
|
|
bb3:
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
2015-06-26 00:26:44 +00:00
|
|
|
;CHECK-LABEL: myCall2_noend2:
|
2012-09-06 09:17:37 +00:00
|
|
|
;YESCOLOR: subq $144, %rsp
|
|
|
|
;NOCOLOR: subq $272, %rsp
|
|
|
|
define i32 @myCall2_noend2(i32 %in, i1 %d) {
|
|
|
|
entry:
|
|
|
|
%a = alloca [17 x i8*], align 8
|
|
|
|
%a2 = alloca [16 x i8*], align 8
|
|
|
|
%b = bitcast [17 x i8*]* %a to i8*
|
|
|
|
%b2 = bitcast [16 x i8*]* %a2 to i8*
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %b)
|
|
|
|
%t1 = call i32 @foo(i32 %in, i8* %b)
|
|
|
|
%t2 = call i32 @foo(i32 %in, i8* %b)
|
|
|
|
br i1 %d, label %bb2, label %bb3
|
|
|
|
bb2:
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %b)
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %b2)
|
|
|
|
%t3 = call i32 @foo(i32 %in, i8* %b2)
|
|
|
|
%t4 = call i32 @foo(i32 %in, i8* %b2)
|
|
|
|
%t5 = add i32 %t1, %t2
|
|
|
|
%t6 = add i32 %t3, %t4
|
|
|
|
%t7 = add i32 %t5, %t6
|
|
|
|
ret i32 %t7
|
|
|
|
bb3:
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-26 00:26:44 +00:00
|
|
|
;CHECK-LABEL: myCall2_nostart:
|
2012-09-06 09:17:37 +00:00
|
|
|
;YESCOLOR: subq $144, %rsp
|
|
|
|
;NOCOLOR: subq $272, %rsp
|
|
|
|
define i32 @myCall2_nostart(i32 %in, i1 %d) {
|
|
|
|
entry:
|
|
|
|
%a = alloca [17 x i8*], align 8
|
|
|
|
%a2 = alloca [16 x i8*], align 8
|
|
|
|
%b = bitcast [17 x i8*]* %a to i8*
|
|
|
|
%b2 = bitcast [16 x i8*]* %a2 to i8*
|
|
|
|
%t1 = call i32 @foo(i32 %in, i8* %b)
|
|
|
|
%t2 = call i32 @foo(i32 %in, i8* %b)
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %b)
|
|
|
|
br i1 %d, label %bb2, label %bb3
|
|
|
|
bb2:
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %b2)
|
|
|
|
%t3 = call i32 @foo(i32 %in, i8* %b2)
|
|
|
|
%t4 = call i32 @foo(i32 %in, i8* %b2)
|
|
|
|
%t5 = add i32 %t1, %t2
|
|
|
|
%t6 = add i32 %t3, %t4
|
|
|
|
%t7 = add i32 %t5, %t6
|
|
|
|
ret i32 %t7
|
|
|
|
bb3:
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
|
|
|
; Adopt the test from Transforms/Inline/array_merge.ll'
|
2015-06-26 00:26:44 +00:00
|
|
|
;CHECK-LABEL: array_merge:
|
2012-09-06 09:17:37 +00:00
|
|
|
;YESCOLOR: subq $816, %rsp
|
|
|
|
;NOCOLOR: subq $1616, %rsp
|
|
|
|
define void @array_merge() nounwind ssp {
|
|
|
|
entry:
|
|
|
|
%A.i1 = alloca [100 x i32], align 4
|
|
|
|
%B.i2 = alloca [100 x i32], align 4
|
|
|
|
%A.i = alloca [100 x i32], align 4
|
|
|
|
%B.i = alloca [100 x i32], align 4
|
|
|
|
%0 = bitcast [100 x i32]* %A.i to i8*
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %0) nounwind
|
|
|
|
%1 = bitcast [100 x i32]* %B.i to i8*
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %1) nounwind
|
|
|
|
call void @bar([100 x i32]* %A.i, [100 x i32]* %B.i) nounwind
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %0) nounwind
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %1) nounwind
|
|
|
|
%2 = bitcast [100 x i32]* %A.i1 to i8*
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %2) nounwind
|
|
|
|
%3 = bitcast [100 x i32]* %B.i2 to i8*
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %3) nounwind
|
|
|
|
call void @bar([100 x i32]* %A.i1, [100 x i32]* %B.i2) nounwind
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %2) nounwind
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %3) nounwind
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2015-06-26 00:26:44 +00:00
|
|
|
;CHECK-LABEL: func_phi_lifetime:
|
2012-09-10 08:43:23 +00:00
|
|
|
;YESCOLOR: subq $272, %rsp
|
|
|
|
;NOCOLOR: subq $272, %rsp
|
|
|
|
define i32 @func_phi_lifetime(i32 %in, i1 %d) {
|
|
|
|
entry:
|
|
|
|
%a = alloca [17 x i8*], align 8
|
|
|
|
%a2 = alloca [16 x i8*], align 8
|
|
|
|
%b = bitcast [17 x i8*]* %a to i8*
|
|
|
|
%b2 = bitcast [16 x i8*]* %a2 to i8*
|
|
|
|
%t1 = call i32 @foo(i32 %in, i8* %b)
|
|
|
|
%t2 = call i32 @foo(i32 %in, i8* %b)
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %b)
|
|
|
|
br i1 %d, label %bb0, label %bb1
|
|
|
|
|
|
|
|
bb0:
|
|
|
|
%I1 = bitcast [17 x i8*]* %a to i8*
|
|
|
|
br label %bb2
|
|
|
|
|
|
|
|
bb1:
|
|
|
|
%I2 = bitcast [16 x i8*]* %a2 to i8*
|
|
|
|
br label %bb2
|
|
|
|
|
|
|
|
bb2:
|
|
|
|
%split = phi i8* [ %I1, %bb0 ], [ %I2, %bb1 ]
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %split)
|
|
|
|
%t3 = call i32 @foo(i32 %in, i8* %b2)
|
|
|
|
%t4 = call i32 @foo(i32 %in, i8* %b2)
|
|
|
|
%t5 = add i32 %t1, %t2
|
|
|
|
%t6 = add i32 %t3, %t4
|
|
|
|
%t7 = add i32 %t5, %t6
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %split)
|
|
|
|
ret i32 %t7
|
|
|
|
bb3:
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
2012-09-10 12:39:35 +00:00
|
|
|
|
2015-06-26 00:26:44 +00:00
|
|
|
;CHECK-LABEL: multi_region_bb:
|
2012-09-10 12:39:35 +00:00
|
|
|
define void @multi_region_bb() nounwind ssp {
|
|
|
|
entry:
|
|
|
|
%A.i1 = alloca [100 x i32], align 4
|
|
|
|
%B.i2 = alloca [100 x i32], align 4
|
|
|
|
%A.i = alloca [100 x i32], align 4
|
|
|
|
%B.i = alloca [100 x i32], align 4
|
|
|
|
%0 = bitcast [100 x i32]* %A.i to i8*
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %0) nounwind ; <---- start #1
|
|
|
|
%1 = bitcast [100 x i32]* %B.i to i8*
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %1) nounwind
|
|
|
|
call void @bar([100 x i32]* %A.i, [100 x i32]* %B.i) nounwind
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %0) nounwind
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %1) nounwind
|
|
|
|
%2 = bitcast [100 x i32]* %A.i1 to i8*
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %2) nounwind
|
|
|
|
%3 = bitcast [100 x i32]* %B.i2 to i8*
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %3) nounwind
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %0) nounwind ; <---- start #2
|
|
|
|
call void @bar([100 x i32]* %A.i1, [100 x i32]* %B.i2) nounwind
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %2) nounwind
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %0) nounwind
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %3) nounwind
|
|
|
|
ret void
|
|
|
|
}
|
2012-09-10 18:51:09 +00:00
|
|
|
;YESCOLOR: subq $272, %rsp
|
|
|
|
;NOCOLOR: subq $272, %rsp
|
2015-06-26 00:26:44 +00:00
|
|
|
|
2012-09-10 18:51:09 +00:00
|
|
|
define i32 @myCall_end_before_begin(i32 %in, i1 %d) {
|
|
|
|
entry:
|
|
|
|
%a = alloca [17 x i8*], align 8
|
|
|
|
%a2 = alloca [16 x i8*], align 8
|
|
|
|
%b = bitcast [17 x i8*]* %a to i8*
|
|
|
|
%b2 = bitcast [16 x i8*]* %a2 to i8*
|
|
|
|
%t1 = call i32 @foo(i32 %in, i8* %b)
|
|
|
|
%t2 = call i32 @foo(i32 %in, i8* %b)
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %b)
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %b)
|
|
|
|
br i1 %d, label %bb2, label %bb3
|
|
|
|
bb2:
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %b2)
|
|
|
|
%t3 = call i32 @foo(i32 %in, i8* %b2)
|
|
|
|
%t4 = call i32 @foo(i32 %in, i8* %b2)
|
|
|
|
%t5 = add i32 %t1, %t2
|
|
|
|
%t6 = add i32 %t3, %t4
|
|
|
|
%t7 = add i32 %t5, %t6
|
|
|
|
ret i32 %t7
|
|
|
|
bb3:
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
2013-05-15 21:15:09 +00:00
|
|
|
|
|
|
|
; Regression test for PR15707. %buf1 and %buf2 should not be merged
|
|
|
|
; in this test case.
|
2015-06-26 00:26:44 +00:00
|
|
|
;CHECK-LABEL: myCall_pr15707:
|
2013-05-15 21:15:09 +00:00
|
|
|
;YESCOLOR: subq $200008, %rsp
|
|
|
|
;NOCOLOR: subq $200008, %rsp
|
|
|
|
define void @myCall_pr15707() {
|
|
|
|
%buf1 = alloca i8, i32 100000, align 16
|
|
|
|
%buf2 = alloca i8, i32 100000, align 16
|
|
|
|
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %buf1)
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %buf1)
|
|
|
|
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %buf1)
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %buf2)
|
|
|
|
%result1 = call i32 @foo(i32 0, i8* %buf1)
|
|
|
|
%result2 = call i32 @foo(i32 0, i8* %buf2)
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-09-12 04:57:37 +00:00
|
|
|
; Check that we don't assert and crash even when there are allocas
|
|
|
|
; outside the declared lifetime regions.
|
2015-06-26 00:26:44 +00:00
|
|
|
;CHECK-LABEL: bad_range:
|
2012-09-12 04:57:37 +00:00
|
|
|
define void @bad_range() nounwind ssp {
|
|
|
|
entry:
|
|
|
|
%A.i1 = alloca [100 x i32], align 4
|
|
|
|
%B.i2 = alloca [100 x i32], align 4
|
|
|
|
%A.i = alloca [100 x i32], align 4
|
|
|
|
%B.i = alloca [100 x i32], align 4
|
|
|
|
%0 = bitcast [100 x i32]* %A.i to i8*
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %0) nounwind
|
|
|
|
%1 = bitcast [100 x i32]* %B.i to i8*
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %1) nounwind
|
|
|
|
call void @bar([100 x i32]* %A.i, [100 x i32]* %B.i) nounwind
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %0) nounwind
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %1) nounwind
|
|
|
|
br label %block2
|
|
|
|
|
|
|
|
block2:
|
|
|
|
; I am used outside the marked lifetime.
|
|
|
|
call void @bar([100 x i32]* %A.i, [100 x i32]* %B.i) nounwind
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-09-13 12:38:37 +00:00
|
|
|
; Check that we don't assert and crash even when there are usages
|
|
|
|
; of allocas which do not read or write outside the declared lifetime regions.
|
2015-06-26 00:26:44 +00:00
|
|
|
;CHECK-LABEL: shady_range:
|
2012-09-13 12:38:37 +00:00
|
|
|
|
|
|
|
%struct.Klass = type { i32, i32 }
|
|
|
|
|
|
|
|
define i32 @shady_range(i32 %argc, i8** nocapture %argv) uwtable {
|
|
|
|
%a.i = alloca [4 x %struct.Klass], align 16
|
|
|
|
%b.i = alloca [4 x %struct.Klass], align 16
|
|
|
|
%a8 = bitcast [4 x %struct.Klass]* %a.i to i8*
|
|
|
|
%b8 = bitcast [4 x %struct.Klass]* %b.i to i8*
|
|
|
|
; I am used outside the lifetime zone below:
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230786 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-27 19:29:02 +00:00
|
|
|
%z2 = getelementptr inbounds [4 x %struct.Klass], [4 x %struct.Klass]* %a.i, i64 0, i64 0, i32 0
|
2012-09-13 12:38:37 +00:00
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %a8)
|
|
|
|
call void @llvm.lifetime.start(i64 -1, i8* %b8)
|
2015-02-27 21:17:42 +00:00
|
|
|
%z3 = load i32, i32* %z2, align 16
|
2012-09-13 12:38:37 +00:00
|
|
|
%r = call i32 @foo(i32 %z3, i8* %a8)
|
|
|
|
%r2 = call i32 @foo(i32 %z3, i8* %b8)
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %a8)
|
|
|
|
call void @llvm.lifetime.end(i64 -1, i8* %b8)
|
|
|
|
ret i32 9
|
|
|
|
}
|
|
|
|
|
2012-09-06 09:17:37 +00:00
|
|
|
declare void @bar([100 x i32]* , [100 x i32]*) nounwind
|
|
|
|
|
|
|
|
declare void @llvm.lifetime.start(i64, i8* nocapture) nounwind
|
|
|
|
|
|
|
|
declare void @llvm.lifetime.end(i64, i8* nocapture) nounwind
|
|
|
|
|
2012-09-12 04:57:37 +00:00
|
|
|
declare i32 @foo(i32, i8*)
|