[llvm-branch-commits] [llvm-branch] r182431 - Merging r182385:

Bill Wendling isanbard at gmail.com
Tue May 21 15:11:12 PDT 2013


Author: void
Date: Tue May 21 17:11:11 2013
New Revision: 182431

URL: http://llvm.org/viewvc/llvm-project?rev=182431&view=rev
Log:
Merging r182385:
------------------------------------------------------------------------
r182385 | hfinkel | 2013-05-21 07:21:09 -0700 (Tue, 21 May 2013) | 9 lines

Fix PPC branch selection for counter-based branches

Although I had added some support for the BDZ/BDNZ branches into the selector
(in r158204), I had not correctly adjusted the condition at the top of the
loop. As a result, these branches were still essentially unsupported.

This fixes PR16086. Unfortunately, any test case would be very large (because
it would need to force the loop backedge to exceed the range of the 16-bit
immediate).
------------------------------------------------------------------------

Modified:
    llvm/branches/release_33/   (props changed)
    llvm/branches/release_33/lib/Target/PowerPC/PPCBranchSelector.cpp

Propchange: llvm/branches/release_33/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 21 17:11:11 2013
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,181286,181296,181313,181397,181423,181450,181524,181529,181540,181576-181580,181586,181600,181678,181706,181792,181800,181842,181864,182072,182112-182113,182344,182364,182387
+/llvm/trunk:155241,181286,181296,181313,181397,181423,181450,181524,181529,181540,181576-181580,181586,181600,181678,181706,181792,181800,181842,181864,182072,182112-182113,182344,182364,182385,182387

Modified: llvm/branches/release_33/lib/Target/PowerPC/PPCBranchSelector.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_33/lib/Target/PowerPC/PPCBranchSelector.cpp?rev=182431&r1=182430&r2=182431&view=diff
==============================================================================
--- llvm/branches/release_33/lib/Target/PowerPC/PPCBranchSelector.cpp (original)
+++ llvm/branches/release_33/lib/Target/PowerPC/PPCBranchSelector.cpp Tue May 21 17:11:11 2013
@@ -112,15 +112,21 @@ bool PPCBSel::runOnMachineFunction(Machi
       unsigned MBBStartOffset = 0;
       for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end();
            I != E; ++I) {
-        if (I->getOpcode() != PPC::BCC || I->getOperand(2).isImm()) {
+        MachineBasicBlock *Dest = 0;
+        if (I->getOpcode() == PPC::BCC && !I->getOperand(2).isImm())
+          Dest = I->getOperand(2).getMBB();
+        else if ((I->getOpcode() == PPC::BDNZ8 || I->getOpcode() == PPC::BDNZ ||
+                  I->getOpcode() == PPC::BDZ8  || I->getOpcode() == PPC::BDZ) &&
+                 !I->getOperand(0).isImm())
+          Dest = I->getOperand(0).getMBB();
+
+        if (!Dest) {
           MBBStartOffset += TII->GetInstSizeInBytes(I);
           continue;
         }
         
         // Determine the offset from the current branch to the destination
         // block.
-        MachineBasicBlock *Dest = I->getOperand(2).getMBB();
-        
         int BranchSize;
         if (Dest->getNumber() <= MBB.getNumber()) {
           // If this is a backwards branch, the delta is the offset from the





More information about the llvm-branch-commits mailing list