[LLVMdev] Illegal node introduced by DAGCombiner after legal phase

Duncan Sands baldrick at free.fr
Sun Aug 26 12:45:39 PDT 2012


Hi Borja,

> I'm getting an instruction selection error because DAGCombiner is introducing an
> illegal node after the legalizeDAG phase. Basically this is what is going on:
>
> 1) During legalization, BR_JT gets expanded introducing a (mul x, 2).
> 2) After legalization  (AfterLegalizeDAG), that (mul x, 2) is converted to an
> (shl x, 1).
>
> However, that shl node introduced is illegal, and since my custom lowering code
> won't run after this phase it gets into the instruction selector. I would like
> to know if this is really a bug or it has to be handled by the target code. I
> guess I could add a custom dagcombine hook for this node and revert it in my
> target, but I want to hear what is the best thing to do.

it sounds like a bug in the DAG combiner.  I think checks for legal operations
tend to get added to the DAG combiner on an "as needed" basis, so maybe no-one
had a platform for which this shift is not legal before.

Ciao, Duncan.




More information about the llvm-dev mailing list