[llvm-dev] getMinimalPhysRegClass : Couldn't find the register class

Peeter Joot via llvm-dev llvm-dev at lists.llvm.org
Wed Nov 9 10:58:39 PST 2016


I've implemented a function pass, and some associated hacks to llvm and clang, and am hitting an error in a DAG pass when my transformed IR is processed. That transformed bytecode attempts to insert a call around a load of a 'long double'. The error is:


3. Running pass 'Function Pass Manager' on module 'big.c'.


4. Running pass 'X86 DAG->DAG Instruction Selection' on function '@ld'



The assert is after a failure to lookup a BestRC pointer in this function:




(gdb) b 141 if (BestRC == 0)


Breakpoint 3 at 0x7ffff6755436: file /home/pjoot/llvm/lib/CodeGen/TargetRegisterInfo.cpp, line 141.


(gdb) c


Continuing.


Breakpoint 3, llvm::TargetRegisterInfo::getMinimalPhysRegClass (this=0x5cc4f8, reg=44, VT=...) at /home/pjoot/llvm/lib/CodeGen/TargetRegisterInfo.cpp:141


141  assert(BestRC && "Couldn't find the register class");


(gdb) p reg


$4 = 44


(gdb) p c


$5 = (const llvm::TargetRegisterClass *) 0x0


(gdb) p VT


$6 = {SimpleTy = llvm::MVT::SimpleValueType::i32}


The bytecode that my pass is producing is:


; Function Attrs: nounwind uwtable


define x86_fp80 @ld(x86_fp80* nocapture readonly %d) local_unnamed_addr #0 {


entry:


%0 = load x86_fp80, x86_fp80* %d, align 16, !tbaa !1


%swap16 = tail call x86_fp80 @__lz_bswapld(x86_fp80 %0) #1


ret x86_fp80 %swap16


}

where the untransformed bytecode was:


define x86_fp80 @ld(x86_fp80* nocapture readonly %d) local_unnamed_addr #0 {


entry:


%0 = load x86_fp80, x86_fp80* %d, align 16, !tbaa !1


ret x86_fp80 %0


}

What about this transformed bytecode does the later DAG->DAG pass dislike? What is the valid range of registers in this function (i.e. is the reg=45 value that I see in this function valid)?



--
Peeter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161109/b8ef5d96/attachment-0001.html>


More information about the llvm-dev mailing list