<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Oct 7, 2015, at 2:41 PM, Kuperstein, Michael M <<a href="mailto:michael.m.kuperstein@intel.com" class="">michael.m.kuperstein@intel.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Hi Fred,</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Sorry for the breakage, I realize how annoying this sort of thing is to debug. :-\</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>No worries, it wasn’t the most bizarre thing I had to debug lately :-)</div><br class=""><blockquote type="cite" class=""><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I'll try to figure out what to do about the assert. My first thought is that it may be overly conservative, and we should just be skipping CFI directives, regardless of whether they're marked FrameSetup.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Do you happen to have a testcase handy?</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>Not a reduced one that I could send out, sorry. And I don’t have much time right now to work on that. I would expect that if the first thing in the function is call, this should trigger quite easily. I should be able to work on a test case tomorrow. </div><br class=""><blockquote type="cite" class=""><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">To disable it on Darwin (are there other platforms that use compact_unwind?), the best place would be in X86CallFrameOptimization::isLegal().</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">In any case, even for Darwin, you only need to disable it if !MF.getMMI().getLandingPads().empty(), right?</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>As soon as you emit a GNU_ARGS_size CFI, it confuses the compact unwind emission, so I think we need to avoid getting into that case completely (if the compiler can’t synthesize compact unwind desc, the linker will give strange warnings). Does the above condition cover all these cases?</div><div><br class=""></div><div>Fred </div><br class=""><blockquote type="cite" class=""><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Michael</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">-----Original Message-----</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">From:<span class="Apple-converted-space"> </span></span><a href="mailto:friss@apple.com" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">friss@apple.com</a><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><span class="Apple-converted-space"> </span>[</span><a href="mailto:friss@apple.com" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">mailto:friss@apple.com</a><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">]<span class="Apple-converted-space"> </span></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Sent: Thursday, October 08, 2015 00:10</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">To: Kuperstein, Michael M</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Cc:<span class="Apple-converted-space"> </span></span><a href="mailto:llvm-commits@lists.llvm.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">llvm-commits@lists.llvm.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Subject: Re: [llvm] r249522 - [X86] Emit .cfi_escape GNU_ARGS_SIZE when adjusting the stack before calls</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Hi Michael,</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I just spent quite some time debugging an issue that should be fixed by that patch, unfortunately there are 2 issues with it:</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">- You can end up generating an args size directive right after the prologue, which means the assert in that function of DwarfDebug.cpp will sometimes fire:</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">static DebugLoc findPrologueEndLoc(const MachineFunction *MF) {</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""> // First known non-DBG_VALUE and non-frame setup location marks</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""> // the beginning of the function body.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""> for (const auto &MBB : *MF)</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">   for (const auto &MI : MBB)</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">     if (!MI.isDebugValue() && !MI.getFlag(MachineInstr::FrameSetup) &&</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">         MI.getDebugLoc()) {</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">       // Did the target forget to set the FrameSetup flag for CFI insns?</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">       assert(!MI.isCFIInstruction() &&</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">              "First non-frame-setup instruction is a CFI instruction.");</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">       return MI.getDebugLoc();</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">     }</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""> return DebugLoc();</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">}</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">- Darwin uses compact_unwind, and a dynamic SP during the function can’t really be described by that (because if you look at the code, we currently emit one compact unwind entry per function. Not sure if the runtime depends on that or if we could emit multiple ones). So the exception handling is still totally broken on Darwin.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">At least as a short-term thing, what’s the right place to just disable the push optimizations on Darwin (or maybe any platform that uses compact_unwind) when the function needs an EH description?</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Fred</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">On Oct 7, 2015, at 12:01 AM, Michael Kuperstein via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a>> wrote:<br class=""><br class="">Author: mkuper<br class="">Date: Wed Oct  7 02:01:31 2015<br class="">New Revision: 249522<br class=""><br class="">URL: <a href="http://llvm.org/viewvc/llvm-project?rev=249522&view=rev" class="">http://llvm.org/viewvc/llvm-project?rev=249522&view=rev</a><br class="">Log:<br class="">[X86] Emit .cfi_escape GNU_ARGS_SIZE when adjusting the stack before<span class="Apple-converted-space"> </span><br class="">calls<br class=""><br class="">When outgoing function arguments are passed using push instructions,<span class="Apple-converted-space"> </span><br class="">and EH is enabled, we may need to indicate to the stack unwinder that<span class="Apple-converted-space"> </span><br class="">the stack pointer was adjusted before the call.<br class=""><br class="">This should fix the exception handling issues in PR24792.<br class=""><br class="">Differential Revision: <a href="http://reviews.llvm.org/D13132" class="">http://reviews.llvm.org/D13132</a><br class=""><br class="">Added:<br class="">  llvm/trunk/test/CodeGen/X86/push-cfi-obj.ll<br class="">  llvm/trunk/test/CodeGen/X86/push-cfi.ll<br class="">Modified:<br class="">  llvm/trunk/include/llvm/MC/MCDwarf.h<br class="">  llvm/trunk/include/llvm/MC/MCStreamer.h<br class="">  llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp<br class="">  llvm/trunk/lib/MC/MCAsmStreamer.cpp<br class="">  llvm/trunk/lib/MC/MCDwarf.cpp<br class="">  llvm/trunk/lib/MC/MCStreamer.cpp<br class="">  llvm/trunk/lib/Target/X86/X86FrameLowering.cpp<br class=""><br class="">Modified: llvm/trunk/include/llvm/MC/MCDwarf.h<br class="">URL:<span class="Apple-converted-space"> </span><br class=""><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCDwarf" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCDwarf</a><br class="">.h?rev=249522&r1=249521&r2=249522&view=diff<br class="">======================================================================<br class="">========<br class="">--- llvm/trunk/include/llvm/MC/MCDwarf.h (original)<br class="">+++ llvm/trunk/include/llvm/MC/MCDwarf.h Wed Oct  7 02:01:31 2015<br class="">@@ -340,7 +340,8 @@ public:<br class="">   OpRestore,<br class="">   OpUndefined,<br class="">   OpRegister,<br class="">-    OpWindowSave<br class="">+    OpWindowSave,<br class="">+    OpGnuArgsSize<br class=""> };<br class=""><br class="">private:<br class="">@@ -454,6 +455,11 @@ public:<br class="">   return MCCFIInstruction(OpEscape, L, 0, 0, Vals);<br class=""> }<br class=""><br class="">+  /// \brief A special wrapper for .cfi_escape that indicates<span class="Apple-converted-space"> </span><br class="">+ GNU_ARGS_SIZE  static MCCFIInstruction createGnuArgsSize(MCSymbol *L, int Size) {<br class="">+    return MCCFIInstruction(OpGnuArgsSize, L, 0, Size, "");  }<br class="">+<br class=""> OpType getOperation() const { return Operation; }<br class=""> MCSymbol *getLabel() const { return Label; }<br class=""><br class="">@@ -473,7 +479,7 @@ public:<br class=""> int getOffset() const {<br class="">   assert(Operation == OpDefCfa || Operation == OpOffset ||<br class="">          Operation == OpRelOffset || Operation == OpDefCfaOffset ||<br class="">-           Operation == OpAdjustCfaOffset);<br class="">+           Operation == OpAdjustCfaOffset || Operation ==<span class="Apple-converted-space"> </span><br class="">+ OpGnuArgsSize);<br class="">   return Offset;<br class=""> }<br class=""><br class=""><br class="">Modified: llvm/trunk/include/llvm/MC/MCStreamer.h<br class="">URL:<span class="Apple-converted-space"> </span><br class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStrea<br class="">mer.h?rev=249522&r1=249521&r2=249522&view=diff<br class="">======================================================================<br class="">========<br class="">--- llvm/trunk/include/llvm/MC/MCStreamer.h (original)<br class="">+++ llvm/trunk/include/llvm/MC/MCStreamer.h Wed Oct  7 02:01:31 2015<br class="">@@ -661,6 +661,7 @@ public:<br class=""> virtual void EmitCFIRelOffset(int64_t Register, int64_t Offset);<br class=""> virtual void EmitCFIAdjustCfaOffset(int64_t Adjustment);<br class=""> virtual void EmitCFIEscape(StringRef Values);<br class="">+  virtual void EmitCFIGnuArgsSize(int64_t Size);<br class=""> virtual void EmitCFISignalFrame();<br class=""> virtual void EmitCFIUndefined(int64_t Register);<br class=""> virtual void EmitCFIRegister(int64_t Register1, int64_t Register2);<br class=""><br class="">Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp<br class="">URL:<span class="Apple-converted-space"> </span><br class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/<br class="">AsmPrinterDwarf.cpp?rev=249522&r1=249521&r2=249522&view=diff<br class="">======================================================================<br class="">========<br class="">--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp (original)<br class="">+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp Wed Oct  7<span class="Apple-converted-space"> </span><br class="">+++ 02:01:31 2015<br class="">@@ -246,6 +246,12 @@ void AsmPrinter::emitCFIInstruction(cons<br class=""> case MCCFIInstruction::OpSameValue:<br class="">   OutStreamer->EmitCFISameValue(Inst.getRegister());<br class="">   break;<br class="">+  case MCCFIInstruction::OpGnuArgsSize:<br class="">+    OutStreamer->EmitCFIGnuArgsSize(Inst.getOffset());<br class="">+    break;<br class="">+  case MCCFIInstruction::OpEscape:<br class="">+    OutStreamer->EmitCFIEscape(Inst.getValues());<br class="">+    break;<br class=""> }<br class="">}<br class=""><br class=""><br class="">Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp<br class="">URL:<span class="Apple-converted-space"> </span><br class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cp<br class="">p?rev=249522&r1=249521&r2=249522&view=diff<br class="">======================================================================<br class="">========<br class="">--- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original)<br class="">+++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Wed Oct  7 02:01:31 2015<br class="">@@ -29,6 +29,7 @@<br class="">#include "llvm/Support/ErrorHandling.h"<br class="">#include "llvm/Support/Format.h"<br class="">#include "llvm/Support/FormattedStream.h"<br class="">+#include "llvm/Support/LEB128.h"<br class="">#include "llvm/Support/MathExtras.h"<br class="">#include "llvm/Support/Path.h"<br class="">#include <cctype><br class="">@@ -210,6 +211,8 @@ public:<br class=""> void EmitCFISameValue(int64_t Register) override;<br class=""> void EmitCFIRelOffset(int64_t Register, int64_t Offset) override;<br class=""> void EmitCFIAdjustCfaOffset(int64_t Adjustment) override;<br class="">+  void EmitCFIEscape(StringRef Values) override;  void<span class="Apple-converted-space"> </span><br class="">+ EmitCFIGnuArgsSize(int64_t Size) override;<br class=""> void EmitCFISignalFrame() override;<br class=""> void EmitCFIUndefined(int64_t Register) override;<br class=""> void EmitCFIRegister(int64_t Register1, int64_t Register2) override;<span class="Apple-converted-space"> </span><br class="">@@ -1010,6 +1013,32 @@ void MCAsmStreamer::EmitCFIDefCfaOffset(<br class=""> EmitEOL();<br class="">}<br class=""><br class="">+static void PrintCFIEscape(llvm::formatted_raw_ostream &OS, StringRef<span class="Apple-converted-space"> </span><br class="">+Values) {<br class="">+  OS << "\t.cfi_escape ";<br class="">+  if (!Values.empty()) {<br class="">+    size_t e = Values.size() - 1;<br class="">+    for (size_t i = 0; i < e; ++i)<br class="">+      OS << format("0x%02x", uint8_t(Values[i])) << ", ";<br class="">+    OS << format("0x%02x", uint8_t(Values[e]));<br class="">+  }<br class="">+}<br class="">+<br class="">+void MCAsmStreamer::EmitCFIEscape(StringRef Values) {<br class="">+  MCStreamer::EmitCFIEscape(Values);<br class="">+  PrintCFIEscape(OS, Values);<br class="">+  EmitEOL();<br class="">+}<br class="">+<br class="">+void MCAsmStreamer::EmitCFIGnuArgsSize(int64_t Size) {<br class="">+  MCStreamer::EmitCFIGnuArgsSize(Size);<br class="">+  <br class="">+  uint8_t Buffer[16] = { dwarf::DW_CFA_GNU_args_size };  unsigned Len<span class="Apple-converted-space"> </span><br class="">+ = encodeULEB128(Size, Buffer + 1) + 1;<br class="">+  <br class="">+  PrintCFIEscape(OS, StringRef((const char *)&Buffer[0], Len));<br class="">+  EmitEOL();<br class="">+}<br class="">+<br class="">void MCAsmStreamer::EmitCFIDefCfaRegister(int64_t Register) {<br class=""> MCStreamer::EmitCFIDefCfaRegister(Register);<br class=""> OS << "\t.cfi_def_cfa_register ";<br class=""><br class="">Modified: llvm/trunk/lib/MC/MCDwarf.cpp<br class="">URL:<span class="Apple-converted-space"> </span><br class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=<br class="">249522&r1=249521&r2=249522&view=diff<br class="">======================================================================<br class="">========<br class="">--- llvm/trunk/lib/MC/MCDwarf.cpp (original)<br class="">+++ llvm/trunk/lib/MC/MCDwarf.cpp Wed Oct  7 02:01:31 2015<br class="">@@ -1147,6 +1147,11 @@ void FrameEmitterImpl::EmitCFIInstructio<br class="">   Streamer.EmitIntValue(dwarf::DW_CFA_restore | Reg, 1);<br class="">   return;<br class=""> }<br class="">+  case MCCFIInstruction::OpGnuArgsSize: {<br class="">+    Streamer.EmitIntValue(dwarf::DW_CFA_GNU_args_size, 1);<br class="">+    Streamer.EmitULEB128IntValue(Instr.getOffset());<br class="">+    return;<br class="">+  }<br class=""> case MCCFIInstruction::OpEscape:<br class="">   Streamer.EmitBytes(Instr.getValues());<br class="">   return;<br class=""><br class="">Modified: llvm/trunk/lib/MC/MCStreamer.cpp<br class="">URL:<span class="Apple-converted-space"> </span><br class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCStreamer.cpp?r<br class="">ev=249522&r1=249521&r2=249522&view=diff<br class="">======================================================================<br class="">========<br class="">--- llvm/trunk/lib/MC/MCStreamer.cpp (original)<br class="">+++ llvm/trunk/lib/MC/MCStreamer.cpp Wed Oct  7 02:01:31 2015<br class="">@@ -359,6 +359,14 @@ void MCStreamer::EmitCFIEscape(StringRef<br class=""> CurFrame->Instructions.push_back(Instruction);<br class="">}<br class=""><br class="">+void MCStreamer::EmitCFIGnuArgsSize(int64_t Size) {<br class="">+  MCSymbol *Label = EmitCFICommon();<br class="">+  MCCFIInstruction Instruction =<span class="Apple-converted-space"> </span><br class="">+    MCCFIInstruction::createGnuArgsSize(Label, Size);<br class="">+  MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();<br class="">+  CurFrame->Instructions.push_back(Instruction);<br class="">+}<br class="">+<br class="">void MCStreamer::EmitCFISignalFrame() {<br class=""> EnsureValidDwarfFrame();<br class=""> MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();<br class=""><br class="">Modified: llvm/trunk/lib/Target/X86/X86FrameLowering.cpp<br class="">URL:<span class="Apple-converted-space"> </span><br class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Frame<br class="">Lowering.cpp?rev=249522&r1=249521&r2=249522&view=diff<br class="">======================================================================<br class="">========<br class="">--- llvm/trunk/lib/Target/X86/X86FrameLowering.cpp (original)<br class="">+++ llvm/trunk/lib/Target/X86/X86FrameLowering.cpp Wed Oct  7 02:01:31<span class="Apple-converted-space"> </span><br class="">+++ 2015<br class="">@@ -2073,8 +2073,6 @@ eliminateCallFramePseudoInstr(MachineFun<br class="">   // If the stack pointer can be changed after prologue, turn the<br class="">   // adjcallstackup instruction into a 'sub ESP, <amt>' and the<br class="">   // adjcallstackdown instruction into 'add ESP, <amt>'<br class="">-    if (Amount == 0)<br class="">-      return;<br class=""><br class="">   // We need to keep the stack aligned properly.  To do this, we round the<br class="">   // amount of space needed for the outgoing arguments up to the<span class="Apple-converted-space"> </span><br class="">next @@ -2082,6 +2080,25 @@ eliminateCallFramePseudoInstr(MachineFun<br class="">   unsigned StackAlign = getStackAlignment();<br class="">   Amount = RoundUpToAlignment(Amount, StackAlign);<br class=""><br class="">+    // If we have any exception handlers in this function, and we adjust<br class="">+    // the SP before calls, we may need to indicate this to the unwinder,<br class="">+    // using GNU_ARGS_SIZE. Note that this may be necessary<br class="">+    // even when Amount == 0, because the preceding function may have<br class="">+    // set a non-0 GNU_ARGS_SIZE.<br class="">+    // TODO: We don't need to reset this between subsequent functions,<br class="">+    // if it didn't change.<br class="">+    bool HasDwarfEHHandlers =<br class="">+      !MF.getTarget().getMCAsmInfo()->usesWindowsCFI() &&<br class="">+      !MF.getMMI().getLandingPads().empty();<br class="">+<br class="">+    if (HasDwarfEHHandlers && !isDestroy &&<span class="Apple-converted-space"> </span><br class="">+        MF.getInfo<X86MachineFunctionInfo>()->getHasPushSequences())<br class="">+      BuildCFI(MBB, I, DL,<br class="">+               MCCFIInstruction::createGnuArgsSize(nullptr, Amount));<br class="">+<br class="">+    if (Amount == 0)<br class="">+      return;<br class="">+<br class="">   // Factor out the amount that gets handled inside the sequence<br class="">   // (Pushes of argument for frame setup, callee pops for frame destroy)<br class="">   Amount -= InternalAmt;<br class=""><br class="">Added: llvm/trunk/test/CodeGen/X86/push-cfi-obj.ll<br class="">URL:<span class="Apple-converted-space"> </span><br class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/push-c<br class="">fi-obj.ll?rev=249522&view=auto<span class="Apple-converted-space"> </span><br class="">======================================================================<br class="">========<br class="">--- llvm/trunk/test/CodeGen/X86/push-cfi-obj.ll (added)<br class="">+++ llvm/trunk/test/CodeGen/X86/push-cfi-obj.ll Wed Oct  7 02:01:31<span class="Apple-converted-space"> </span><br class="">+++ 2015<br class="">@@ -0,0 +1,38 @@<br class="">+; RUN: llc < %s -mtriple=i686-pc-linux -filetype=obj | llvm-readobj<span class="Apple-converted-space"> </span><br class="">+-s -sr -sd | FileCheck %s<br class="">+<br class="">+; CHECK:         Index: 8<br class="">+; CHECK-NEXT:    Name: .eh_frame (41)<br class="">+; CHECK-NEXT:    Type: SHT_PROGBITS (0x1)<br class="">+; CHECK-NEXT:    Flags [ (0x2)<br class="">+; CHECK-NEXT:      SHF_ALLOC (0x2)<br class="">+; CHECK-NEXT:    ]<br class="">+; CHECK-NEXT:    Address: 0x0<br class="">+; CHECK-NEXT:    Offset: 0x64<br class="">+; CHECK-NEXT:    Size: 60<br class="">+; CHECK-NEXT:    Link: 0<br class="">+; CHECK-NEXT:    Info: 0<br class="">+; CHECK-NEXT:    AddressAlignment: 4<br class="">+; CHECK-NEXT:    EntrySize: 0<br class="">+; CHECK-NEXT:    Relocations [<br class="">+; CHECK-NEXT:    ]<br class="">+; CHECK-NEXT:    SectionData (<br class="">+; CHECK-NEXT:      0000: 1C000000 00000000 017A504C 5200017C  |.........zPLR..||<br class="">+; CHECK-NEXT:      0010: 08070000 00000000 1B0C0404 88010000  |................|<br class="">+; CHECK-NEXT:      0020: 18000000 24000000 00000000 19000000  |....$...........|<br class="">+; CHECK-NEXT:      0030: 04000000 00430E10 2E100000           |.....C......|<br class="">+; CHECK-NEXT:    )<br class="">+<br class="">+declare i32 @__gxx_personality_v0(...) declare void @good(i32 %a, i32<span class="Apple-converted-space"> </span><br class="">+%b, i32 %c, i32 %d)<br class="">+<br class="">+define void @test() optsize personality i8* bitcast (i32 (...)*<span class="Apple-converted-space"> </span><br class="">+@__gxx_personality_v0 to i8*) {<br class="">+entry:<br class="">+  invoke void @good(i32 1, i32 2, i32 3, i32 4)<br class="">+          to label %continue unwind label %cleanup<br class="">+continue:<br class="">+  ret void<br class="">+cleanup:  <br class="">+  landingpad { i8*, i32 }<br class="">+     cleanup<br class="">+  ret void<br class="">+}<br class=""><br class="">Added: llvm/trunk/test/CodeGen/X86/push-cfi.ll<br class="">URL:<span class="Apple-converted-space"> </span><br class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/push-c<br class="">fi.ll?rev=249522&view=auto<span class="Apple-converted-space"> </span><br class="">======================================================================<br class="">========<br class="">--- llvm/trunk/test/CodeGen/X86/push-cfi.ll (added)<br class="">+++ llvm/trunk/test/CodeGen/X86/push-cfi.ll Wed Oct  7 02:01:31 2015<br class="">@@ -0,0 +1,143 @@<br class="">+; RUN: llc < %s -mtriple=i686-pc-linux | FileCheck %s<br class="">+<br class="">+declare i32 @__gxx_personality_v0(...) declare void @good(i32 %a, i32<span class="Apple-converted-space"> </span><br class="">+%b, i32 %c, i32 %d) declare void @large(i32 %a, i32 %b, i32 %c, i32<span class="Apple-converted-space"> </span><br class="">+%d, i32 %e, i32 %f) declare void @empty()<br class="">+<br class="">+; We use an invoke, and expect a .cfi_escape GNU_ARGS_SIZE with size<span class="Apple-converted-space"> </span><br class="">+16 ; before the invocation ; CHECK-LABEL: test1:<br class="">+; CHECK: .cfi_escape 0x2e, 0x10<br class="">+; CHECK-NEXT: pushl   $4<br class="">+; CHECK-NEXT: pushl   $3<br class="">+; CHECK-NEXT: pushl   $2<br class="">+; CHECK-NEXT: pushl   $1<br class="">+; CHECK-NEXT: call<br class="">+; CHECK-NEXT: addl $16, %esp<br class="">+define void @test1() optsize personality i8* bitcast (i32 (...)*<span class="Apple-converted-space"> </span><br class="">+@__gxx_personality_v0 to i8*) {<br class="">+entry:<br class="">+  invoke void @good(i32 1, i32 2, i32 3, i32 4)<br class="">+          to label %continue unwind label %cleanup<br class="">+continue:<br class="">+  ret void<br class="">+cleanup:  <br class="">+  landingpad { i8*, i32 }<br class="">+     cleanup<br class="">+  ret void<br class="">+}<br class="">+<br class="">+; If the function has no handlers, we don't need to generate<span class="Apple-converted-space"> </span><br class="">+GNU_ARGS_SIZE, ; even if it has an unwind table.<br class="">+; CHECK-LABEL: test2:<br class="">+; CHECK-NOT: .cfi_escape<br class="">+; CHECK: pushl   $4<br class="">+; CHECK-NEXT: pushl   $3<br class="">+; CHECK-NEXT: pushl   $2<br class="">+; CHECK-NEXT: pushl   $1<br class="">+; CHECK-NEXT: call<br class="">+; CHECK-NEXT: addl $16, %esp<br class="">+define void @test2() optsize personality i8* bitcast (i32 (...)*<span class="Apple-converted-space"> </span><br class="">+@__gxx_personality_v0 to i8*) {<br class="">+entry:<br class="">+  call void @good(i32 1, i32 2, i32 3, i32 4)<br class="">+  ret void<br class="">+}<br class="">+<br class="">+; If we did not end up using any pushes, no need for GNU_ARGS_SIZE<span class="Apple-converted-space"> </span><br class="">+anywhere ; CHECK-LABEL: test3:<br class="">+; CHECK-NOT: .cfi_escape<br class="">+; CHECK-NOT: pushl<br class="">+; CHECK: retl<br class="">+define void @test3() optsize personality i8* bitcast (i32 (...)*<span class="Apple-converted-space"> </span><br class="">+@__gxx_personality_v0 to i8*) {<br class="">+entry:<br class="">+  invoke void @empty()<br class="">+          to label %continue unwind label %cleanup<br class="">+continue:<br class="">+  ret void<br class="">+cleanup:  <br class="">+  landingpad { i8*, i32 }<br class="">+     cleanup<br class="">+  ret void<br class="">+}<br class="">+<br class="">+; Different sized stacks need different GNU_ARGS_SIZEs ; CHECK-LABEL:<span class="Apple-converted-space"> </span><br class="">+test4:<br class="">+; CHECK: .cfi_escape 0x2e, 0x10<br class="">+; CHECK-NEXT: pushl   $4<br class="">+; CHECK-NEXT: pushl   $3<br class="">+; CHECK-NEXT: pushl   $2<br class="">+; CHECK-NEXT: pushl   $1<br class="">+; CHECK-NEXT: call<br class="">+; CHECK-NEXT: addl $16, %esp<br class="">+; CHECK: .cfi_escape 0x2e, 0x20<br class="">+; CHECK-NEXT: subl    $8, %esp<br class="">+; CHECK-NEXT: pushl   $11<br class="">+; CHECK-NEXT: pushl   $10<br class="">+; CHECK-NEXT: pushl   $9<br class="">+; CHECK-NEXT: pushl   $8<br class="">+; CHECK-NEXT: pushl   $7<br class="">+; CHECK-NEXT: pushl   $6<br class="">+; CHECK-NEXT: calll   large<br class="">+; CHECK-NEXT: addl $32, %esp<br class="">+define void @test4() optsize personality i8* bitcast (i32 (...)*<span class="Apple-converted-space"> </span><br class="">+@__gxx_personality_v0 to i8*) {<br class="">+entry:<br class="">+  invoke void @good(i32 1, i32 2, i32 3, i32 4)<br class="">+          to label %continue1 unwind label %cleanup<br class="">+continue1:<br class="">+  invoke void @large(i32 6, i32 7, i32 8, i32 9, i32 10, i32 11)<br class="">+          to label %continue2 unwind label %cleanup<br class="">+continue2:<br class="">+  ret void          <br class="">+cleanup:  <br class="">+  landingpad { i8*, i32 }<br class="">+     cleanup<br class="">+  ret void<br class="">+}<br class="">+<br class="">+; If we did use pushes, we need to reset GNU_ARGS_SIZE before a call<span class="Apple-converted-space"> </span><br class="">+; without parameters ; CHECK-LABEL: test5:<br class="">+; CHECK: .cfi_escape 0x2e, 0x10<br class="">+; CHECK-NEXT: pushl   $4<br class="">+; CHECK-NEXT: pushl   $3<br class="">+; CHECK-NEXT: pushl   $2<br class="">+; CHECK-NEXT: pushl   $1<br class="">+; CHECK-NEXT: call<br class="">+; CHECK-NEXT: addl $16, %esp<br class="">+; CHECK: .cfi_escape 0x2e, 0x00<br class="">+; CHECK-NEXT: call<br class="">+define void @test5() optsize personality i8* bitcast (i32 (...)*<span class="Apple-converted-space"> </span><br class="">+@__gxx_personality_v0 to i8*) {<br class="">+entry:<br class="">+  invoke void @good(i32 1, i32 2, i32 3, i32 4)<br class="">+          to label %continue1 unwind label %cleanup<br class="">+continue1:<br class="">+  invoke void @empty()<br class="">+          to label %continue2 unwind label %cleanup<br class="">+continue2:<br class="">+  ret void          <br class="">+cleanup:  <br class="">+  landingpad { i8*, i32 }<br class="">+     cleanup<br class="">+  ret void<br class="">+}<br class="">+<br class="">+; This is actually inefficient - we don't need to repeat the .cfi_escape twice.<br class="">+; CHECK-LABEL: test6:<br class="">+; CHECK: .cfi_escape 0x2e, 0x10<br class="">+; CHECK: call<br class="">+; CHECK: .cfi_escape 0x2e, 0x10<br class="">+; CHECK: call<br class="">+define void @test6() optsize personality i8* bitcast (i32 (...)*<span class="Apple-converted-space"> </span><br class="">+@__gxx_personality_v0 to i8*) {<br class="">+entry:<br class="">+  invoke void @good(i32 1, i32 2, i32 3, i32 4)<br class="">+          to label %continue1 unwind label %cleanup<br class="">+continue1:<br class="">+  invoke void @good(i32 5, i32 6, i32 7, i32 8)<br class="">+          to label %continue2 unwind label %cleanup<br class="">+continue2:<br class="">+  ret void          <br class="">+cleanup:  <br class="">+  landingpad { i8*, i32 }<br class="">+     cleanup<br class="">+  ret void<br class="">+}<br class=""><br class=""><br class="">_______________________________________________<br class="">llvm-commits mailing list<br class="">llvm-commits@lists.llvm.org<br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">---------------------------------------------------------------------</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Intel Israel (74) Limited</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">This e-mail and any attachments may contain confidential material for</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">the sole use of the intended recipient(s). Any review or distribution</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">by others is strictly prohibited. If you are not the intended</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">recipient, please contact the sender and delete all copies.</span></div></blockquote></div><br class=""></body></html>