Emmanuel Viaud
2008-Jun-25 09:41 UTC
[LLVMdev] Assert in SelectionDAGLegalize when using arbitrary size integers
Hi. I am beginning to learn LLVM (using LLVM 2.3.0 on a Linux x86_64 machine) and wanted to check the status of the support of arbitrary size integers. To do so, I tried to modify the HowToUseJIT example by replacing the Int32Ty with another size (let's say 12 bits for the example). While it compiles ok, I get the following assert at run-time: HowToUseJIT: LegalizeDAG.cpp:4059: llvm::SDOperand <unnamed>::SelectionDAGLegalize::PromoteOp(llvm::SDOperand): Assertion `NVT > VT && MVT::isInteger(NVT) == MVT::isInteger(VT) && "Cannot promote to smaller type!"' failed. The corresponding code is the following: SDOperand SelectionDAGLegalize::PromoteOp(SDOperand Op) { MVT::ValueType VT = Op.getValueType(); MVT::ValueType NVT = TLI.getTypeToTransformTo(VT); assert(getTypeAction(VT) == Promote && "Caller should expand or legalize operands that are not promotable!"); assert(NVT > VT && MVT::isInteger(NVT) == MVT::isInteger(VT) && "Cannot promote to smaller type!"); The assert fails in the first test. When trying to understand the bahaviour, I saw that : - VT value is 0xBFE : OK because 0xB is (bitwidth-1) and 0xFE is MVT::iAny from MVT::SimpleValueType - NVT value is 3 : OK because 3 = MVT::i16 from MVT::SimpleValueType What I don't really understand is the meaning of that first test in the assert : 'NVT > VT'. As in that case VT is always >= MVT::iAny and NVT is <= MVT::LAST_VALUETYPE, the test is always false. So did I miss something obvious, does that simply mean that the PromoteOp method doesn't deal yet with arbitrary size integers or is there a problem in the assert condition? Sorry for the maybe naive question and thanks for any information on the subject. Best regards, Emmanuel.
Duncan Sands
2008-Jun-25 13:28 UTC
[LLVMdev] Assert in SelectionDAGLegalize when using arbitrary size integers
Hi,> I am beginning to learn LLVM (using LLVM 2.3.0 on a Linux x86_64 > machine) and wanted to check the status of the support of arbitrary > size integers.use llvm from svn and apply this patch. Ciao, Duncan. Index: llvm.master/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ==================================================================--- llvm.master.orig/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp 2008-06-23 17:16:00.000000000 +0200 +++ llvm.master/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp 2008-06-23 17:17:40.000000000 +0200 @@ -5341,8 +5341,9 @@ // Second step, hack on the DAG until it only uses operations and types that // the target supports. -#if 0 // Enable this some day. +#if 1 // Enable this some day. DAG.LegalizeTypes(); + DEBUG(DAG.dump()); // Someday even later, enable a dag combine pass here. #endif DAG.Legalize();
Seemingly Similar Threads
- [LLVMdev] [PATCH] Add new phase to legalization to handle vector operations
- [LLVMdev] Variable length condition code for SETCC and SELECT?
- [LLVMdev] Vector promotion broken for <2 x [i8|i16]>
- [LLVMdev] Vector promotion broken for <2 x [i8|i16]>
- [LLVMdev] Vector promotion broken for <2 x [i8|i16]>