summaryrefslogtreecommitdiff
path: root/llvm/lib/Frontend/OpenMP
diff options
context:
space:
mode:
authorKareem Ergawy <kareem.ergawy@amd.com>2025-09-23 08:32:31 +0200
committerGitHub <noreply@github.com>2025-09-23 08:32:31 +0200
commit2ab02b6f561d72d948dcb2943e364ba79667e2f2 (patch)
tree908ae8adeffd86db5af693ed564fb27ebfbf8e1b /llvm/lib/Frontend/OpenMP
parentd34f738562d824c237ec35cfff3ec34f57ba41b0 (diff)
[flang][OpenMP] Support multi-block reduction combiner regions on the GPU (#156837)
Fixes a bug related to insertion points when inlining multi-block combiner reduction regions. The IP at the end of the inlined region was not used resulting in emitting BBs with multiple terminators. PR stack: - https://github.com/llvm/llvm-project/pull/155754 - https://github.com/llvm/llvm-project/pull/155987 - https://github.com/llvm/llvm-project/pull/155992 - https://github.com/llvm/llvm-project/pull/155993 - https://github.com/llvm/llvm-project/pull/157638 - https://github.com/llvm/llvm-project/pull/156610 - https://github.com/llvm/llvm-project/pull/156837 ◀️
Diffstat (limited to 'llvm/lib/Frontend/OpenMP')
-rw-r--r--llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
index 220eee3cb8b0..6d948f184392 100644
--- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -3507,6 +3507,8 @@ Expected<Function *> OpenMPIRBuilder::createReductionFunction(
return AfterIP.takeError();
if (!Builder.GetInsertBlock())
return ReductionFunc;
+
+ Builder.restoreIP(*AfterIP);
Builder.CreateStore(Reduced, LHSPtr);
}
}
@@ -3751,6 +3753,7 @@ OpenMPIRBuilder::InsertPointOrErrorTy OpenMPIRBuilder::createReductionsGPU(
RI.ReductionGen(Builder.saveIP(), RHSValue, LHSValue, Reduced);
if (!AfterIP)
return AfterIP.takeError();
+ Builder.restoreIP(*AfterIP);
Builder.CreateStore(Reduced, LHS, false);
}
}