[llvm] e30fbbe - [JumpThreading][NewPM] Skip when target has divergent CF
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 4 16:08:40 PST 2021
Author: Arthur Eubanks
Date: 2021-01-04T16:08:08-08:00
New Revision: e30fbbe9a5359f5d88fbc6045f320a120fc9a5af
URL: https://github.com/llvm/llvm-project/commit/e30fbbe9a5359f5d88fbc6045f320a120fc9a5af
DIFF: https://github.com/llvm/llvm-project/commit/e30fbbe9a5359f5d88fbc6045f320a120fc9a5af.diff
LOG: [JumpThreading][NewPM] Skip when target has divergent CF
Matches the legacy pass.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D94028
Added:
Modified:
llvm/lib/Transforms/Scalar/JumpThreading.cpp
llvm/test/Transforms/JumpThreading/divergent-target-test.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
index ce191144297b..e8de6f425db6 100644
--- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
@@ -341,6 +341,10 @@ bool JumpThreading::runOnFunction(Function &F) {
PreservedAnalyses JumpThreadingPass::run(Function &F,
FunctionAnalysisManager &AM) {
+ auto &TTI = AM.getResult<TargetIRAnalysis>(F);
+ // Jump Threading has no sense for the targets with divergent CF
+ if (TTI.hasBranchDivergence())
+ return PreservedAnalyses::all();
auto &TLI = AM.getResult<TargetLibraryAnalysis>(F);
auto &DT = AM.getResult<DominatorTreeAnalysis>(F);
auto &LVI = AM.getResult<LazyValueAnalysis>(F);
diff --git a/llvm/test/Transforms/JumpThreading/divergent-target-test.ll b/llvm/test/Transforms/JumpThreading/divergent-target-test.ll
index 4f7d237691c8..34060fbb09d9 100644
--- a/llvm/test/Transforms/JumpThreading/divergent-target-test.ll
+++ b/llvm/test/Transforms/JumpThreading/divergent-target-test.ll
@@ -1,6 +1,8 @@
; REQUIRES: amdgpu-registered-target && x86-registered-target
; RUN: opt < %s -mtriple=amdgcn -jump-threading -S | FileCheck %s -check-prefixes=CHECK,DIVERGENT
+; RUN: opt < %s -mtriple=amdgcn -passes=jump-threading -S | FileCheck %s -check-prefixes=CHECK,DIVERGENT
; RUN: opt < %s -mtriple=x86_64 -jump-threading -S | FileCheck %s -check-prefixes=CHECK,UNIFORM
+; RUN: opt < %s -mtriple=x86_64 -passes=jump-threading -S | FileCheck %s -check-prefixes=CHECK,UNIFORM
; Here we assure that for the target with no branch divergence usual Jump Threading optimization performed
; For target with branch divergence - no optimization, so the IR is unchanged.
More information about the llvm-commits
mailing list