<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 --- - SelectionDAGBuilder::visitSwitch() creates disconnected MBB"
href="https://llvm.org/bugs/show_bug.cgi?id=27135">27135</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>SelectionDAGBuilder::visitSwitch() creates disconnected MBB
</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>paulsson@linux.vnet.ibm.com
</td>
</tr>
<tr>
<th>CC</th>
<td>congh@google.com, hans@hanshq.net, 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=16130" name="attach_16130" title="Input for compilation">attachment 16130</a> <a href="attachment.cgi?id=16130&action=edit" title="Input for compilation">[details]</a></span>
Input for compilation
visitSwitch() seems to create an MBB whithout predecessors / successors.
The attached test case is not minimized, but the verifier gives the exact spot.
If you are lucky, you can get there in gdb with:
b MachineFunction:247 // in CreateMachineBasicBlock()
condition [BP] (bb && strcmp(bb->getName().Data,"if.then72")==0)
c // continue once
u // go up the stack a few times, and that should be the SelectionDAGBuilder
handling bb:
if.then72: ; preds = %land.lhs.true71
%24 = inttoptr i64 %in.addr.sroa.0.0 to %struct.rtx_def*
%arrayidx74 = getelementptr inbounds %struct.rtx_def, %struct.rtx_def* %24,
i64 0, i32 1, i64 0
%25 = bitcast %union.rtunion_def* %arrayidx74 to i32**
%26 = load i32*, i32** %25, align 8, !tbaa !5
%bf.load75 = load i32, i32* %26, align 8
%bf.lshr76 = lshr i32 %bf.load75, 16
switch i32 %bf.lshr76, label %if.end92 [
i32 99, label %sw.bb
i32 98, label %sw.bb
i32 101, label %sw.bb
i32 97, label %sw.bb84
i32 96, label %sw.bb84
i32 100, label %sw.bb84
]
(gdb) run -cc1 -triple s390x-ibm-linux -S -disable-free -main-file-name
reload.c -mrelocation-model static -mthread-model posix -fmath-errno
-masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu z13
-momit-leaf-frame-pointer -v -dwarf-column-info -debugger-tuning=gdb -O3
-ferror-limit 19 -fmessage-length 238 -funroll-loops -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o reload.s -x ir ./reload.bc
Add -mllvm -verify-machineinstrs to see the error message:
...
BB#524: derived from LLVM BB %if.then72
Predecessors according to CFG: BB#17
%vreg455<def> = LHIMux 1; GR32Bit:%vreg455
%vreg456<def,tied1> = SLL %vreg455<tied0>, %vreg453, 0;
GR32Bit:%vreg456,%vreg455 ADDR32Bit:%vreg453
TMLMux %vreg456<kill>, 19, %CC<imp-def>; GR32Bit:%vreg456
BRC 15, 7, <BB#19>, %CC<imp-use>
J <BB#18>
Successors according to CFG: BB#19(0x40000000 / 0x80000000 = 50.00%)
BB#18(0x40000000 / 0x80000000 = 50.00%)
BB#525: derived from LLVM BB %if.then72 <<<<<<<<< Not connected!!
BB#18: derived from LLVM BB %sw.bb
...
*** Bad machine code: PHI operand is not in the CFG ***
- function: push_reload
- basic block: BB#20 if.end92 (0x85a2f140)
- instruction: %vreg17<def> = PHI
- operand 16: <BB#525>
*** Bad machine code: PHI operand is not in the CFG ***
- function: push_reload
- basic block: BB#20 if.end92 (0x85a2f140)
- instruction: %vreg18<def> = PHI
- operand 16: <BB#525>
fatal error: error in backend: Found 2 machine code errors.</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>