Lawerence, Peter via llvm-dev
2015-Oct-15 00:19 UTC
[llvm-dev] mysterious assert in SelectionDAGLegalize::LegalizeOp()
I'm writing a new Target in 3.6.2, I'm getting this assert src/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1166: void {anonymous}::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*): Assertion `TLI.getTypeAction(*DAG.getContext(), Node->getValueType(i)) == TargetLowering::TypeLegal && "Unexpected illegal type!"' failed. which gdb shows having come from #4 0x0000000001afce5b in SelectionDAGLegalize::LegalizeOp (this=0x7fffffffd0f0, Node=0x3571be0) I did my run with -debug-only=isel, so I got the output at the bottom, the question is, why is Node=0x3571be0 being examined at all ? in particular that Node got replaced (and deleted ?) a long time ago ? that node's last appearance in the DAG was in the output titled Optimized lowered selection DAG: BB#0 'foobar:entry' and we are two phases later, in what would be titled Legalized selection DAG: BB#2 'foobar:entry' were we to finished the phase we're in, 0x3571be0: i8 = Constant<1> original, which got replaced, by CurDAG->LegalizeTypes(), with 0x3571690: i16 = Constant<1> replacement, but later CurDAG->Legalize() is somehow examining the original ??? TIA, Peter Lawrence. FYI: def SLL : FMT_I3 <0x7200, (outs datareg:$dst), (ins datareg:$rs1, i16imm:$imm), "sll $dst,$rs1,$imm", [(set i16:$dst, (shl i16:$rs1, i16:$imm))]>; int foobar(int A) { return A << 1; } Optimized lowered selection DAG: BB#0 'foobar:entry' SelectionDAG has 11 nodes: 0x35455b0: ch = EntryToken 0x35455b0: <multiple use> 0x3571360: i16 = Register %vreg0 0x3571470: i16,ch = CopyFromReg 0x35455b0, 0x3571360 [ORD=1] 0x3571e00: i16 = Register %R0 0x35455b0: <multiple use> 0x3571470: <multiple use> 0x3571580: i16 = FrameIndex<0> 0x35717a0: i16 = undef 0x35718b0: ch = store 0x35455b0, 0x3571470, 0x3571580, 0x35717a0 <ST2[%A.addr]> [ORD=3] 0x3571e00: <multiple use> 0x3571470: <multiple use> 0x3571be0: i8 = Constant<1> 0x3571cf0: i16 = shl 0x3571470, 0x3571be0 [ORD=5] 0x3571f10: ch,glue = CopyToReg 0x35718b0, 0x3571e00, 0x3571cf0 [ORD=6] 0x3571f10: <multiple use> 0x3571e00: <multiple use> 0x3571f10: <multiple use> 0x3572020: ch = XmcISD::RET 0x3571f10, 0x3571e00, 0x3571f10:1 [ORD=6] Type-legalized selection DAG: BB#0 'foobar:entry' SelectionDAG has 11 nodes: 0x35455b0: ch = EntryToken [ID=-3] 0x35455b0: <multiple use> 0x3571360: i16 = Register %vreg0 [ID=-3] 0x3571470: i16,ch = CopyFromReg 0x35455b0, 0x3571360 [ORD=1] [ID=-3] 0x3571e00: i16 = Register %R0 [ID=-3] 0x35455b0: <multiple use> 0x3571470: <multiple use> 0x3571580: i16 = FrameIndex<0> [ID=-3] 0x35717a0: i16 = undef [ID=-3] 0x35718b0: ch = store 0x35455b0, 0x3571470, 0x3571580, 0x35717a0 <ST2[%A.addr]> [ORD=3] [ID=-3] 0x3571e00: <multiple use> 0x3571470: <multiple use> 0x3571690: i16 = Constant<1> [ID=-3] 0x35719c0: i16 = shl 0x3571470, 0x3571690 [ORD=5] [ID=-3] 0x3571f10: ch,glue = CopyToReg 0x35718b0, 0x3571e00, 0x35719c0 [ORD=6] [ID=-3] 0x3571f10: <multiple use> 0x3571e00: <multiple use> 0x3571f10: <multiple use> 0x3572020: ch = XmcISD::RET 0x3571f10, 0x3571e00, 0x3571f10:1 [ORD=6] [ID=-3] Optimized type-legalized selection DAG: BB#0 'foobar:entry' SelectionDAG has 11 nodes: 0x35455b0: ch = EntryToken [ID=-3] 0x35455b0: <multiple use> 0x3571360: i16 = Register %vreg0 [ID=-3] 0x3571470: i16,ch = CopyFromReg 0x35455b0, 0x3571360 [ORD=1] [ID=-3] 0x3571e00: i16 = Register %R0 [ID=-3] 0x35455b0: <multiple use> 0x3571470: <multiple use> 0x3571580: i16 = FrameIndex<0> [ID=-3] 0x35717a0: i16 = undef [ID=-3] 0x35718b0: ch = store 0x35455b0, 0x3571470, 0x3571580, 0x35717a0 <ST2[%A.addr]> [ORD=3] [ID=-3] 0x3571e00: <multiple use> 0x3571470: <multiple use> 0x3571690: i16 = Constant<1> [ID=-3] 0x35719c0: i16 = shl 0x3571470, 0x3571690 [ORD=5] [ID=-3] 0x3571f10: ch,glue = CopyToReg 0x35718b0, 0x3571e00, 0x35719c0 [ORD=6] [ID=-3] 0x3571f10: <multiple use> 0x3571e00: <multiple use> 0x3571f10: <multiple use> 0x3572020: ch = XmcISD::RET 0x3571f10, 0x3571e00, 0x3571f10:1 [ORD=6] [ID=-3] llc: /projects/Firmware/plawrenc/xllvm/llvm-3.6.2.src/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1166: void {anonymous}::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*): Assertion `TLI.getTypeAction(*DAG.getContext(), Node->getValueType(i)) == TargetLowering::TypeLegal && "Unexpected illegal type!"' failed. Program received signal SIGABRT, Aborted. 0x0000003d9f035c55 in raise () from /lib64/libc.so.6 (gdb) where #0 0x0000003d9f035c55 in raise () from /lib64/libc.so.6 #1 0x0000003d9f037408 in abort () from /lib64/libc.so.6 #2 0x0000003d9f02e972 in __assert_fail_base () from /lib64/libc.so.6 #3 0x0000003d9f02ea22 in __assert_fail () from /lib64/libc.so.6 #4 0x0000000001afce5b in (anonymous namespace)::SelectionDAGLegalize::LegalizeOp (this=0x7fffffffd0f0, Node=0x3571be0) at /projects/Firmware/plawrenc/xllvm/llvm-3.6.2.src/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1164 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151015/5fabdb24/attachment.html>