diff options
| author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-08-10 20:19:17 +0000 |
|---|---|---|
| committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-08-10 20:19:17 +0000 |
| commit | 0a99062cf6f96673836afdc4580c74e6c3c72836 (patch) | |
| tree | ab96702d06e1ed8328a7b86f22ff873e76cf00ed /llvm/lib/CodeGen/EarlyIfConversion.cpp | |
| parent | 0954d4199a2387b23234a60cf4cd4b4854ce6f71 (diff) | |
| download | bcm5719-llvm-0a99062cf6f96673836afdc4580c74e6c3c72836.tar.gz bcm5719-llvm-0a99062cf6f96673836afdc4580c74e6c3c72836.zip | |
Add getTPred() and getFPred() functions.
They identify the PHI predecessors in both diamonds and triangles.
llvm-svn: 161689
Diffstat (limited to 'llvm/lib/CodeGen/EarlyIfConversion.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/EarlyIfConversion.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/EarlyIfConversion.cpp b/llvm/lib/CodeGen/EarlyIfConversion.cpp index b7ad8a429e5..3b7f8796cd3 100644 --- a/llvm/lib/CodeGen/EarlyIfConversion.cpp +++ b/llvm/lib/CodeGen/EarlyIfConversion.cpp @@ -96,6 +96,12 @@ public: /// 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 @@ bool SSAIfConv::canConvertIf(MachineBasicBlock *MBB) { // 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); |

