diff options
author | Hans Wennborg <hans@hanshq.net> | 2019-09-05 09:54:36 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2019-09-05 09:54:36 +0000 |
commit | 5a661d61f333976d79b6455d7cb27a216166ee67 (patch) | |
tree | 17104b3ed2dfb4ed724bdc24ffc95716ce3fc7a6 | |
parent | 1b8425cf6f834c14645231d3c2f58fc441f2b524 (diff) | |
download | llvm-5a661d61f333976d79b6455d7cb27a216166ee67.tar.gz |
Merging r370753:
------------------------------------------------------------------------
r370753 | jonpa | 2019-09-03 15:31:22 +0200 (Tue, 03 Sep 2019) | 6 lines
[SystemZ] Recognize INLINEASM_BR in backend.
SystemZInstrInfo::analyzeBranch() needs to check for INLINEASM_BR
instructions, or it will crash.
Review: Ulrich Weigand
------------------------------------------------------------------------
llvm-svn: 371043
-rw-r--r-- | llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp | 4 | ||||
-rw-r--r-- | llvm/test/CodeGen/SystemZ/asm-20.ll | 15 |
2 files changed, 17 insertions, 2 deletions
diff --git a/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp b/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp index 57c1cf4ec70a..5f7576894e54 100644 --- a/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp +++ b/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp @@ -462,8 +462,8 @@ bool SystemZInstrInfo::analyzeBranch(MachineBasicBlock &MBB, break; // A terminator that isn't a branch can't easily be handled by this - // analysis. - if (!I->isBranch()) + // analysis. Asm goto is not understood / optimized. + if (!I->isBranch() || I->getOpcode() == SystemZ::INLINEASM_BR) return true; // Can't handle indirect branches. diff --git a/llvm/test/CodeGen/SystemZ/asm-20.ll b/llvm/test/CodeGen/SystemZ/asm-20.ll new file mode 100644 index 000000000000..402c038f022e --- /dev/null +++ b/llvm/test/CodeGen/SystemZ/asm-20.ll @@ -0,0 +1,15 @@ +; Test that asm goto can be compiled. +; +; RUN: llc < %s -mtriple=s390x-linux-gnu + +define i32 @c() { +entry: + callbr void asm sideeffect "", "X"(i8* blockaddress(@c, %d)) + to label %asm.fallthrough [label %d] + +asm.fallthrough: ; preds = %entry + br label %d + +d: ; preds = %asm.fallthrough, %entry + ret i32 undef +} |