[Mesa-dev] [PATCH 02/12] R600/structurizer: improve PHI value finding

Christian König deathsimple at vodafone.de
Tue Feb 12 09:13:14 PST 2013


From: Christian König <christian.koenig at amd.com>

Using the new NearestCommonDominator class.

Signed-off-by: Christian König <christian.koenig at amd.com>
---
 lib/Target/R600/AMDGPUStructurizeCFG.cpp |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/Target/R600/AMDGPUStructurizeCFG.cpp b/lib/Target/R600/AMDGPUStructurizeCFG.cpp
index ad628c1..eb63e55 100644
--- a/lib/Target/R600/AMDGPUStructurizeCFG.cpp
+++ b/lib/Target/R600/AMDGPUStructurizeCFG.cpp
@@ -533,12 +533,18 @@ void AMDGPUStructurizeCFG::setPhiValues() {
       Updater.AddAvailableValue(&Func->getEntryBlock(), Undef);
       Updater.AddAvailableValue(To, Undef);
 
+      NearestCommonDominator Dominator(DT);
+      Dominator.addBlock(To, false);
       for (BBValueVector::iterator VI = PI->second.begin(),
            VE = PI->second.end(); VI != VE; ++VI) {
 
         Updater.AddAvailableValue(VI->first, VI->second);
+        Dominator.addBlock(VI->first);
       }
 
+      if (!Dominator.wasResultExplicitMentioned())
+        Updater.AddAvailableValue(Dominator.getResult(), Undef);
+
       for (BBVector::iterator FI = From.begin(), FE = From.end();
            FI != FE; ++FI) {
 
-- 
1.7.9.5



More information about the mesa-dev mailing list