[llvm-dev] Different SelectionDAGs for same CPU

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Mon Jan 21 23:52:36 PST 2019


Hi Josh,

On Tue, 22 Jan 2019 at 04:54, Josh Sharp via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> In the first case, node t1 is a separate node whereas in the second case, t1 is inside t4. What difference in implementation could explain this difference in behavior?

The second compiler looks like someone has added extra code to fold a
stack address calculation into the load operation that accesses the
variable.

> Where in the code should I look into?

It could be implemented in a couple of places. Most likely is that
XYZInstrInfo.td (or some related TableGen file) defines a
ComplexPattern that is used by the LDWI instruction definition. That
ComplexPattern tells pattern matching to call a specific function in
XYZISelDAGToDAG.cpp when deciding what to use for the LDWI operands.
That C++ function is probably what looks for an FrameIndex node and
has been taught that it can be folded into the load.

If you just grep the target's code for FrameIndex or frameindex you
should find it pretty quickly though, even if they used some other
method. There don't tend to be many uses of that particular node.

Cheers.

Tim.


More information about the llvm-dev mailing list