[LLVMdev] SelectionDAG constant folding leads to assertion failure

Edmund Grimley Evans Edmund.Grimley-Evans at arm.com
Mon Mar 15 08:54:08 PDT 2010


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.



More information about the llvm-dev mailing list