<div dir="ltr"><div style="font-size:12.8px">I was hoping to get feedback on this proposal formatted as a patch. I'd like to teach AnalyzeBranch to handle conditional returns on PPC, but the currently documented API for AnalyzeBranch doesn't support it.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I propose the following enhancement to the API so that I can teach AnalyzeBranch about conditional return instructions.</div><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Kyle Butt</b> <span dir="ltr"><<a href="mailto:kyle%2Bllvm@iteratee.net">kyle+llvm@iteratee.net</a>></span><br>Date: Tue, May 31, 2016 at 4:07 PM<br>Subject: [PATCH] D20841: TII: Add documentation about conditional exits. NFC<br>To: <a href="mailto:kyle%2Bllvm@iteratee.net">kyle+llvm@iteratee.net</a><br>Cc: <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br><br><br>iteratee created this revision.<br>
iteratee added a subscriber: llvm-commits.<br>
iteratee set the repository for this revision to rL LLVM.<br>
<br>
Currently the documented API for AnalyzeBranch leaves no place for<br>
conditional returns. This leaves a blindspot after shrinkwrapping on<br>
platforms with conditional return instructions.<br>
<br>
The existing API can be used to handle conditional returns by using a null TBB<br>
and a non-empty condition list. A null TBB should never mean fallthrough with a<br>
non-empty condition list, as that wouldn't make any sense. This leaves a<br>
natural way to represent conditional return branches.<br>
<br>
Next up is to add support to PPC for AnalyzeBranch and conditional<br>
return.<br>
<br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="http://reviews.llvm.org/D20841" rel="noreferrer" class="gmail-cremed cremed">http://reviews.llvm.org/D20841</a><br>
<br>
Files:<br>
  include/llvm/Target/TargetInstrInfo.h<br>
<br>
Index: include/llvm/Target/TargetInstrInfo.h<br>
===================================================================<br>
--- include/llvm/Target/TargetInstrInfo.h<br>
+++ include/llvm/Target/TargetInstrInfo.h<br>
@@ -458,6 +458,13 @@<br>
   ///    'false' destination in FBB, and a list of operands that evaluate the<br>
   ///    condition.  These operands can be passed to other TargetInstrInfo<br>
   ///    methods to create new branches.<br>
+  /// 5. If this block ends with a conditional ret with fallthrough, it returns<br>
+  ///    null for TBB and FBB and returns a non-empty list of operands that<br>
+  ///    evaluate the condition. These operands can be used to create new<br>
+  ///    branches.<br>
+  /// 6. If the block ends with a conditional return followed by an<br>
+  ///    unconditional branch, the 'false' destination is FBB, while TBB is<br>
+  ///    null. Cond is non-empty as above.<br>
   ///<br>
   /// Note that RemoveBranch and InsertBranch must be implemented to support<br>
   /// cases where this method returns success.<br>
<br>
<br>
</div><br></div>