<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Assertion `(!From->hasAnyUseOfValue(i) || From->getValueType(i) == To->getValueType(i)) && "Cannot use this version of ReplaceAllUsesWith!"' failed."
href="https://llvm.org/bugs/show_bug.cgi?id=28444">28444</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Assertion `(!From->hasAnyUseOfValue(i) || From->getValueType(i) == To->getValueType(i)) && "Cannot use this version of ReplaceAllUsesWith!"' failed.
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Common Code Generator Code
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mikael.holmen@ericsson.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=16702" name="attach_16702" title="Reproducer ll file">attachment 16702</a> <a href="attachment.cgi?id=16702&action=edit" title="Reproducer ll file">[details]</a></span>
Reproducer ll file
After this commit:
Author: arsenm
Date: Tue Jul 5 13:25:02 2016
New Revision: 274569
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=274569&view=rev">http://llvm.org/viewvc/llvm-project?rev=274569&view=rev</a>
Log:
DAGCombiner: Fold away vector extract of insert with the same index
The following triggers an assert:
llc -march=x86-64 -mcpu=corei7 red.ll
[...]
=== autogen_SD13436
Initial selection DAG: BB#0 'autogen_SD13436:BB'
SelectionDAG has 14 nodes:
t0: ch = EntryToken
t2: i32,ch = CopyFromReg t0, Register:i32 %vreg1
t7: i32 = Constant<0>
t4: i1 = setcc t2, t2, setult:ch
t9: v1i1 = insert_vector_elt undef:v1i1, Constant:i1<-1>,
Constant:i64<0>
t10: v1i1 = select t4, undef:v1i1, t9
t11: i8 = extract_vector_elt t10, Constant:i64<0>
t13: ch = CopyToReg t0, Register:i8 %vreg0, t11
Combining: t13: ch = CopyToReg t0, Register:i8 %vreg0, t11
Combining: t12: i8 = Register %vreg0
Combining: t11: i8 = extract_vector_elt t10, Constant:i64<0>
Combining: t10: v1i1 = select t4, undef:v1i1, t9
... into: t9: v1i1 = insert_vector_elt undef:v1i1, Constant:i1<-1>,
Constant:i64<0>
Combining: t11: i8 = extract_vector_elt t9, Constant:i64<0>
... into: t6: i1 = Constant<-1>
llc: ../lib/CodeGen/SelectionDAG/SelectionDAG.cpp:6357: void
llvm::SelectionDAG::ReplaceAllUsesWith(llvm::SDNode *, llvm::SDNode *):
Assertion `(!From->hasAnyUseOfValue(i) || From->getValueType(i) ==
To->getValueType(i)) && "Cannot use this version of ReplaceAllUsesWith!"'
failed.
#0 0x000000000254acbf llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/data/repo/llvm-patch/build-all-Debug/../lib/Support/Unix/Signals.inc:402:5
#1 0x000000000254b1c9 PrintStackTraceSignalHandler(void*)
/data/repo/llvm-patch/build-all-Debug/../lib/Support/Unix/Signals.inc:470:1
#2 0x0000000002549823 llvm::sys::RunSignalHandlers()
/data/repo/llvm-patch/build-all-Debug/../lib/Support/Signals.cpp:45:5
#3 0x000000000254b7fe SignalHandler(int)
/data/repo/llvm-patch/build-all-Debug/../lib/Support/Unix/Signals.inc:256:1
#4 0x00007f3e718d0330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#5 0x00007f3e704c3c37 gsignal
/build/eglibc-oGUzwX/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#6 0x00007f3e704c7028 abort
/build/eglibc-oGUzwX/eglibc-2.19/stdlib/abort.c:91:0
#7 0x00007f3e704bcbf6 __assert_fail_base
/build/eglibc-oGUzwX/eglibc-2.19/assert/assert.c:92:0
#8 0x00007f3e704bcca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#9 0x000000000234de74 llvm::SelectionDAG::ReplaceAllUsesWith(llvm::SDNode*,
llvm::SDNode*)
/data/repo/llvm-patch/build-all-Debug/../lib/CodeGen/SelectionDAG/SelectionDAG.cpp:6355:5
#10 0x00000000021e51cb (anonymous
namespace)::DAGCombiner::Run(llvm::CombineLevel)
/data/repo/llvm-patch/build-all-Debug/../lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1337:7
#11 0x00000000021e4a92 llvm::SelectionDAG::Combine(llvm::CombineLevel,
llvm::AAResults&, llvm::CodeGenOpt::Level)
/data/repo/llvm-patch/build-all-Debug/../lib/CodeGen/SelectionDAG/DAGCombiner.cpp:15038:3
#12 0x000000000239e004 llvm::SelectionDAGISel::CodeGenAndEmitDAG()
/data/repo/llvm-patch/build-all-Debug/../lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:755:5
#13 0x000000000239dbee
llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::Instruction
const>, llvm::ilist_iterator<llvm::Instruction const>, bool&)
/data/repo/llvm-patch/build-all-Debug/../lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:680:1
#14 0x000000000239da33
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
/data/repo/llvm-patch/build-all-Debug/../lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1485:5
#15 0x000000000239b81b
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
/data/repo/llvm-patch/build-all-Debug/../lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:505:36
#16 0x00000000015ae72b (anonymous
namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
/data/repo/llvm-patch/build-all-Debug/../lib/Target/X86/X86ISelDAGToDAG.cpp:175:25
#17 0x0000000001c0e27b
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
/data/repo/llvm-patch/build-all-Debug/../lib/CodeGen/MachineFunctionPass.cpp:60:8
#18 0x0000000001f9af8d llvm::FPPassManager::runOnFunction(llvm::Function&)
/data/repo/llvm-patch/build-all-Debug/../lib/IR/LegacyPassManager.cpp:1526:23
#19 0x0000000001f9b2c5 llvm::FPPassManager::runOnModule(llvm::Module&)
/data/repo/llvm-patch/build-all-Debug/../lib/IR/LegacyPassManager.cpp:1547:16
#20 0x0000000001f9baae (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&)
/data/repo/llvm-patch/build-all-Debug/../lib/IR/LegacyPassManager.cpp:1603:23
#21 0x0000000001f9b5ab llvm::legacy::PassManagerImpl::run(llvm::Module&)
/data/repo/llvm-patch/build-all-Debug/../lib/IR/LegacyPassManager.cpp:1706:16
#22 0x0000000001f9bff1 llvm::legacy::PassManager::run(llvm::Module&)
/data/repo/llvm-patch/build-all-Debug/../lib/IR/LegacyPassManager.cpp:1737:3
#23 0x000000000086ca58 compileModule(char**, llvm::LLVMContext&)
/data/repo/llvm-patch/build-all-Debug/../tools/llc/llc.cpp:483:42
#24 0x000000000086af31 main
/data/repo/llvm-patch/build-all-Debug/../tools/llc/llc.cpp:260:13
#25 0x00007f3e704aef45 __libc_start_main
/build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#26 0x000000000086aae4 _start (build-all-Debug/bin/llc+0x86aae4)
Stack dump:
0. Program arguments: build-all-Debug/bin/llc -march=x86-64 -mcpu=corei7
red.ll -debug
1. Running pass 'Function Pass Manager' on module 'red.ll'.
2. Running pass 'X86 DAG->DAG Instruction Selection' on function
'@autogen_SD13436'
In the debugger:
#4 0x000000000234de74 in llvm::SelectionDAG::ReplaceAllUsesWith
(this=0x3f2e490, From=0x3f87280, To=0x3f87050) at
../lib/CodeGen/SelectionDAG/SelectionDAG.cpp:6355
6355 assert((!From->hasAnyUseOfValue(i) ||
(gdb) l
6352 void SelectionDAG::ReplaceAllUsesWith(SDNode *From, SDNode *To) {
6353 #ifndef NDEBUG
6354 for (unsigned i = 0, e = From->getNumValues(); i != e; ++i)
6355 assert((!From->hasAnyUseOfValue(i) ||
6356 From->getValueType(i) == To->getValueType(i)) &&
6357 "Cannot use this version of ReplaceAllUsesWith!");
6358 #endif
6359
(gdb) p i
$1 = 0
(gdb) p From->hasAnyUseOfValue(i)
$2 = true
(gdb) p From->getValueType(i)
$3 = {V = {SimpleTy = llvm::MVT::i8}, LLVMTy = 0x0}
(gdb) p To->getValueType(i)
$4 = {V = {SimpleTy = llvm::MVT::i1}, LLVMTy = 0x0}
(gdb) call From->dump()
t11: i8 = extract_vector_elt t9, Constant:i64<0>
(gdb) call To->dump()
t6: i1 = Constant<-1></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>