[llvm-branch-commits] [llvm] OMPIRBuilder: Do not try to expand uses of ConstantData (PR #134584)
Matt Arsenault via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Apr 6 23:03:56 PDT 2025
https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/134584
None
>From 62484208baa8454a5f9fe69f1d9a9d120f585e00 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Mon, 7 Apr 2025 12:57:44 +0700
Subject: [PATCH] OMPIRBuilder: Do not try to expand uses of ConstantData
---
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp | 3 +++
llvm/lib/IR/ReplaceConstant.cpp | 3 +++
2 files changed, 6 insertions(+)
diff --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
index bbb44288d0d0d..52946bf812dac 100644
--- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -7032,6 +7032,9 @@ static Expected<Function *> createOutlinedFunction(
continue;
}
+ if (isa<ConstantData>(Input))
+ continue;
+
ReplaceValue(Input, InputCopy, Func);
}
diff --git a/llvm/lib/IR/ReplaceConstant.cpp b/llvm/lib/IR/ReplaceConstant.cpp
index a31cfe6cca3c1..962368f061851 100644
--- a/llvm/lib/IR/ReplaceConstant.cpp
+++ b/llvm/lib/IR/ReplaceConstant.cpp
@@ -56,6 +56,9 @@ bool convertUsersOfConstantsToInstructions(ArrayRef<Constant *> Consts,
// Find all expandable direct users of Consts.
SmallVector<Constant *> Stack;
for (Constant *C : Consts) {
+ assert(!isa<ConstantData>(C) &&
+ "should not be expanding trivial constant users");
+
if (IncludeSelf) {
assert(isExpandableUser(C) && "One of the constants is not expandable");
Stack.push_back(C);
More information about the llvm-branch-commits
mailing list