<div>Hi,</div><div><br></div><div>The full trace stack:</div><div><div>Type set is empty for each HW mode:</div><div>possible type contradiction in the pattern below (use -print-records with llvm-tblgen to see all expanded records).</div><div>vtInt: <span style="white-space:pre"> </span>(vt:{ *:[Other] })</div><div>UNREACHABLE executed at /home/nancy/work/rpp_clang/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:824!</div><div>[ 85%] Building X86GenEVEX2VEXTables.inc...</div><div> #0 0x000000000081b9b5 llvm::sys::PrintStackTrace(llvm::raw_ostream&) /home/nancy/work/rpp_clang/llvm/lib/Support/Unix/Signals.inc:495:0</div><div> #1 0x000000000081ba48 PrintStackTraceSignalHandler(void*) /home/nancy/work/rpp_clang/llvm/lib/Support/Unix/Signals.inc:559:0</div><div> #2 0x0000000000819602 llvm::sys::RunSignalHandlers() /home/nancy/work/rpp_clang/llvm/lib/Support/Signals.cpp:69:0</div><div> #3 0x000000000081b3b0 SignalHandler(int) /home/nancy/work/rpp_clang/llvm/lib/Support/Unix/Signals.inc:358:0</div><div>fcdsaa #4 0x00007f16408a6390 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)</div><div> #5 0x00007f163fa36428 gsignal /build/glibc-LK5gWL/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0</div><div> #6 0x00007f163fa3802a abort /build/glibc-LK5gWL/glibc-2.23/stdlib/abort.c:91:0</div><div> #7 0x0000000000797d00 bindingsErrorHandler(void*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) /home/nancy/work/rpp_clang/llvm/lib/Support/ErrorHandling.cpp:231:0</div><div> #8 0x00000000004838a8 llvm::TypeInfer::ValidateOnExit::~ValidateOnExit() /home/nancy/work/rpp_clang/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:826:0</div><div> #9 0x00000000004808bd llvm::TypeInfer::EnforceSmallerThan(llvm::TypeSetByHwMode&, llvm::TypeSetByHwMode&) /home/nancy/work/rpp_clang/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:455:0</div><div>#10 0x000000000048860f llvm::SDTypeConstraint::ApplyTypeConstraint(llvm::TreePatternNode*, llvm::SDNodeInfo const&, llvm::TreePattern&) const /home/nancy/work/rpp_clang/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:1506:0</div><div>#11 0x00000000004a780b llvm::SDNodeInfo::ApplyTypeConstraints(llvm::TreePatternNode*, llvm::TreePattern&) const /home/nancy/work/rpp_clang/llvm/utils/TableGen/CodeGenDAGPatterns.h:1307:0</div><div>#12 0x000000000048e303 llvm::TreePatternNode::ApplyTypeConstraints(llvm::TreePattern&, bool) /home/nancy/work/rpp_clang/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:2362:0</div><div>#13 0x000000000048e2d4 llvm::TreePatternNode::ApplyTypeConstraints(llvm::TreePattern&, bool) /home/nancy/work/rpp_clang/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:2361:0</div><div>#14 0x000000000048e2d4 llvm::TreePatternNode::ApplyTypeConstraints(llvm::TreePattern&, bool) /home/nancy/work/rpp_clang/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:2361:0</div><div>#15 0x000000000048e2d4 llvm::TreePatternNode::ApplyTypeConstraints(llvm::TreePattern&, bool) /home/nancy/work/rpp_clang/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:2361:0</div><div>#16 0x00000000005b3c06 (anonymous namespace)::MatcherGen::InferPossibleTypes(unsigned int) /home/nancy/work/rpp_clang/llvm/utils/TableGen/DAGISelMatcherGen.cpp:184:0</div><div>#17 0x00000000005b59ca (anonymous namespace)::MatcherGen::EmitMatchCode(llvm::TreePatternNode const*, llvm::TreePatternNode*, unsigned int) /home/nancy/work/rpp_clang/llvm/utils/TableGen/DAGISelMatcherGen.cpp:491:0</div><div>#18 0x00000000005b54ba (anonymous namespace)::MatcherGen::EmitOperatorMatchCode(llvm::TreePatternNode const*, llvm::TreePatternNode*, unsigned int) /home/nancy/work/rpp_clang/llvm/utils/TableGen/DAGISelMatcherGen.cpp:440:0</div><div>#19 0x00000000005b5c9c (anonymous namespace)::MatcherGen::EmitMatchCode(llvm::TreePatternNode const*, llvm::TreePatternNode*, unsigned int) /home/nancy/work/rpp_clang/llvm/utils/TableGen/DAGISelMatcherGen.cpp:515:0</div><div>#20 0x00000000005b6271 (anonymous namespace)::MatcherGen::EmitMatcherCode(unsigned int) /home/nancy/work/rpp_clang/llvm/utils/TableGen/DAGISelMatcherGen.cpp:559:0</div><div>#21 0x00000000005b8f4a llvm::ConvertPatternToMatcher(llvm::PatternToMatch const&, unsigned int, llvm::CodeGenDAGPatterns const&) /home/nancy/work/rpp_clang/llvm/utils/TableGen/DAGISelMatcherGen.cpp:1026:0</div><div>#22 0x000000000059db91 (anonymous namespace)::DAGISelEmitter::run(llvm::raw_ostream&) /home/nancy/work/rpp_clang/llvm/utils/TableGen/DAGISelEmitter.cpp:169:0</div><div>#23 0x000000000059dd1b llvm::EmitDAGISel(llvm::RecordKeeper&, llvm::raw_ostream&) /home/nancy/work/rpp_clang/llvm/utils/TableGen/DAGISelEmitter.cpp:187:0</div><div>#24 0x00000000007357d1 (anonymous namespace)::LLVMTableGenMain(llvm::raw_ostream&, llvm::RecordKeeper&) /home/nancy/work/rpp_clang/llvm/utils/TableGen/TableGen.cpp:170:0</div><div>#25 0x000000000085c5b8 llvm::TableGenMain(char*, bool (*)(llvm::raw_ostream&, llvm::RecordKeeper&)) /home/nancy/work/rpp_clang/llvm/lib/TableGen/Main.cpp:106:0</div><div>#26 0x0000000000735f0c main /home/nancy/work/rpp_clang/llvm/utils/TableGen/TableGen.cpp:253:0</div><div>#27 0x00007f163fa21830 __libc_start_main /build/glibc-LK5gWL/glibc-2.23/csu/../csu/libc-start.c:325:0</div><div>#28 0x0000000000407bd9 _start (../../../bin/llvm-tblgen+0x407bd9)</div></div><div><br></div><div><br></div><div><br></div><div>===========================================================</div><div><div>PATTERN: (st v1i16:{ *:[v1i16] }:$rs1, (add:{ *:[v1i32] } (shl:{ *:[v1i32] } (sext:{ *:[v1i32] } v1i16:{ *:[v1i16] }:$roffset), (build_vector:{ *:[v1i32] } (imm:{ *:[i32] })<<P:Predicate_uimm2>>:$rshift)), (bitconvert:{ *:[v1i32] } i32:{ *:[i32] }:$rbase)))<<P:Predicate_unindexedstore>><<P:Predicate_store>></div><div>RESULT: (STOREbos v1i16:{ *:[v1i16] }:$rs1, i32:{ *:[i32] }:$rbase, v1i16:{ *:[v1i16] }:$roffset, (imm:{ *:[i32] }):$rshift)</div></div><div><br></div><div>DAGIselMatcherGen.cpp: 559</div><div>Pattern.getSrcPattern()->dump(); </div><div>// list<dag> Pattern = [(store v1i16:$rs1, (add (v1i32 (bitconvert i32:$rbase)), (shl (v1i32 (sext v1i16:$roffset)), (v1i32 (build_vector uimm2:$rshift)))))];</div><div><br></div><div>In CodeGenDAGPatterns.cpp: 1443</div><div><div>bool SDTypeConstraint::ApplyTypeConstraint(TreePatternNode *N,</div><div> const SDNodeInfo &NodeInfo,</div><div> TreePattern &TP) const {</div></div><div><div>.....</div><div>N->dump() ; // (sext:{ *:[v1i32] } v1i16:{ *:[i16] }:$roffset)</div><div><div>Why it become v1i16:{ *:[i16] }:$roffset? Should be (sext:{ *:[v1i32] } v1i16:{ *:[v1i16] }:$roffset) as the Pattern defined.</div><div><br></div><div><div> case SDTCisOpSmallerThanOp: {</div><div> unsigned BResNo = 0;</div><div> TreePatternNode *BigOperand =</div><div> getOperandNum(x.SDTCisOpSmallerThanOp_Info.BigOperandNum, N, NodeInfo,</div><div> BResNo);</div><div><br></div><div><div>NodeToApply->dump(); //v1i16:{ *:[i16] }:$roffset</div><div>BigOperand->dump(); //(sext:{ *:[v1i32] } v1i16:{ *:[i16] }:$roffset)</div></div><div><br></div><div> return TI.EnforceSmallerThan(NodeToApply->getExtType(ResNo),</div><div> BigOperand->getExtType(BResNo));</div><div> }</div></div><div></div></div><div><br></div><div><div>bool TypeInfer::EnforceSmallerThan(TypeSetByHwMode &Small,</div><div> TypeSetByHwMode &Big) {</div></div><div>Small->dump(); //{ *:[i16] }</div><div>Big->dump(); // { *:[v1i32] }</div><div>....</div><div><div> if (none_of(S, isVector) || none_of(B, isVector)) {</div><div> Changed |= berase_if(S, isVector) |</div><div> berase_if(B, isVector);</div><div> }</div></div><div>Changed turn to True here which trigger the final error assert.</div><div><br></div><div>How to understand Pattern Match process? Any document?</div><div><br></div><div style="font-size: 12px;font-family: Arial Narrow;padding:2px 0 2px 0;">------------------ Original ------------------</div><div style="font-size: 12px;background:#efefef;padding:8px;"><div><b>From:</b> "Krzysztof Parzyszek"<kparzysz@quicinc.com>;</div><div><b>Date:</b> Tue, Nov 19, 2019 10:09 PM</div><div><b>To:</b> "Celine"<595602881@qq.com>;"llvm-dev@lists.llvm.org"<llvm-dev@lists.llvm.org>;<wbr></div><div></div><div><b>Subject:</b> RE: [llvm-dev] Tablegen PAT limitation?</div></div><div><br></div>
<style></style>
<div class="WordSection1">
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal">The problem is with a pattern that has a vt in it: the ¡°vtInt ¡¡± printed below the error message. Could you run llvm-tblgen from a debugger and show the stack trace from where the error occurred?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">-- </span>
<span style="font-size:9.0pt;font-family:Consolas"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt;font-family:Consolas">Krzysztof Parzyszek
<a href="mailto:kparzysz@quicinc.com"><span style="color:#0563C1">kparzysz@quicinc.com</span></a> AI tools development<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> llvm-dev <llvm-dev-bounces@lists.llvm.org> <b>On Behalf Of
</b>Celine via llvm-dev<br>
<b>Sent:</b> Tuesday, November 19, 2019 6:52 AM<br>
<b>To:</b> llvm-dev <llvm-dev@lists.llvm.org><br>
<b>Subject:</b> [EXT] [llvm-dev] Tablegen PAT limitation?<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hello, <o:p></o:p></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">def GPR : RegisterClass<"ABC", [v1i16, v1f16], 16, (add<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> IA, IB, IC, ID, IE, IF, IG, IH<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> )>;<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">def MGPR : RegisterClass<"ABC", [v1i16, v1f16], 16, (add<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> IA, IB, IC, ID, IE, IF, IG, IH<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> )>;<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">def SGPR32 : RegisterClass<"ABC", [ i32, f32 ], 32, (add <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> DS0, DS1, DS2, DS3, DS4, DS5, DS6, DS7, DS8, DS9, DS10,DS11,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> DS12, DS13, DS14, DS15<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> )>;<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">def uimm2 : Operand<i32>, ImmLeaf<i32, [{return isUInt<2>(Imm);}]> {<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> let ParserMatchClass = UImmAsmOperand<2>;<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> let DecoderMethod = "decodeUImmOperand<2>";<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">}<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">possible type contradiction in the pattern below (use -print-records with llvm-tblgen to see all expanded records).<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">vtInt: (vt:{ *:[Other] })<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">UNREACHABLE executed at /home/nancy/rpp_llvm/rpp_clang/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:824!<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">def LOADbos { // Instruction ABCInst ABCInstMMEMrr<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> field bits<32> Inst = { 0, 0, 0, 0, rs1{2}, rs1{1}, rs1{0}, index{0}, 0, 0, 0, 1, 0, rbase{3}, rbase{2}, rbase{1}, rbase{0}, rbase{4}, roffset{4}, roffset{3}, roffset{2}, roffset{1}, roffset{0}, 0, 0, 0, 0, 0, 0, 0, 0, 0 };<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> field bits<32> SoftFail = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> string Namespace = "ABC";<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> dag OutOperandList = (outs GPR:$rs1);<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> dag InOperandList = (ins SGPR32:$rbase, MGPR:$roffset, uimm2:$rshift);<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> string AsmString = "LOAD [$rbase + ( $roffset << $rshift )], $rs1";<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> list<dag> Pattern = [(set v1i16:$rs1, (load (add (v1i32 (bitconvert i32:$rbase)), (shl (v1i32 (sext v1i16:$roffset)), (v1i32 (build_vector uimm2:$rshift))))))];<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> list<Register> Uses = [];<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> list<Register> Defs = [];<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> list<Predicate> Predicates = [];<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">-gen-dag-isel -debug<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">PATTERN: (ld:{ *:[v1i16] } (add:{ *:[v1i32] } (shl:{ *:[v1i32] } (sext:{ *:[v1i32] } v1i16:{ *:[v1i16] }:$roffset), (build_vector:{ *:[v1i32] } (imm:{ *:[i32] })<<P:Predicate_uimm2>>:$rshift)), (bitconvert:{ *:[v1i32] } i32:{ *:[i32] }:$rbase)))<<P:Predicate_unindexedload>><<P:Predicate_load>><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">RESULT: (LOADbos:{ *:[v1i16] } i32:{ *:[i32] }:$rbase, v1i16:{ *:[v1i16] }:$roffset, (imm:{ *:[i32] }):$rshift)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">PATTERN: (st v1i16:{ *:[v1i16] }:$rs1, (add:{ *:[v1i32] } v1i32:{ *:[v1i32] }:$roffset, (bitconvert:{ *:[v1i32] } i32:{ *:[i32] }:$rbase)))<<P:Predicate_unindexedstore>><<P:Predicate_store>><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">RESULT: (STORErr v1i16:{ *:[v1i16] }:$rs1, i32:{ *:[i32] }:$rbase, v1i32:{ *:[v1i32] }:$roffset)<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">Type set is empty for each HW mode:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">possible type contradiction in the pattern below (use -print-records with llvm-tblgen to see all expanded records).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">vtInt: (vt:{ *:[Other] })<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">UNREACHABLE executed at /home/nancy/work/rpp_clang/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:824!<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Any idea to solve this problem?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div></div>