[llvm-bugs] [Bug 45327] New: Segfault during armv7 code generation for a PHINode referencing a call to llvm.frameaddress
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Mar 27 04:29:34 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=45327
Bug ID: 45327
Summary: Segfault during armv7 code generation for a PHINode
referencing a call to llvm.frameaddress
Product: libraries
Version: 10.0
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Common Code Generator Code
Assignee: unassignedbugs at nondot.org
Reporter: andrey.vihrov at gmail.com
CC: llvm-bugs at lists.llvm.org
Consider the following LLVM IR (z.ll):
---------------------------------------------
define void @foo(i1, i8*) #0 {
E:
br i1 %0, label %A, label %X
A:
%a = call i8* @llvm.frameaddress(i32 0)
br label %X
X:
%p = phi i8* [ %a, %A ], [ %1, %E ]
call void @bar(i8* %p)
ret void
}
declare i8* @llvm.frameaddress(i32 immarg)
declare void @bar(i8*)
attributes #0 = { noinline optnone }
---------------------------------------------
Running
$ llc -mtriple=armv7-apple-ios z.ll
results in:
Stack dump:
0. Program arguments: llvm-10.0.0/bin/llc -mtriple=armv7-apple-ios z.ll
1. Running pass 'Function Pass Manager' on module 'z.ll'.
2. Running pass 'Live Variable Analysis' on function '@foo'
#0 0x00007f06df2052da llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/tmp/llvm-10.0.0/bin/../lib/libLLVM-10.so+0x8532da)
#1 0x00007f06df202f74 llvm::sys::RunSignalHandlers()
(/tmp/llvm-10.0.0/bin/../lib/libLLVM-10.so+0x850f74)
#2 0x00007f06df2030b8 SignalHandler(int)
(/tmp/llvm-10.0.0/bin/../lib/libLLVM-10.so+0x8510b8)
#3 0x00007f06de97a800 __restore_rt (/usr/lib/libpthread.so.0+0x14800)
#4 0x00007f06df549ef0
llvm::LiveVariables::runOnBlock(llvm::MachineBasicBlock*, unsigned int)
(/tmp/llvm-10.0.0/bin/../lib/libLLVM-10.so+0xb97ef0)
#5 0x00007f06df54d311
llvm::LiveVariables::runOnMachineFunction(llvm::MachineFunction&)
(/tmp/llvm-10.0.0/bin/../lib/libLLVM-10.so+0xb9b311)
#6 0x00007f06df5c7461
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/tmp/llvm-10.0.0/bin/../lib/libLLVM-10.so+0xc15461)
#7 0x00007f06df3554fa llvm::FPPassManager::runOnFunction(llvm::Function&)
(/tmp/llvm-10.0.0/bin/../lib/libLLVM-10.so+0x9a34fa)
#8 0x00007f06df355ba1 llvm::FPPassManager::runOnModule(llvm::Module&)
(/tmp/llvm-10.0.0/bin/../lib/libLLVM-10.so+0x9a3ba1)
#9 0x00007f06df355f39 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/tmp/llvm-10.0.0/bin/../lib/libLLVM-10.so+0x9a3f39)
#10 0x0000559e85629309 main (llvm-10.0.0/bin/llc+0x12309)
#11 0x00007f06de47e023 __libc_start_main (/usr/lib/libc.so.6+0x27023)
#12 0x0000559e8562a3ae _start (llvm-10.0.0/bin/llc+0x133ae)
Segmentation fault (core dumped)
Compiling with "-mtriple=thumbv7-apple-ios" produces the same result. At the
same time compilation succeeds with "-mtriple=aarch64-apple-ios",
"-mtriple=i386-apple-darwin" and "-mtriple=x86_64-apple-darwin". The crash is
also reproducible with "-mtriple=armv7-linux-androideabi", but not reproducible
with "-mtriple=armv7-none-eabi".
If the `llvm.frameaddress` is replaced by a different function, either regular
or another intrinsic like `llvm.returnaddress`, the error disappears. If the
`optnone` attribute is removed from the function `foo`, the error disappears.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200327/51846e01/attachment.html>
More information about the llvm-bugs
mailing list