http://llvm.org/bugs/show_bug.cgi?id=3842
Summary: PrologEpilogInserter::replaceFrameIndices reads past
first instruction in basic block when FrameSetupOpode is
first instruction in basic block
Product: libraries
Version: 2.5
Platform: PC
OS/Version: All
Status: NEW
Severity: major
Priority: P2
Component: Common Code Generator Code
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
If the first instruction in a given basic block is either the FrameSetupOpcode
or the FrameDestroyOpcode, the replaceFrameIndices method of the PEI class
fails. This only occurs on x86/ARM/... when reservedCallFrames are not
available.
Before the call to TRI.eliminateFramePseudoInstr, the method attempts to store
a reference to the current point in the instruction stream by getting the
previous instruction. If there are no instructions prior the Frame*Opcode, this
crashes with an assertion in llvm::ilist_iterator:
llc: .../llvm/include/llvm/ADT/ilist.h:173: llvm::ilist_iterator<NodeTy>&
llvm::ilist_iterator<NodeTy>::operator--() [with NodeTy = llvm::MachineInstr]:
Assertion `Traits::getNext(NodePtr) && "--'d off the beginning of an ilist!"'
failed.
0 llc 0x00000000010ec0ef
1 llc 0x00000000010ec41d
2 libc.so.6 0x0000000000032270
3 libc.so.6 0x00000000000321e5 gsignal + 53
4 libc.so.6 0x0000000000033703 abort + 387
5 libc.so.6 0x000000000002b229 __assert_fail + 233
6 llc 0x00000000004c2baf
llvm::ilist_iterator<llvm::MachineInstr>::operator--() + 127
7 llc 0x00000000004c5cfb llvm::ilist_iterator<llvm::MachineInstr>
llvm::prior<llvm::ilist_iterator<llvm::MachineInstr>
>(llvm::ilist_iterator<llvm::MachineInstr>) + 27
8 llc 0x0000000000d8e9b6
9 llc 0x0000000000d8d522
10 llc 0x00000000004b22a1
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 65
11 llc 0x0000000001038aaa
llvm::FPPassManager::runOnFunction(llvm::Function&) + 346
12 llc 0x0000000001039224
llvm::FunctionPassManagerImpl::run(llvm::Function&) + 164
13 llc 0x000000000103935e
llvm::FunctionPassManager::run(llvm::Function&) + 190
14 llc 0x0000000000412c20 main + 3808
15 libc.so.6 0x000000000001e5c6 __libc_start_main + 230
16 llc 0x0000000000410559 atan + 241
The following test case illustrates this issue:
[code]
#include <stdio.h>
void test(char* const m) { printf(m); }
int main()
{
while(1)
test("test");
}
[/code]
To induce this failure with the x86 backend, modify
X86RegisterInfo::hasReservedCallFrame to always return false.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs