<div dir="ltr">Ah, sorry - yeah, if it's just for debug dumping/printing, I don't think we generally test that. I hadn't looked that closely to see/think about that being the case here. I'll leave it up to you if you reckon it's useful, etc. (if there are non-complier-debugging uses of the function, etc)</div><br><div class="gmail_quote"><div dir="ltr">On Tue, Feb 28, 2017 at 4:19 PM Ahmed Bougacha <<a href="mailto:ahmed.bougacha@gmail.com">ahmed.bougacha@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, Feb 27, 2017 at 9:45 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="gmail_msg" target="_blank">dblaikie@gmail.com</a>> wrote:<br class="gmail_msg">
> Adding untested functionality isn't usually the best idea. Please include<br class="gmail_msg">
> functionality when it is testable, and with tests.<br class="gmail_msg">
<br class="gmail_msg">
I'm not convinced it's very useful to test this (I guess it depends on<br class="gmail_msg">
whether one views debug printing as "functionality").<br class="gmail_msg">
<br class="gmail_msg">
But I was curious, so I tried! <a href="https://reviews.llvm.org/D30480" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/D30480</a><br class="gmail_msg">
<br class="gmail_msg">
-Ahmed<br class="gmail_msg">
<br class="gmail_msg">
> (also: explaining why something is done, not just what is done, is helpful<br class="gmail_msg">
> for context/understanding, etc)<br class="gmail_msg">
><br class="gmail_msg">
> On Thu, Feb 23, 2017 at 11:29 AM Ahmed Bougacha via llvm-commits<br class="gmail_msg">
> <<a href="mailto:llvm-commits@lists.llvm.org" class="gmail_msg" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br class="gmail_msg">
>><br class="gmail_msg">
>> Author: ab<br class="gmail_msg">
>> Date: Thu Feb 23 13:17:31 2017<br class="gmail_msg">
>> New Revision: 296007<br class="gmail_msg">
>><br class="gmail_msg">
>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=296007&view=rev" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project?rev=296007&view=rev</a><br class="gmail_msg">
>> Log:<br class="gmail_msg">
>> [CodeGen] Add a way to SkipDebugLoc in MachineInstr::print(). NFC.<br class="gmail_msg">
>><br class="gmail_msg">
>> Modified:<br class="gmail_msg">
>> llvm/trunk/include/llvm/CodeGen/MachineInstr.h<br class="gmail_msg">
>> llvm/trunk/lib/CodeGen/MachineInstr.cpp<br class="gmail_msg">
>><br class="gmail_msg">
>> Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h<br class="gmail_msg">
>> URL:<br class="gmail_msg">
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstr.h?rev=296007&r1=296006&r2=296007&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstr.h?rev=296007&r1=296006&r2=296007&view=diff</a><br class="gmail_msg">
>><br class="gmail_msg">
>> ==============================================================================<br class="gmail_msg">
>> --- llvm/trunk/include/llvm/CodeGen/MachineInstr.h (original)<br class="gmail_msg">
>> +++ llvm/trunk/include/llvm/CodeGen/MachineInstr.h Thu Feb 23 13:17:31<br class="gmail_msg">
>> 2017<br class="gmail_msg">
>> @@ -1149,9 +1149,10 @@ public:<br class="gmail_msg">
>> //<br class="gmail_msg">
>> // Debugging support<br class="gmail_msg">
>> //<br class="gmail_msg">
>> - void print(raw_ostream &OS, bool SkipOpers = false,<br class="gmail_msg">
>> + void print(raw_ostream &OS, bool SkipOpers = false, bool SkipDebugLoc =<br class="gmail_msg">
>> false,<br class="gmail_msg">
>> const TargetInstrInfo *TII = nullptr) const;<br class="gmail_msg">
>> void print(raw_ostream &OS, ModuleSlotTracker &MST, bool SkipOpers =<br class="gmail_msg">
>> false,<br class="gmail_msg">
>> + bool SkipDebugLoc = false,<br class="gmail_msg">
>> const TargetInstrInfo *TII = nullptr) const;<br class="gmail_msg">
>> void dump() const;<br class="gmail_msg">
>><br class="gmail_msg">
>><br class="gmail_msg">
>> Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp<br class="gmail_msg">
>> URL:<br class="gmail_msg">
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=296007&r1=296006&r2=296007&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=296007&r1=296006&r2=296007&view=diff</a><br class="gmail_msg">
>><br class="gmail_msg">
>> ==============================================================================<br class="gmail_msg">
>> --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original)<br class="gmail_msg">
>> +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Thu Feb 23 13:17:31 2017<br class="gmail_msg">
>> @@ -1699,7 +1699,7 @@ LLVM_DUMP_METHOD void MachineInstr::dump<br class="gmail_msg">
>> }<br class="gmail_msg">
>> #endif<br class="gmail_msg">
>><br class="gmail_msg">
>> -void MachineInstr::print(raw_ostream &OS, bool SkipOpers,<br class="gmail_msg">
>> +void MachineInstr::print(raw_ostream &OS, bool SkipOpers, bool<br class="gmail_msg">
>> SkipDebugLoc,<br class="gmail_msg">
>> const TargetInstrInfo *TII) const {<br class="gmail_msg">
>> const Module *M = nullptr;<br class="gmail_msg">
>> if (const MachineBasicBlock *MBB = getParent())<br class="gmail_msg">
>> @@ -1707,11 +1707,12 @@ void MachineInstr::print(raw_ostream &OS<br class="gmail_msg">
>> M = MF->getFunction()->getParent();<br class="gmail_msg">
>><br class="gmail_msg">
>> ModuleSlotTracker MST(M);<br class="gmail_msg">
>> - print(OS, MST, SkipOpers, TII);<br class="gmail_msg">
>> + print(OS, MST, SkipOpers, SkipDebugLoc, TII);<br class="gmail_msg">
>> }<br class="gmail_msg">
>><br class="gmail_msg">
>> void MachineInstr::print(raw_ostream &OS, ModuleSlotTracker &MST,<br class="gmail_msg">
>> - bool SkipOpers, const TargetInstrInfo *TII)<br class="gmail_msg">
>> const {<br class="gmail_msg">
>> + bool SkipOpers, bool SkipDebugLoc,<br class="gmail_msg">
>> + const TargetInstrInfo *TII) const {<br class="gmail_msg">
>> // We can be a bit tidier if we know the MachineFunction.<br class="gmail_msg">
>> const MachineFunction *MF = nullptr;<br class="gmail_msg">
>> const TargetRegisterInfo *TRI = nullptr;<br class="gmail_msg">
>> @@ -1987,7 +1988,7 @@ void MachineInstr::print(raw_ostream &OS<br class="gmail_msg">
>> }<br class="gmail_msg">
>> if (isIndirectDebugValue())<br class="gmail_msg">
>> OS << " indirect";<br class="gmail_msg">
>> - } else if (debugLoc && MF) {<br class="gmail_msg">
>> + } else if (debugLoc && MF && !SkipDebugLoc) {<br class="gmail_msg">
>> if (!HaveSemi)<br class="gmail_msg">
>> OS << ";";<br class="gmail_msg">
>> OS << " dbg:";<br class="gmail_msg">
>><br class="gmail_msg">
>><br class="gmail_msg">
>> _______________________________________________<br class="gmail_msg">
>> llvm-commits mailing list<br class="gmail_msg">
>> <a href="mailto:llvm-commits@lists.llvm.org" class="gmail_msg" target="_blank">llvm-commits@lists.llvm.org</a><br class="gmail_msg">
>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br class="gmail_msg">
</blockquote></div>