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 | 870da6de2c3f3f40360e04882b9ddf42ded0930a (patch) | |
tree | 2de4eaeaf15b59206ce4b0ac31d9dedc3aa7c2c5 /lib/CodeGen | |
parent | 8828c4ccd44cb49d13360cf86fd0b963f211f03f (diff) | |
download | external_llvm-870da6de2c3f3f40360e04882b9ddf42ded0930a.zip external_llvm-870da6de2c3f3f40360e04882b9ddf42ded0930a.tar.gz external_llvm-870da6de2c3f3f40360e04882b9ddf42ded0930a.tar.bz2 |
Add getTPred() and getFPred() functions.
They identify the PHI predecessors in both diamonds and triangles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161689 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/EarlyIfConversion.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/CodeGen/EarlyIfConversion.cpp b/lib/CodeGen/EarlyIfConversion.cpp index b7ad8a4..3b7f879 100644 --- a/lib/CodeGen/EarlyIfConversion.cpp +++ b/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); |