https://bugs.llvm.org/show_bug.cgi?id=47811

            Bug ID: 47811
           Summary: LR not correctly saved for inline assembly clobbering
                    LR
           Product: libraries
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: PowerPC
          Assignee: unassignedb...@nondot.org
          Reporter: programmerj...@gmail.com
                CC: llvm-bugs@lists.llvm.org, nemanja.i....@gmail.com

The following IR is miscompiled:
https://gcc.godbolt.org/z/s6c6vT

target triple = "powerpc64le-unknown-linux-gnu"

define void @f() {
  call void asm sideeffect "mtlr 31", "~{lr}"()
  ret void
}

Generated Assembly (trimmed to just f()):
f:                                      # @f
.Lfunc_begin0:
        .cfi_startproc
# %bb.0:
        #APP
        mtlr    31
        #NO_APP
        blr

This causes f to return to whatever address was in r31 instead of to the
caller. I expect LLVM to instead store the return address that was in LR to
another register or to the stack and restore it before returning.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to