LR not correctly saved for inline assembly clobbering LR #47155
Labels
backend:PowerPC
bugzilla
Issues migrated from bugzilla
confirmed
Verified by a second party
miscompilation
Extended Description
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:
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.
The text was updated successfully, but these errors were encountered: