[llvm-commits] [llvm] r161689 - /llvm/trunk/lib/CodeGen/EarlyIfConversion.cpp
Jakob Stoklund Olesen
stoklund at 2pi.dk
Fri Aug 10 13:19:17 PDT 2012
Author: stoklund
Date: Fri Aug 10 15:19:17 2012
New Revision: 161689
URL: http://llvm.org/viewvc/llvm-project?rev=161689&view=rev
Log:
Add getTPred() and getFPred() functions.
They identify the PHI predecessors in both diamonds and triangles.
Modified:
llvm/trunk/lib/CodeGen/EarlyIfConversion.cpp
Modified: llvm/trunk/lib/CodeGen/EarlyIfConversion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/EarlyIfConversion.cpp?rev=161689&r1=161688&r2=161689&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/EarlyIfConversion.cpp (original)
+++ llvm/trunk/lib/CodeGen/EarlyIfConversion.cpp Fri Aug 10 15:19:17 2012
@@ -96,6 +96,12 @@
/// equal to Tail.
bool isTriangle() const { return TBB == Tail || FBB == Tail; }
+ /// Returns the Tail predecessor for the True side.
+ MachineBasicBlock *getTPred() const { return TBB == Tail ? Head : TBB; }
+
+ /// Returns the Tail predecessor for the False side.
+ MachineBasicBlock *getFPred() const { return FBB == Tail ? Head : FBB; }
+
/// Information about each phi in the Tail block.
struct PHIInfo {
MachineInstr *PHI;
@@ -391,8 +397,8 @@
// Any phis in the tail block must be convertible to selects.
PHIs.clear();
- MachineBasicBlock *TPred = TBB == Tail ? Head : TBB;
- MachineBasicBlock *FPred = FBB == Tail ? Head : FBB;
+ MachineBasicBlock *TPred = getTPred();
+ MachineBasicBlock *FPred = getFPred();
for (MachineBasicBlock::iterator I = Tail->begin(), E = Tail->end();
I != E && I->isPHI(); ++I) {
PHIs.push_back(&*I);
More information about the llvm-commits
mailing list