[LLVMdev] visitBIT_CONVERT (previous Shouldn't DAGCombine insert legal nodes?)

Duncan Sands baldrick at free.fr
Thu Mar 5 12:15:59 PST 2009


Hi Gabriele,

> In the combine 2 step (after legalization), in the DAGCombiner::visitBIT_CONVERT() method, the DAG combiner is replacing an FABS followed by a BIT_CONVERT, to a BIT_CONVERT followed by an AND 0x7FFFFFFFFFFFFFFF. Everything is 64 bit.
> On my target, FABS and BIT_CONVERT are legal in 64 bit, but AND in not legal in 64 bit (is declared custom). So the dag combiner is introducing illegal (not legal) nodes that generates an abort during the machine instruction selection.
> In my understanding, this is a bug because who generates a node has to check if it is legal, especially if it is generating it after legalization. What discussed few weeks ago is confirming that (see below).

if the LegalOperations flag is set in the DAGCombiner, then
it is not allowed to create illegal operations out of legal
operations.

> My questions:
> 1) Is my understanding right?

Historically nodes marked "custom" were considered legal, so the
DAGCombiner would have been correct to generate it.  Not sure how
that ever worked though.  I think Dan split the isOperationLegal
method into isOperationLegal and isOperationLegalOrCustom for reasons
related to this kind of thing.  I don't know whether the DAGCombiner
is now only supposed to produce legal non-custom nodes.

> 2) Is there any bug report generated after the discussion below?

I don't know, sorry.

Ciao,

Duncan.



More information about the llvm-dev mailing list