LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 1495 - LSR can produce invalid SSA when value reuse occurs
Summary: LSR can produce invalid SSA when value reuse occurs
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Scalar Optimizations (show other bugs)
Version: 1.9
Hardware: PC Linux
: P normal
Assignee: Chris Lattner
URL:
Keywords: compile-fail
Depends on:
Blocks:
 
Reported: 2007-06-04 15:40 PDT by Lauro Venancio
Modified: 2010-02-22 12:41 PST (History)
1 user (show)

See Also:
Fixed By Commit(s):


Attachments
bugpoint-reduced-simplified.bc (1.30 KB, application/octet-stream)
2007-06-04 15:41 PDT, Lauro Venancio
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lauro Venancio 2007-06-04 15:40:50 PDT
laurov@laurov-desktop:~/ffmpeg/libavcodec$ llc bugpoint-reduced-simplified.bc 
llc: /home/laurov/llvm/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:732:
llvm::SDOperand llvm::SelectionDAGLowering::getValue(const llvm::Value*):
Assertion `InReg && "Value not in map!"' failed.
llc((anonymous namespace)::PrintStackTrace()+0x1a)[0x8951f92]
llc((anonymous namespace)::SignalHandler(int)+0x112)[0x8952258]
[0xffffe420]
/lib/tls/i686/cmov/libc.so.6(abort+0x101)[0xb7ca6641]
/lib/tls/i686/cmov/libc.so.6(__assert_fail+0xfb)[0xb7c9e43b]
llc(llvm::SelectionDAGLowering::getValue(llvm::Value const*)+0xb8d)[0x86cd9d3]
llc(llvm::SelectionDAGLowering::visitScalarBinary(llvm::User&, unsigned
int)+0x31)[0x86d8cff]
llc(llvm::SelectionDAGLowering::visitAdd(llvm::User&)+0x8c)[0x86f7912]
llc(llvm::SelectionDAGLowering::visit(unsigned int, llvm::User&)+0xda)[0x86f7bde]
llc(llvm::SelectionDAGLowering::visit(llvm::Instruction&)+0x28)[0x86f7fd4]
llc(llvm::SelectionDAGISel::BuildSelectionDAG(llvm::SelectionDAG&,
llvm::BasicBlock*, std::vector<std::pair<llvm::MachineInstr*, unsigned int>,
std::allocator<std::pair<llvm::MachineInstr*, unsigned int> > >&,
llvm::FunctionLoweringInfo&)+0x14a)[0x86dd654]
llc(llvm::SelectionDAGISel::SelectBasicBlock(llvm::BasicBlock*,
llvm::MachineFunction&, llvm::FunctionLoweringInfo&)+0xa0)[0x86de0f4]
llc(llvm::SelectionDAGISel::runOnFunction(llvm::Function&)+0x11f)[0x86dfd2f]
llc[0x859eba3]
llc(llvm::FPPassManager::runOnFunction(llvm::Function&)+0x13a)[0x88ecae8]
llc(llvm::FunctionPassManagerImpl::run(llvm::Function&)+0x6e)[0x88ecd6c]
llc(llvm::FunctionPassManager::run(llvm::Function&)+0x88)[0x88eceba]
llc(main+0x97d)[0x842831d]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xdc)[0xb7c90ebc]
llc[0x8426a71]
Aborted (core dumped)
Comment 1 Lauro Venancio 2007-06-04 15:41:23 PDT
Created attachment 999 [details]
bugpoint-reduced-simplified.bc
Comment 2 Chris Lattner 2007-06-04 19:55:35 PDT
This looks like a bug in lsr or something: it is producing:

	%tmp.11 = add i32 %tmp.9, 8		; <i32> [#uses=1]
	%tmp.9 = mul i32 %iv.5, 8		; <i32> [#uses=2]

which isn't valid (use before def)
Comment 3 Chris Lattner 2007-06-04 20:20:40 PDT
This is due to LSR.cpp:562 inserting a mul which is reused, then LSR.cpp:565 inserting an add into the 
wrong place.
Comment 4 Chris Lattner 2007-06-05 20:24:41 PDT
Fixed.  Patch here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070604/050261.html

Testcase here: CodeGen/X86/2007-06-05-LSR-Dominator.ll

-Chris