<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>This sounds like you have a side effecting psuedo which is not
marked with the appropriate flags or a misconstructed DAG. I'd
suggest using -print-after-all, find the place that's dropping it,
look at the reasoning, and use that to identify your mistake.</p>
<p>Philip <br>
</p>
<br>
<div class="moz-cite-prefix">On 12/08/2016 03:31 PM, Louis Li wrote:<br>
</div>
<blockquote
cite="mid:CADQ-RE_UjeMpoMi29ADymA4eWEyR6R-v3yLhii7dWWmvC22GaA@mail.gmail.com"
type="cite">
<div dir="ltr">Hi Philip, thanks for the response. No, I don't
need to vary the pseudo op -- I did follow the other intrinsics
but what happens now (after tinkering some more) is that my
instruction actually gets optimized out (after debugging by
showing the selection dag after various rounds of optimization).
It might help if I send a patch along -- I uploaded it to
phabricator with a link to selectiondagbuilder.
<div><br>
</div>
<div><a moz-do-not-send="true"
href="https://reviews.llvm.org/D27503#58aa05e8">https://reviews.llvm.org/D27503#58aa05e8</a><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Fri, Dec 2, 2016 at 5:35 PM Philip Reames <<a
moz-do-not-send="true"
href="mailto:listmail@philipreames.com"><a class="moz-txt-link-abbreviated" href="mailto:listmail@philipreames.com">listmail@philipreames.com</a></a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000" class="gmail_msg">
<div class="m_7768144006507966684moz-cite-prefix gmail_msg">On
12/01/2016 04:01 PM, Louis Li via llvm-dev wrote:<br
class="gmail_msg">
</div>
<blockquote type="cite" class="gmail_msg">
<div dir="ltr" class="gmail_msg">
<div class="gmail_msg">Hi, I'm trying to implement a
target-agnostic intrinsic, first targeting X86. I'm
trying to map the intrinsic SD node to an instruction
with a certain target opcode that I've introduced. The
issue that I'm running into is what the correct way to
lower the argument is. I've done a couple loops on the
docs so any help would be appreciated!</div>
</div>
</blockquote>
</div>
<div bgcolor="#FFFFFF" text="#000000" class="gmail_msg"> I'm
really confused by the way you're asking the question.
Assuming you're adding code to SelectionDAGBuilder, handling
the argument should just be a getValue(Value*) call. Take a
look at the lowering for ctlz (or one of many other
examples), how are your arguments different than what's done
here? Do you need to vary the psuedo op emitted depending
on the argument or something like that?<br class="gmail_msg">
</div>
<div bgcolor="#FFFFFF" text="#000000" class="gmail_msg">
<blockquote type="cite" class="gmail_msg">
<div dir="ltr" class="gmail_msg">
<div class="gmail_msg"><br class="gmail_msg">
</div>
<div class="gmail_msg">Some options I've explored but
have been missing some crucial step/concept:</div>
<div class="gmail_msg">- tablegen matching?</div>
<div class="gmail_msg">- SelectionDAGBuilder.cpp +
BuildMI call (but then this runs into the issue of
lowering the argument correctly - not sure if that's
feasible at this point in instruction selection)</div>
<div class="gmail_msg">- X86ISelLowering -- same
confusion as above</div>
<div class="gmail_msg"><br class="gmail_msg">
</div>
<div class="gmail_msg">Here's how the dag currently
looks (before erroring out, since I haven't handled
the intrinsic)</div>
<div class="gmail_msg"><a moz-do-not-send="true"
href="https://drive.google.com/file/d/0B5G4m_mQneSjRWQzRVltdDJOQnM/view?usp=sharing"
class="gmail_msg" target="_blank">https://drive.google.com/file/d/0B5G4m_mQneSjRWQzRVltdDJOQnM/view?usp=sharing</a><br
class="gmail_msg">
</div>
<div class="gmail_msg">Would it be problematic if I
somehow extracted the pointer address arg to the
intrisic from TargetConstant and passed it as
MachineOperand to the MachineInstruction?</div>
<div class="gmail_msg"><br class="gmail_msg">
</div>
<div class="gmail_msg">Opcode definition
(Target/Target.td)<br class="gmail_msg">
</div>
<div class="gmail_msg">==============</div>
<div class="gmail_msg">
<div class="gmail_msg">+def PATCHABLE_LOG_CALL :
Instruction {</div>
<div class="gmail_msg">+ let OutOperandList = (outs);</div>
<div class="gmail_msg">+ let InOperandList = (ins
unknown:$entry);</div>
<div class="gmail_msg">+ let AsmString = "# XRay
Custom Log.";</div>
<div class="gmail_msg">+ let usesCustomInserter = 1;</div>
<div class="gmail_msg">+ let hasSideEffects = 1;</div>
<div class="gmail_msg">+}</div>
</div>
<div class="gmail_msg"><br class="gmail_msg">
</div>
<div class="gmail_msg">Example IR for the graph above</div>
<div class="gmail_msg">===========</div>
<div class="gmail_msg">define i32 @caller() nounwind
noinline uwtable "function-instrument"="xray-always" {</div>
<div class="gmail_msg"> %logentryptr = alloca i8</div>
<div class="gmail_msg"> call void
@llvm.xray.customlog(i8* %logentryptr)</div>
<div class="gmail_msg"> ret i32 0</div>
<div class="gmail_msg">}</div>
<div class="gmail_msg"><br class="gmail_msg">
</div>
<div class="gmail_msg">declare void
@llvm.xray.customlog(i8*)</div>
</div>
<br class="gmail_msg">
<fieldset class="m_7768144006507966684mimeAttachmentHeader
gmail_msg"></fieldset>
<br class="gmail_msg">
</blockquote>
</div>
<div bgcolor="#FFFFFF" text="#000000" class="gmail_msg">
<blockquote type="cite" class="gmail_msg">
<pre class="gmail_msg">_______________________________________________
LLVM Developers mailing list
<a moz-do-not-send="true" class="m_7768144006507966684moz-txt-link-abbreviated gmail_msg" href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>
<a moz-do-not-send="true" class="m_7768144006507966684moz-txt-link-freetext gmail_msg" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
</blockquote>
</div>
</blockquote>
</div>
</blockquote>
<br>
</body>
</html>