diff options
author | Hal Finkel <hfinkel@anl.gov> | 2013-07-17 05:35:44 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2013-07-17 05:35:44 +0000 |
commit | 8d7435e9b1319c6e748a06c0b41a4c3de82ec750 (patch) | |
tree | 02f3b4e3f736f64d2ce801d86d09997d8c7ee951 /test | |
parent | 09df10df0d6f327049a7f315f175ab77044e6aaa (diff) | |
download | external_llvm-8d7435e9b1319c6e748a06c0b41a4c3de82ec750.zip external_llvm-8d7435e9b1319c6e748a06c0b41a4c3de82ec750.tar.gz external_llvm-8d7435e9b1319c6e748a06c0b41a4c3de82ec750.tar.bz2 |
PPC: Add CTR-register clobber to builtin setjmp
Because the builtin longjmp implementation uses a CTR-based indirect jump, when
the control flow arrives at the builtin setjmp call, the CTR register has
necessarily been clobbered. Correspondingly, this adds CTR to the list of
implicit definitions of the builtin setjmp pseudo instruction.
We don't need to add CTR to the implicit definitions of builtin longjmp
because, even though it does clobber the CTR register, the control flow cannot
return to inside the loop unless there is also a builtin setjmp call.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186488 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/CodeGen/PowerPC/sj-ctr-loop.ll | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/test/CodeGen/PowerPC/sj-ctr-loop.ll b/test/CodeGen/PowerPC/sj-ctr-loop.ll new file mode 100644 index 0000000..1866bcd --- /dev/null +++ b/test/CodeGen/PowerPC/sj-ctr-loop.ll @@ -0,0 +1,50 @@ +; RUN: llc -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s +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-f128:128:128-v128:128:128-n32:64" +target triple = "powerpc64-unknown-linux-gnu" + +%struct.__jmp_buf_tag.1.15.17.21.25.49.53.55 = type { [64 x i64], i32, %struct.__sigset_t.0.14.16.20.24.48.52.54, [8 x i8] } +%struct.__sigset_t.0.14.16.20.24.48.52.54 = type { [16 x i64] } + +@env_sigill = external global [1 x %struct.__jmp_buf_tag.1.15.17.21.25.49.53.55], align 16 + +; CHECK-LABEL: @main +; CHECK-NOT: mtctr + +; Function Attrs: nounwind +define void @main() #0 { +entry: + br i1 undef, label %return, label %if.end + +if.end: ; preds = %entry + br i1 undef, label %for.body.lr.ph, label %for.end.thread + +for.end.thread: ; preds = %if.end + br label %return + +for.body.lr.ph: ; preds = %if.end + br label %for.body + +for.cond: ; preds = %for.body + %cmp2 = icmp slt i32 %inc, undef + br i1 %cmp2, label %for.body, label %for.end + +for.body: ; preds = %for.cond, %for.body.lr.ph + %i.032 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.cond ] + %0 = call i32 @llvm.eh.sjlj.setjmp(i8* bitcast ([1 x %struct.__jmp_buf_tag.1.15.17.21.25.49.53.55]* @env_sigill to i8*)) + %inc = add nsw i32 %i.032, 1 + br i1 false, label %if.else, label %for.cond + +if.else: ; preds = %for.body + unreachable + +for.end: ; preds = %for.cond + unreachable + +return: ; preds = %for.end.thread, %entry + ret void +} + +; Function Attrs: nounwind +declare i32 @llvm.eh.sjlj.setjmp(i8*) #0 + +attributes #0 = { nounwind } |