[LLVMbugs] [Bug 21207] New: DAG Combiner can generate illegal operations

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 8 06:53:55 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=21207

            Bug ID: 21207
           Summary: DAG Combiner can generate illegal operations
           Product: new-bugs
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: stephen.montgomery333 at gmail.com
                CC: llvmbugs at cs.uiuc.edu, resistor at mac.com
    Classification: Unclassified

Since I picked up LLVM 3.5.0, DAGCombiner::SimplifyNodeWithTwoResults is
self-inconsistent in the way it treats the low and high parts of the result. If
the high part of the result is not used, then it uses an operation that
generates only the low part provided such operation is Legal or Custom.
However, if the low part of the result is not used, it generates only the high
part provided that the operation is Legal.

There doesn't seem any good reason for this inconsistency. More importantly, it
means that the combiner can generate a Custom operation for the low part. This
is OK prior to DAG legalisation but when running post-legalisation, shouldn't
all operations be Legal (and not Custom)?

I've experimented with making the behaviour consistent, i.e. only permitting
Legal operations, and this doesn't cause any regressions in the unit test
suite.

I've tried asking on llvmdev whether it is ever acceptable for the combiner to
introduce Custom, as opposed to Legal, operations when running
post-legalisation but I've not had any responses. It feels to me like it's not
acceptable because there's no opportunity for the illegal operation to be
legalised. However, I note that at least on backend, namely MIPS, relies on
matching a Custom operation during ISel as if it were Legal so I'm not sure
what the intended behaviour is.

Prior to r199678, DAGCombiner::SimplifyNodeWithTwoResults treated both halves
consistently and, in my opinion, correctly. Now, any backend that supports a
low-part operation with a custom lowering, such as my microcontroller target,
can have legal operations converted into illegal ones.

This isn't the only place in the DAG Combiner where Custom operations can be
introduced post legalisation, but it's one that gives me concern.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141008/93fd34d3/attachment.html>


More information about the llvm-bugs mailing list