[llvm] r370753 - [SystemZ] Recognize INLINEASM_BR in backend.

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 02:53:03 PDT 2019


Merged to release_90 in r371043.

On Tue, Sep 3, 2019 at 3:29 PM Jonas Paulsson via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
>
> Author: jonpa
> Date: Tue Sep  3 06:31:22 2019
> New Revision: 370753
>
> URL: http://llvm.org/viewvc/llvm-project?rev=370753&view=rev
> Log:
> [SystemZ]  Recognize INLINEASM_BR in backend.
>
> SystemZInstrInfo::analyzeBranch() needs to check for INLINEASM_BR
> instructions, or it will crash.
>
> Review: Ulrich Weigand
>
> Added:
>     llvm/trunk/test/CodeGen/SystemZ/asm-20.ll
> Modified:
>     llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.cpp
>
> Modified: llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.cpp?rev=370753&r1=370752&r2=370753&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.cpp (original)
> +++ llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.cpp Tue Sep  3 06:31:22 2019
> @@ -462,8 +462,8 @@ bool SystemZInstrInfo::analyzeBranch(Mac
>        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.
>
> Added: llvm/trunk/test/CodeGen/SystemZ/asm-20.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/asm-20.ll?rev=370753&view=auto
> ==============================================================================
> --- llvm/trunk/test/CodeGen/SystemZ/asm-20.ll (added)
> +++ llvm/trunk/test/CodeGen/SystemZ/asm-20.ll Tue Sep  3 06:31:22 2019
> @@ -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
> +}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list