[llvm-dev] byval argument causes llvm to crash after inlining

Pan, Wei via llvm-dev llvm-dev at lists.llvm.org
Tue Sep 25 13:36:23 PDT 2018


Hello,

With the following reduced test case, cmd "opt -always-inline t.ll" crashes after inlining. Notice that byval argument %a will be remapped to %1 below, and consequently produces an illegal store.

%1 = alloca i32, align 4
store i32 * %1, i32 addrspace(1)** %a.addr, align 8

Looks like Inliner assumes that byval arguments are from address space 0. Or this is just a bug in inliner?

Thanks,
Wei

t.ll:

define i32 @foo(i32 addrspace(1)* %x) {
entry:
  %y = call i32 @bar(i32 addrspace(1)* %x)
  ret i32 %y
}

define internal i32 @bar(i32 addrspace(1)* byval %a) alwaysinline {
  %a.addr = alloca i32 addrspace(1)*, align 8
  store i32 addrspace(1)* %a, i32 addrspace(1)** %a.addr, align 8
  %a1 = load i32 addrspace(1)*  , i32 addrspace(1)** %a.addr, align 8
  %b = load i32, i32 addrspace(1)* %a1, align 4
  ret i32 %b
}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180925/e8b368ee/attachment.html>


More information about the llvm-dev mailing list