<div dir="ltr">Update: I tried changing the check to be that there is only one user rather than only one use and that got the pattern to match, but the mem argument on the resulting machine instruction has four copies of the input chain. I would like them to be deduplicated (since there is really just one load), so I continue to suspect that there is a better way to go about this.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 17, 2019 at 5:41 PM Thomas Lively <<a href="mailto:tlively@google.com">tlively@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi all!<div><br></div><div>I'm trying to do instruction selection on a pattern like the following:</div><div><br></div><div>Pat<(v4i32 (build_vector (i32 (load I32:$addr)), (i32 (load I32:$addr)), (i32 (load I32:$addr)), (i32 (load I32:$addr))))), (LOAD_SPLAT 0, 0, I32:$addr)>;</div><div><br></div><div>Note that all those loads are actually the same load. This fails to match as expected because of the OPC_EmitMergeInputChains operation. There is a check at <a href="https://github.com/llvm/llvm-project/blob/20b52c33ba3960340ecf326314517091b8ec98f4/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp#L3304" target="_blank">https://github.com/llvm/llvm-project/blob/20b52c33ba3960340ecf326314517091b8ec98f4/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp#L3304</a> that the chain to be merged has only one use, but in this case it has four uses, all of which are matched in the same pattern.</div><div><br></div><div>I've tried updating the condition to allow this, but I haven't had any luck so far. Is there any other way to perform the match I want?</div></div>
</blockquote></div>