[LLVMdev] Use of custom operations after DAG legalization

Steve Montgomery stephen.montgomery3 at btinternet.com
Wed Oct 1 11:40:23 PDT 2014

I'm glad I'm not the only one having issues in this area.

Is anyone able to offer an opinion or answer to the original question, namely: is it permitted for the DAG Combiner to introduce anything other then legal operations when it is running post-legalization?

It seems counter-intuitive to me that illegal operations are be introduced at this stage. However, I see that some backends use Custom to permit a custom-lowering of an operation that is actually natively supported, an example being Mips i32 SELECT.

Steve Montgomery

On 26 Sep 2014, at 16:44, David Chisnall <David.Chisnall at cl.cam.ac.uk> wrote:

> On 26 Sep 2014, at 11:34, Steve Montgomery <stephen.montgomery3 at btinternet.com> wrote:
>> This got me wondering why it's ever permitted for the DAG Combiner, when running post-legalization, to combine to an operation that requires custom lowering. I'd believed that after legalization, all operations were Legal and that none were permitted to be Custom. I see several places in DAGCombine where nodes are combined, post-legalization, to Legal or Custom operations but I can also see other places where only Legal operations are permitted. Is this intentional?
> I've hit numerous similar issues with SelectionDAG.  They're all difficult to debug because the typical behaviour is an infinite loop, where the back end replaces something generic with something that works for the architecture and then SelectionDAG decides to replace this with the original generic thing.  One example is that our architecture supported unaligned loads and stores with some pointer types, but not others.
> David

More information about the llvm-dev mailing list