Edmund Grimley Evans
2010-Mar-15 15:54 UTC
[LLVMdev] SelectionDAG constant folding leads to assertion failure
My experimental code calls DAG.getNode to construct a unary node with a flag result. Unfortunately the argument turns out to be constant, so lib/CodeGen/SelectionDAG/SelectionDAG.cpp:2332 calls VT.getSizeInBits on the flag type, which isSimple(), so we call V.getSizeInBits at ValueTypes.h:560 and fail at ValueTypes.h:240: clang: .../include/llvm/CodeGen/ValueTypes.h:240: unsigned int llvm::MVT::getSizeInBits() const: Assertion `0 && "getSizeInBits called on extended MVT."' failed. The message is misleading as Flag is not an extended MVT. I would guess that normally constant folding would have happened earlier on, but it would be nice if I could call DAG.getNode with constant arguments without this happening. Could getSizeInBits() return 0 or -1 for a Flag? Or should SelectionDAG::getNode not call getSizeInBits until it knows it actually needs the value? -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Chris Lattner
2010-Mar-15 16:06 UTC
[LLVMdev] SelectionDAG constant folding leads to assertion failure
On Mar 15, 2010, at 8:54 AM, Edmund Grimley Evans wrote:> My experimental code calls DAG.getNode to construct a unary node with > a flag result. Unfortunately the argument turns out to be constant, so > lib/CodeGen/SelectionDAG/SelectionDAG.cpp:2332 calls VT.getSizeInBits > on the flag type, which isSimple(), so we call V.getSizeInBits at > ValueTypes.h:560 and fail at ValueTypes.h:240:That's bad. :)> Or should > SelectionDAG::getNode not call getSizeInBits until it knows it > actually needs the value?You're right, fixed in r98547, thanks! -Chris