[llvm] cddcbfa - [OpenMP][FIX] Avoid performance regression accidentally introduced
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 11 00:59:34 PST 2023
Author: Johannes Doerfert
Date: 2023-01-11T00:58:34-08:00
New Revision: cddcbfae14181538963c83320ae78f085dad2576
URL: https://github.com/llvm/llvm-project/commit/cddcbfae14181538963c83320ae78f085dad2576
DIFF: https://github.com/llvm/llvm-project/commit/cddcbfae14181538963c83320ae78f085dad2576.diff
LOG: [OpenMP][FIX] Avoid performance regression accidentally introduced
Added:
llvm/test/Transforms/OpenMP/internals_cgscc.ll
Modified:
llvm/lib/Transforms/IPO/OpenMPOpt.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
index 8bd61a2681552..5ea3d2b5acb4b 100644
--- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -4861,7 +4861,7 @@ void OpenMPOpt::registerAAs(bool IsModulePass) {
if (llvm::all_of(F->uses(), [this](const Use &U) {
const auto *CB = dyn_cast<CallBase>(U.getUser());
return CB && CB->isCallee(&U) &&
- !A.isRunOn(const_cast<Function *>(CB->getCaller()));
+ A.isRunOn(const_cast<Function *>(CB->getCaller()));
}))
continue;
}
diff --git a/llvm/test/Transforms/OpenMP/internals_cgscc.ll b/llvm/test/Transforms/OpenMP/internals_cgscc.ll
new file mode 100644
index 0000000000000..968a4654bcde5
--- /dev/null
+++ b/llvm/test/Transforms/OpenMP/internals_cgscc.ll
@@ -0,0 +1,49 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -passes=openmp-opt-cgscc < %s | FileCheck %s
+
+; Verify we remove the trivially dead store in a function that is not dead
+; (foo) but not in a dead function (dead) when running in cgscc mode.
+
+define internal void @dead() {
+; CHECK-LABEL: @dead(
+; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
+; CHECK-NEXT: store i32 0, ptr [[A]], align 4
+; CHECK-NEXT: ret void
+;
+ %a = alloca i32
+ store i32 0, ptr %a
+ ret void
+}
+
+define internal void @foo() {
+; CHECK-LABEL: @foo(
+; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
+; CHECK-NEXT: ret void
+;
+ %a = alloca i32
+ store i32 0, ptr %a
+ ret void
+}
+
+define internal void @bar() {
+; CHECK-LABEL: @bar(
+; CHECK-NEXT: call void @foo()
+; CHECK-NEXT: ret void
+;
+ call void @foo()
+ ret void
+}
+
+define void @baz() {
+; CHECK-LABEL: @baz(
+; CHECK-NEXT: call void @bar()
+; CHECK-NEXT: ret void
+;
+ call void @bar()
+ ret void
+}
+
+!llvm.module.flags = !{!0, !1}
+
+!0 = !{i32 7, !"openmp", i32 50}
+!1 = !{i32 7, !"openmp-device", i32 50}
More information about the llvm-commits
mailing list