[llvm-branch-commits] [llvm] OMPIRBuilder: Do not try to expand uses of ConstantData (PR #134584)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Apr 6 23:06:27 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-openmp

@llvm/pr-subscribers-llvm-ir

Author: Matt Arsenault (arsenm)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/134584.diff


2 Files Affected:

- (modified) llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp (+3) 
- (modified) llvm/lib/IR/ReplaceConstant.cpp (+3) 


``````````diff
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);

``````````

</details>


https://github.com/llvm/llvm-project/pull/134584


More information about the llvm-branch-commits mailing list