[Lldb-commits] [lld] [llvm] [compiler-rt] [libc] [clang] [flang] [libunwind] [clang-tools-extra] [libcxx] [lldb] [GVN] Disable GVN PRE on target hasBranchDivergence (PR #77069)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Jan 8 01:32:37 PST 2024
https://github.com/fengfeng09 updated https://github.com/llvm/llvm-project/pull/77069
>From 17a9072758d9f443d0f7bca8862fec5a793c3dba Mon Sep 17 00:00:00 2001
From: "feng.feng" <feng.feng at iluvatar.com>
Date: Mon, 11 Dec 2023 15:14:32 +0800
Subject: [PATCH] [GVN] Disable GVN PRE on target hasBranchDivergence
Signed-off-by: feng.feng <feng.feng at iluvatar.com>
---
llvm/lib/Transforms/Scalar/GVN.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index e36578f3de7ac4..777dec04faf9f6 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -41,6 +41,7 @@
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/Analysis/PHITransAddr.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
+#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
@@ -750,6 +751,10 @@ bool GVNPass::isMemDepEnabled() const {
}
PreservedAnalyses GVNPass::run(Function &F, FunctionAnalysisManager &AM) {
+ // Disable PRE on GPU.
+ auto &TTI = AM.getResult<TargetIRAnalysis>(F);
+ if (TTI.hasBranchDivergence())
+ GVNEnablePRE = false;
// FIXME: The order of evaluation of these 'getResult' calls is very
// significant! Re-ordering these variables will cause GVN when run alone to
// be less effective! We should fix memdep and basic-aa to not exhibit this
More information about the lldb-commits
mailing list