[llvm-bugs] [Bug 30402] New: InstCombine: Calls RAUW on GEPi replacing value with itself
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Sep 15 12:08:14 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=30402
Bug ID: 30402
Summary: InstCombine: Calls RAUW on GEPi replacing value with
itself
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Transformation Utilities
Assignee: unassignedbugs at nondot.org
Reporter: simonas+llvm.org at kazlauskas.me
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Created attachment 17270
--> https://llvm.org/bugs/attachment.cgi?id=17270&action=edit
The IR which causes abort in instcombine with opt -O3
Attached IR causes `opt -O3`/`opt -O2` assert with
opt: ../lib/IR/Value.cpp:373: void llvm::Value::replaceAllUsesWith(llvm::Value
*): Assertion `!contains(New, this) && "this->replaceAllUsesWith(expr(this)) is
NOT valid!"' failed.
This IR has been minimised IR rustc output and works just fine with LLVM 3.8
(both opt and through rustc), but fails with LLVM 3.9 or trunk (both opt and
rustc).
A short debugger session quickly shows the cause:
(gdb) bt
#0 0x00007ffff4d7304f in raise () from /usr/lib/libc.so.6
#1 0x00007ffff4d7447a in abort () from /usr/lib/libc.so.6
#2 0x00007ffff4d6bea7 in __assert_fail_base () from /usr/lib/libc.so.6
#3 0x00007ffff4d6bf52 in __assert_fail () from /usr/lib/libc.so.6
#4 0x00007ffff60ee54e in llvm::Value::replaceAllUsesWith (this=0x6851a0,
New=0x6851a0) at ../lib/IR/Value.cpp:372
#5 0x00007ffff681818b in rewriteGEPAsOffset (Start=<optimized out>,
Base=<optimized out>, DL=..., Explored=...) at
../lib/Transforms/InstCombine/InstCombineCompares.cpp:839
#6 transformToIndexedCompare (GEPLHS=<optimized out>, RHS=<optimized out>,
Cond=<optimized out>, DL=...) at
../lib/Transforms/InstCombine/InstCombineCompares.cpp:911
#7 0x00007ffff682bcc0 in llvm::InstCombiner::visitICmpInst (this=<optimized
out>, I=...) at ../lib/Transforms/InstCombine/InstCombineCompares.cpp:3732
#8 0x00007ffff67ca6db in llvm::InstCombiner::run (this=<optimized out>) at
../lib/Transforms/InstCombine/InstructionCombining.cpp:2912
#9 0x00007ffff67cc001 in combineInstructionsOverFunction (F=..., Worklist=...,
AA=<optimized out>, AC=..., TLI=..., DT=..., ExpensiveCombines=<optimized out>,
LI=<optimized out>)
at ../lib/Transforms/InstCombine/InstructionCombining.cpp:3141
#10 0x00007ffff67cc5ea in llvm::InstructionCombiningPass::runOnFunction
(this=<optimized out>, F=...) at
../lib/Transforms/InstCombine/InstructionCombining.cpp:3197
#11 0x00007ffff60b3d14 in llvm::FPPassManager::runOnFunction (this=<optimized
out>, F=...) at ../lib/IR/LegacyPassManager.cpp:1526
#12 0x00007ffff60b3f5b in llvm::FPPassManager::runOnModule (this=<optimized
out>, M=...) at ../lib/IR/LegacyPassManager.cpp:1547
#13 0x00007ffff60b434a in (anonymous namespace)::MPPassManager::runOnModule
(this=<optimized out>, M=...) at ../lib/IR/LegacyPassManager.cpp:1603
#14 llvm::legacy::PassManagerImpl::run (this=<optimized out>, M=...) at
../lib/IR/LegacyPassManager.cpp:1706
#15 0x0000000000422f2a in main (argc=<optimized out>, argv=<optimized out>) at
../tools/opt/opt.cpp:679
(gdb) frame 4
#4 0x00007ffff60ee54e in llvm::Value::replaceAllUsesWith (this=0x6851a0,
New=0x6851a0) at ../lib/IR/Value.cpp:372
372 assert(!contains(New, this) &&
(gdb) call this->dump()
i64* getelementptr inbounds (i64, i64* @ref8151, i64 1)
(gdb) call New->dump()
i64* getelementptr inbounds (i64, i64* @ref8151, i64 1)
That is, RAUW is called with the same `this` and `New` ValueRef, which, to the
best of my knowledge, is invalid.
--
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/20160915/93802141/attachment.html>
More information about the llvm-bugs
mailing list