diff options
| author | Marcin Koscielnicki <koriakin@0x04.net> | 2016-04-28 21:24:37 +0000 |
|---|---|---|
| committer | Marcin Koscielnicki <koriakin@0x04.net> | 2016-04-28 21:24:37 +0000 |
| commit | 7b32957852475e460a9434ee903989bd4291aeaa (patch) | |
| tree | 384c3e6101d1321cdb5135d514173eec09df7e92 /llvm/test | |
| parent | de8d3753d30534d1c0df2591bc306981b50ec246 (diff) | |
| download | bcm5719-llvm-7b32957852475e460a9434ee903989bd4291aeaa.tar.gz bcm5719-llvm-7b32957852475e460a9434ee903989bd4291aeaa.zip | |
[PowerPC] Fix the EH_SjLj_Setup pseudo.
This instruction is just a control flow marker - it should not
actually exist in the object file. Unfortunately, nothing catches
it before it gets to AsmPrinter. If integrated assembler is used,
it's considered to be a normal 4-byte instruction, and emitted as
an all-0 word, crashing the program. With external assembler,
a comment is emitted.
Fixed by setting Size to 0 and handling it in MCCodeEmitter - this
means the comment will still be emitted if integrated assembler
is not used.
This broke an ASan test, which has been disabled for a long time
as a result (see the discussion on D19657). We can reenable it
once this lands.
llvm-svn: 267943
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/CodeGen/PowerPC/2016-04-28-setjmp.ll | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/PowerPC/2016-04-28-setjmp.ll b/llvm/test/CodeGen/PowerPC/2016-04-28-setjmp.ll new file mode 100644 index 00000000000..09c0fa7ba97 --- /dev/null +++ b/llvm/test/CodeGen/PowerPC/2016-04-28-setjmp.ll @@ -0,0 +1,48 @@ +; RUN: llc -filetype=obj <%s | llvm-objdump --disassemble - | FileCheck %s +target datalayout = "e-m:e-i64:64-n32:64" +target triple = "powerpc64le-unknown-linux-gnu" + +@ptr = common global i8* null, align 8 + +; Verify there's no junk between these two instructions from misemitted +; EH_SjLj_Setup. + +; CHECK: li 3, 1 +; CHECK-NEXT: b .+4 + +define void @h() nounwind { + %1 = load i8**, i8*** bitcast (i8** @ptr to i8***), align 8 + %2 = tail call i8* @llvm.frameaddress(i32 0) + store i8* %2, i8** %1, align 8 + %3 = tail call i8* @llvm.stacksave() + %4 = getelementptr inbounds i8*, i8** %1, i64 2 + store i8* %3, i8** %4, align 8 + %5 = bitcast i8** %1 to i8* + %6 = tail call i32 @llvm.eh.sjlj.setjmp(i8* %5) + %7 = icmp eq i32 %6, 0 + br i1 %7, label %9, label %8 + +; <label>:8: ; preds = %0 + tail call void @g() + br label %10 + +; <label>:9: ; preds = %0 + tail call void @f() + br label %10 + +; <label>:10: ; preds = %9, %8 + ret void +} + +; Function Attrs: nounwind readnone +declare i8* @llvm.frameaddress(i32) + +; Function Attrs: nounwind +declare i8* @llvm.stacksave() + +; Function Attrs: nounwind +declare i32 @llvm.eh.sjlj.setjmp(i8*) + +declare void @g() + +declare void @f() |

