summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorSameer Sahasrabuddhe <sameer.sahasrabuddhe@amd.com>2018-09-21 11:26:55 +0000
committerSameer Sahasrabuddhe <sameer.sahasrabuddhe@amd.com>2018-09-21 11:26:55 +0000
commit2de7653fd52199b0175779309d2facd6867fea61 (patch)
tree55be52aa1714220ce277c44468d802ab587c91f0 /llvm/lib/Transforms
parent60a16ef04b8e435f1e8fbf16c960a0cf7b7a5612 (diff)
downloadbcm5719-llvm-2de7653fd52199b0175779309d2facd6867fea61.tar.gz
bcm5719-llvm-2de7653fd52199b0175779309d2facd6867fea61.zip
[AMDGPU] lower-switch in preISel as a workaround for legacy DA
Summary: The default target of the switch instruction may sometimes be an "unreachable" block, when it is guaranteed that one of the cases is always taken. The dominator tree concludes that such a switch instruction does not have an immediate post dominator. This confuses divergence analysis, which is unable to propagate sync dependence to the targets of the switch instruction. As a workaround, the AMDGPU target now invokes lower-switch as a preISel pass. LowerSwitch is designed to handle the unreachable default target correctly, allowing the divergence analysis to locate the correct immediate dominator of the now-lowered switch. Reviewers: arsenm, nhaehnle Reviewed By: nhaehnle Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits, simoll Differential Revision: https://reviews.llvm.org/D52221 llvm-svn: 342722
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/StructurizeCFG.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp b/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
index f58f79f8b14..41edcb56aab 100644
--- a/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
+++ b/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
@@ -275,6 +275,7 @@ public:
AU.addRequired<LoopInfoWrapperPass>();
AU.addPreserved<DominatorTreeWrapperPass>();
+ AU.addPreservedID(LowerSwitchID);
RegionPass::getAnalysisUsage(AU);
}
};
OpenPOWER on IntegriCloud