[PATCH] D67832: [IfConversion] Disallow TBB == FBB for valid triangles

Mikael Holmén via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 25 23:34:20 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL372943:  [IfConversion] Disallow TBB == FBB for valid triangles (authored by uabelho, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D67832?vs=221719&id=221890#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67832/new/

https://reviews.llvm.org/D67832

Files:
  llvm/trunk/lib/CodeGen/IfConversion.cpp
  llvm/trunk/test/CodeGen/ARM/ifcvt_triangleSameCvtNext.mir


Index: llvm/trunk/test/CodeGen/ARM/ifcvt_triangleSameCvtNext.mir
===================================================================
--- llvm/trunk/test/CodeGen/ARM/ifcvt_triangleSameCvtNext.mir
+++ llvm/trunk/test/CodeGen/ARM/ifcvt_triangleSameCvtNext.mir
@@ -0,0 +1,29 @@
+# RUN: llc -mtriple=arm-apple-ios -run-pass=if-converter -verify-machineinstrs %s -o - | FileCheck %s
+...
+---
+name:            foo
+body:             |
+  bb.0:
+    Bcc %bb.2, 1, $cpsr
+
+  bb.1:
+    $sp = tADDspi $sp, 2, 14, _
+    B %bb.1
+
+  bb.2:
+    Bcc %bb.3, 0, $cpsr
+    B %bb.2
+
+  bb.3:
+    Bcc %bb.1, 1, $cpsr
+    B %bb.1
+...
+
+# Both branches in bb.3 jump to bb.1. IfConversion shouldn't treat this as a
+# tringle and insert the tADDspi in bb3, but leave it as it is.
+
+# CHECK:     bb.3:
+# CHECK:       successors: %bb.1
+# CHECK-NOT:   tADDspi
+# CHECK:       Bcc %bb.1, 1, $cpsr
+# CHECK:       B %bb.1
Index: llvm/trunk/lib/CodeGen/IfConversion.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/IfConversion.cpp
+++ llvm/trunk/lib/CodeGen/IfConversion.cpp
@@ -569,6 +569,9 @@
                                 bool FalseBranch, unsigned &Dups,
                                 BranchProbability Prediction) const {
   Dups = 0;
+  if (TrueBBI.BB == FalseBBI.BB)
+    return false;
+
   if (TrueBBI.IsBeingAnalyzed || TrueBBI.IsDone)
     return false;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67832.221890.patch
Type: text/x-patch
Size: 1409 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190926/eb74103d/attachment.bin>


More information about the llvm-commits mailing list