llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Akash Manna (akash-manna-sky)

<details>
<summary>Changes</summary>

Fixes #<!-- -->147288

With `-g` the `.omp_outlined` wrapper calls `.omp_outlined_debug__`, which 
keeps the original parameter types, passing one IR value per captured variable. 
That breaks whenever the ABI lowers a by-copy capture differently: `_Complex 
int` is two `i32` on PowerPC64 and an indirect pointer on SystemZ, 
`_BitInt(33)` is an `i64` on x86-64.

Build the call through `EmitCall` with the callee's `CGFunctionInfo` instead, 
which covers every ABI kind and replaces the `_Complex`-only retyping. The 
aggregate wrapper used for CPU offload had the same loop and takes the same 
path now.

AI assisted!


---

Patch is 72.72 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/242299.diff


13 Files Affected:

- (modified) clang/docs/ReleaseNotes.md (+4) 
- (modified) clang/lib/CodeGen/CGOpenMPRuntime.cpp (+17) 
- (modified) clang/lib/CodeGen/CGOpenMPRuntime.h (+10) 
- (modified) clang/lib/CodeGen/CGStmtOpenMP.cpp (+39-43) 
- (added) clang/test/OpenMP/GH147288.c (+77) 
- (modified) clang/test/OpenMP/debug-info-complex-byval.cpp (+11-2) 
- (modified) clang/test/OpenMP/debug-info-openmp-array.cpp (+1-1) 
- (modified) clang/test/OpenMP/nested_loop_codegen.cpp (+44-44) 
- (modified) clang/test/OpenMP/parallel_codegen.cpp (+59-59) 
- (modified) clang/test/OpenMP/target_aggregate_debug_codegen.cpp (+4-4) 
- (modified) clang/test/OpenMP/target_parallel_debug_codegen.cpp (+6-6) 
- (modified) clang/test/OpenMP/target_parallel_for_debug_codegen.cpp (+6-6) 
- (modified) clang/test/OpenMP/target_parallel_generic_loop_codegen-3.cpp 
(+6-6) 


``````````diff
diff --git a/clang/docs/ReleaseNotes.md b/clang/docs/ReleaseNotes.md
index a72577e6b33d71..0429362eb767e0 100644
--- a/clang/docs/ReleaseNotes.md
+++ b/clang/docs/ReleaseNotes.md
@@ -892,6 +892,10 @@ documentation](CIR/index.md) for more information 
regarding ClangIR's status and
 - Fixed an assertion failure in `-Wsign-compare` when a negated or 
complemented vector of unsigned integers was compared against a signed 
constant. (#GH203575)
 - Fixed a crash when comparing vectors of `_BitInt` wider than 128 bits. 
(#GH200665)
 - Fixed an assertion failure when a constant statement expression that 
declares a variable is used as a bound of an OpenMP loop. A statement 
expression in a bound of a non-rectangular loop is now diagnosed. (#GH153987)
+- Fixed a crash, and on some targets a miscompile, when a variable captured by 
copy in an OpenMP region
+  compiled with debug information has a type that the target ABI does not pass 
as a single value of that
+  type, such as `_Complex int` on PowerPC64 (two registers) and SystemZ 
(indirectly) or `_BitInt(33)` on
+  x86-64 (widened to 64 bits). (#GH147288)
 - Fixed a bug where a bit-field accessed as the result of a statement 
expression
   (e.g. `({ s.b; })`) was not subject to integer promotion, unlike an ordinary
   bit-field access. (#GH221542)
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp 
b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index d7e54e8d062171..af286ee16e4a07 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -12813,6 +12813,23 @@ void CGOpenMPRuntime::emitOutlinedFunctionCall(
   emitCall(CGF, Loc, OutlinedFn, Args);
 }
 
+void CGOpenMPRuntime::emitOutlinedFunctionCall(CodeGenFunction &CGF,
+                                               SourceLocation Loc,
+                                               llvm::Function *OutlinedFn,
+                                               const CGFunctionInfo &FnInfo,
+                                               const CallArgList &Args) const {
+  assert(Loc.isValid() && "Outlined function call location must be valid.");
+  assert(Args.size() == FnInfo.arg_size() &&
+         "Outlined function argument count mismatch.");
+  auto DL = ApplyDebugLocation::CreateDefaultArtificial(CGF, Loc);
+  llvm::CallBase *Call = nullptr;
+  CGF.EmitCall(FnInfo, CGCallee::forDirect(OutlinedFn), ReturnValueSlot(), 
Args,
+               &Call);
+  // As in emitCall(): the call does not unwind if the callee does not.
+  if (OutlinedFn->doesNotThrow())
+    Call->setDoesNotThrow();
+}
+
 void CGOpenMPRuntime::emitFunctionProlog(CodeGenFunction &CGF, const Decl *D) {
   if (const auto *FD = dyn_cast<FunctionDecl>(D))
     if (OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(FD))
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.h 
b/clang/lib/CodeGen/CGOpenMPRuntime.h
index 47c05d62a3b412..899c5ca2cf1f6a 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.h
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.h
@@ -50,6 +50,8 @@ class OMPDeclareReductionDecl;
 
 namespace CodeGen {
 class Address;
+class CallArgList;
+class CGFunctionInfo;
 class CodeGenFunction;
 class CodeGenModule;
 
@@ -1603,6 +1605,14 @@ class CGOpenMPRuntime {
                            llvm::FunctionCallee OutlinedFn,
                            ArrayRef<llvm::Value *> Args = {}) const;
 
+  /// Emits call of the outlined function \p OutlinedFn, defined with \p 
FnInfo,
+  /// passing \p Args in their original types through the regular call lowering
+  /// so that the target ABI (coercion, expansion, indirection) is applied.
+  void emitOutlinedFunctionCall(CodeGenFunction &CGF, SourceLocation Loc,
+                                llvm::Function *OutlinedFn,
+                                const CGFunctionInfo &FnInfo,
+                                const CallArgList &Args) const;
+
   /// Emits OpenMP-specific function prolog.
   /// Required for device constructs.
   virtual void emitFunctionProlog(CodeGenFunction &CGF, const Decl *D);
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp 
b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index f10cd25204aa4d..acd0927475bac6 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -944,6 +944,7 @@ llvm::Function 
*CodeGenFunction::GenerateOpenMPCapturedStmtFunction(
                      Out.str(), Loc, !NeedWrapperFunction && IsDeviceKernel);
   llvm::Function *F = emitOutlinedFunctionPrologue(
       *this, WrapperArgs, WrapperLocalAddrs, WrapperVLASizes, CXXThisValue, 
FO);
+  const CGFunctionInfo &FnInfo = *CurFnInfo;
   CodeGenFunction::OMPPrivateScope LocalScope(*this);
   for (const auto &LocalAddrPair : WrapperLocalAddrs) {
     if (LocalAddrPair.second.first) {
@@ -965,34 +966,33 @@ llvm::Function 
*CodeGenFunction::GenerateOpenMPCapturedStmtFunction(
   WrapperF->removeFromParent();
   F->getParent()->getFunctionList().insertAfter(F->getIterator(), WrapperF);
 
-  llvm::SmallVector<llvm::Value *, 4> CallArgs;
-  auto *PI = F->arg_begin();
-  for (const auto *Arg : Args) {
-    llvm::Value *CallArg;
+  // Pass the arguments in their original types through the regular call
+  // lowering: the ABI may coerce, extend, expand or pass them indirectly.
+  CallArgList CallArgs;
+  for (auto [Arg, ArgInfo] : llvm::zip_equal(Args, FnInfo.arguments())) {
+    RValue CallArg;
     auto I = LocalAddrs.find(Arg);
     if (I != LocalAddrs.end()) {
       LValue LV = WrapperCGF.MakeAddrLValue(
           I->second.second,
           I->second.first ? I->second.first->getType() : Arg->getType(),
           AlignmentSource::Decl);
-      if (LV.getType()->isAnyComplexType())
-        LV.setAddress(LV.getAddress().withElementType(PI->getType()));
-      CallArg = WrapperCGF.EmitLoadOfScalar(LV, S.getBeginLoc());
+      assert(!hasAggregateEvaluationKind(LV.getType()) &&
+             "Variables captured by copy have scalar or complex type.");
+      CallArg = WrapperCGF.EmitLoadOfAnyValue(LV, AggValueSlot::ignored(),
+                                              S.getBeginLoc());
+    } else if (auto EI = VLASizes.find(Arg); EI != VLASizes.end()) {
+      CallArg = RValue::get(EI->second.second);
     } else {
-      auto EI = VLASizes.find(Arg);
-      if (EI != VLASizes.end()) {
-        CallArg = EI->second.second;
-      } else {
-        LValue LV =
-            WrapperCGF.MakeAddrLValue(WrapperCGF.GetAddrOfLocalVar(Arg),
-                                      Arg->getType(), AlignmentSource::Decl);
-        CallArg = WrapperCGF.EmitLoadOfScalar(LV, S.getBeginLoc());
-      }
+      LValue LV =
+          WrapperCGF.MakeAddrLValue(WrapperCGF.GetAddrOfLocalVar(Arg),
+                                    Arg->getType(), AlignmentSource::Decl);
+      CallArg = RValue::get(WrapperCGF.EmitLoadOfScalar(LV, S.getBeginLoc()));
     }
-    CallArgs.emplace_back(WrapperCGF.EmitFromMemory(CallArg, Arg->getType()));
-    ++PI;
+    CallArgs.add(CallArg, ArgInfo.type);
   }
-  CGM.getOpenMPRuntime().emitOutlinedFunctionCall(WrapperCGF, Loc, F, 
CallArgs);
+  CGM.getOpenMPRuntime().emitOutlinedFunctionCall(WrapperCGF, Loc, F, FnInfo,
+                                                  CallArgs);
   WrapperCGF.FinishFunction();
   return WrapperF;
 }
@@ -1004,7 +1004,6 @@ llvm::Function 
*CodeGenFunction::GenerateOpenMPCapturedStmtFunctionAggregate(
       CapturedStmtInfo &&
       "CapturedStmtInfo should be set when generating the captured function");
   const CapturedDecl *CD = S.getCapturedDecl();
-  const RecordDecl *RD = S.getCapturedRecordDecl();
   StringRef FunctionName = CapturedStmtInfo->getHelperName();
   bool NeedWrapperFunction =
       getDebugInfo() && CGM.getCodeGenOpts().hasReducedDebugInfo();
@@ -1028,6 +1027,7 @@ llvm::Function 
*CodeGenFunction::GenerateOpenMPCapturedStmtFunctionAggregate(
   llvm::MapVector<const Decl *, std::pair<const VarDecl *, Address>> 
LocalAddrs;
   llvm::DenseMap<const Decl *, std::pair<const Expr *, llvm::Value *>> 
VLASizes;
   llvm::Function *F;
+  const CGFunctionInfo *FnInfo = nullptr;
 
   if (NeedWrapperFunction) {
     SmallString<256> Buffer;
@@ -1039,6 +1039,7 @@ llvm::Function 
*CodeGenFunction::GenerateOpenMPCapturedStmtFunctionAggregate(
                        /*IsDeviceKernel=*/false);
     F = emitOutlinedFunctionPrologue(*this, Args, LocalAddrs, VLASizes,
                                      CXXThisValue, FO);
+    FnInfo = CurFnInfo;
   } else {
     llvm::Value *ContextV = nullptr;
     F = emitOutlinedFunctionPrologueAggregate(*this, Args, LocalAddrs, 
VLASizes,
@@ -1088,35 +1089,30 @@ llvm::Function 
*CodeGenFunction::GenerateOpenMPCapturedStmtFunctionAggregate(
   WrapperF->removeFromParent();
   F->getParent()->getFunctionList().insertAfter(F->getIterator(), WrapperF);
 
-  llvm::Align PtrAlign = CGM.getDataLayout().getPointerABIAlignment(0);
-  llvm::SmallVector<llvm::Value *, 16> CallArgs;
+  // The runtime passes an array of pointers to the arguments: the captured
+  // fields first, then the implicit parameters (dyn_ptr).
   assert(CD->getContextParamPosition() == 0 &&
          "Expected context param at position 0 for target regions");
-  assert(RD->getNumFields() + 1 == F->arg_size() && "Argument count mismatch");
-
-  for (auto [FD, InnerParam, SlotIdx] : llvm::zip(
-           RD->fields(), F->args(), llvm::seq<unsigned>(RD->getNumFields()))) {
+  llvm::Align PtrAlign = CGM.getDataLayout().getPointerABIAlignment(0);
+  CharUnits SlotAlign = CharUnits::fromQuantity(PtrAlign.value());
+  CallArgList CallArgs;
+  for (auto [Arg, ArgInfo, SlotIdx] : llvm::zip_equal(
+           Args, FnInfo->arguments(), llvm::seq<unsigned>(Args.size()))) {
     llvm::Value *SlotPtr = WrapperCGF.Builder.CreateConstInBoundsGEP1_32(
         WrapperCGF.Builder.getPtrTy(), WrapperContextV, SlotIdx);
     llvm::Value *Slot = WrapperCGF.Builder.CreateAlignedLoad(
         WrapperCGF.Builder.getPtrTy(), SlotPtr, PtrAlign);
-    llvm::Value *Val = WrapperCGF.Builder.CreateAlignedLoad(
-        InnerParam.getType(), Slot, PtrAlign, InnerParam.getName());
-    CallArgs.push_back(Val);
-  }
-
-  // Handle the load from the implicit dyn_ptr at the end of the __context.
-  unsigned SlotIdx = RD->getNumFields();
-  auto InnerParam = F->arg_begin() + SlotIdx;
-  llvm::Value *SlotPtr = WrapperCGF.Builder.CreateConstInBoundsGEP1_32(
-      WrapperCGF.Builder.getPtrTy(), WrapperContextV, SlotIdx);
-  llvm::Value *Slot = WrapperCGF.Builder.CreateAlignedLoad(
-      WrapperCGF.Builder.getPtrTy(), SlotPtr, PtrAlign);
-  llvm::Value *Val = WrapperCGF.Builder.CreateAlignedLoad(
-      InnerParam->getType(), Slot, PtrAlign, InnerParam->getName());
-  CallArgs.push_back(Val);
-
-  CGM.getOpenMPRuntime().emitOutlinedFunctionCall(WrapperCGF, Loc, F, 
CallArgs);
+    QualType ArgTy = Arg->getType();
+    LValue LV = WrapperCGF.MakeAddrLValue(
+        Address(Slot, WrapperCGF.ConvertTypeForMem(ArgTy), SlotAlign), ArgTy,
+        AlignmentSource::Decl);
+    CallArgs.add(
+        WrapperCGF.EmitLoadOfAnyValue(LV, AggValueSlot::ignored(), Loc),
+        ArgInfo.type);
+  }
+
+  CGM.getOpenMPRuntime().emitOutlinedFunctionCall(WrapperCGF, Loc, F, *FnInfo,
+                                                  CallArgs);
   WrapperCGF.FinishFunction();
   return WrapperF;
 }
diff --git a/clang/test/OpenMP/GH147288.c b/clang/test/OpenMP/GH147288.c
new file mode 100644
index 00000000000000..3d99d50facc5a8
--- /dev/null
+++ b/clang/test/OpenMP/GH147288.c
@@ -0,0 +1,77 @@
+// RUN: %clang_cc1 -verify -fopenmp -debug-info-kind=standalone -triple 
powerpc64le-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=CHECK,PPC64
+// RUN: %clang_cc1 -verify -fopenmp -debug-info-kind=standalone -triple 
powerpc64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=CHECK,PPC64
+// RUN: %clang_cc1 -verify -fopenmp -debug-info-kind=standalone -triple 
x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=CHECK,X86_64
+// RUN: %clang_cc1 -verify -fopenmp -debug-info-kind=standalone -triple 
s390x-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=CHECK,S390X
+// expected-no-diagnostics
+
+// With debug info, the `.omp_outlined` wrapper (uintptr parameters) calls
+// `.omp_outlined_debug__` (original parameter types) and must pass each
+// argument as the target ABI lowers it: two i32 for `_Complex int` on
+// PowerPC64, indirectly on SystemZ, coerced to i64 for `_BitInt(33)` on 
x86-64.
+
+void sink_mixed(int, int _Complex, float);
+void sink_complex_fd(float _Complex, double _Complex);
+void sink_bitint(_BitInt(33));
+
+// CHECK-LABEL: define internal void @apply_round_stamp.omp_outlined_debug__(
+// PPC64-SAME:    ptr noalias noundef %{{[^,]+}}, ptr noalias noundef 
%{{[^,]+}}, i32 noundef %{{[^,]+}}, i32 noundef %{{[^,)]+}})
+// X86_64-SAME:   ptr noalias noundef %{{[^,]+}}, ptr noalias noundef 
%{{[^,]+}}, i64 noundef %{{[^,)]+}})
+// S390X-SAME:    ptr noalias noundef %{{[^,]+}}, ptr noalias noundef 
%{{[^,]+}}, ptr {{[^%]*}}%{{[^,)]+}})
+//
+// CHECK-LABEL: define internal void @apply_round_stamp.omp_outlined(
+// CHECK-SAME:    ptr noalias noundef %{{[^,]+}}, ptr noalias noundef 
%{{[^,]+}}, i64 noundef %{{[^,)]+}})
+// PPC64:         call void @apply_round_stamp.omp_outlined_debug__(ptr 
noundef %{{[^,]+}}, ptr noundef %{{[^,]+}}, i32 noundef %{{[^,]+}}, i32 noundef 
%{{[^,)]+}})
+// X86_64:        call void @apply_round_stamp.omp_outlined_debug__(ptr 
noundef %{{[^,]+}}, ptr noundef %{{[^,]+}}, i64 noundef %{{[^,)]+}})
+// S390X:         call void @apply_round_stamp.omp_outlined_debug__(ptr 
noundef %{{[^,]+}}, ptr noundef %{{[^,]+}}, ptr {{[^%]*}}%byval-temp)
+void apply_round_stamp(void) {
+  int _Complex strength = 0;
+#pragma omp parallel default(firstprivate)
+  (void)strength;
+}
+
+// Arguments after the complex one must still land in their own parameters.
+// CHECK-LABEL: define internal void @mixed.omp_outlined_debug__(
+// PPC64-SAME:    ptr noalias noundef %{{[^,]+}}, ptr noalias noundef 
%{{[^,]+}}, i32 noundef signext %{{[^,]+}}, i32 noundef %{{[^,]+}}, i32 noundef 
%{{[^,]+}}, float noundef %{{[^,)]+}})
+// X86_64-SAME:   ptr noalias noundef %{{[^,]+}}, ptr noalias noundef 
%{{[^,]+}}, i32 noundef %{{[^,]+}}, i64 noundef %{{[^,]+}}, float noundef 
%{{[^,)]+}})
+//
+// CHECK-LABEL: define internal void @mixed.omp_outlined(
+// CHECK-SAME:    ptr noalias noundef %{{[^,]+}}, ptr noalias noundef 
%{{[^,]+}}, i64 noundef %{{[^,]+}}, i64 noundef %{{[^,]+}}, i64 noundef 
%{{[^,)]+}})
+// PPC64:         call void @mixed.omp_outlined_debug__(ptr noundef 
%{{[^,]+}}, ptr noundef %{{[^,]+}}, i32 noundef signext %{{[^,]+}}, i32 noundef 
%{{[^,]+}}, i32 noundef %{{[^,]+}}, float noundef %{{[^,)]+}})
+// X86_64:        call void @mixed.omp_outlined_debug__(ptr noundef 
%{{[^,]+}}, ptr noundef %{{[^,]+}}, i32 noundef %{{[^,]+}}, i64 noundef 
%{{[^,]+}}, float noundef %{{[^,)]+}})
+void mixed(void) {
+  int a = 1;
+  int _Complex c = 0;
+  float x = 2;
+#pragma omp parallel default(firstprivate)
+  sink_mixed(a, c, x);
+}
+
+// `_Complex float` is captured by copy; `_Complex double` does not fit in a
+// uintptr_t and is captured by reference.
+// CHECK-LABEL: define internal void @complex_fd.omp_outlined_debug__(
+// PPC64-SAME:    ptr noalias noundef %{{[^,]+}}, ptr noalias noundef 
%{{[^,]+}}, float noundef %{{[^,]+}}, float noundef %{{[^,]+}}, ptr 
{{[^%]*}}%{{[^,)]+}})
+// X86_64-SAME:   ptr noalias noundef %{{[^,]+}}, ptr noalias noundef 
%{{[^,]+}}, <2 x float> noundef %{{[^,]+}}, ptr {{[^%]*}}%{{[^,)]+}})
+//
+// CHECK-LABEL: define internal void @complex_fd.omp_outlined(
+// CHECK-SAME:    ptr noalias noundef %{{[^,]+}}, ptr noalias noundef 
%{{[^,]+}}, i64 noundef %{{[^,]+}}, ptr {{[^%]*}}%{{[^,)]+}})
+// PPC64:         call void @complex_fd.omp_outlined_debug__(ptr noundef 
%{{[^,]+}}, ptr noundef %{{[^,]+}}, float noundef %{{[^,]+}}, float noundef 
%{{[^,]+}}, ptr {{[^%]*}}%{{[^,)]+}})
+// X86_64:        call void @complex_fd.omp_outlined_debug__(ptr noundef 
%{{[^,]+}}, ptr noundef %{{[^,]+}}, <2 x float> noundef %{{[^,]+}}, ptr 
{{[^%]*}}%{{[^,)]+}})
+void complex_fd(void) {
+  float _Complex f = 0;
+  double _Complex d = 0;
+#pragma omp parallel firstprivate(f, d)
+  sink_complex_fd(f, d);
+}
+
+// CHECK-LABEL: define internal void @bitint.omp_outlined_debug__(
+// PPC64-SAME:    ptr noalias noundef %{{[^,]+}}, ptr noalias noundef 
%{{[^,]+}}, i33 noundef signext %{{[^,)]+}})
+// X86_64-SAME:   ptr noalias noundef %{{[^,]+}}, ptr noalias noundef 
%{{[^,]+}}, i64 noundef %{{[^,)]+}})
+//
+// CHECK-LABEL: define internal void @bitint.omp_outlined(
+// PPC64:         call void @bitint.omp_outlined_debug__(ptr noundef 
%{{[^,]+}}, ptr noundef %{{[^,]+}}, i33 noundef signext %{{[^,)]+}})
+// X86_64:        call void @bitint.omp_outlined_debug__(ptr noundef 
%{{[^,]+}}, ptr noundef %{{[^,]+}}, i64 noundef %{{[^,)]+}})
+void bitint(void) {
+  _BitInt(33) b = 5;
+#pragma omp parallel default(firstprivate)
+  sink_bitint(b);
+}
diff --git a/clang/test/OpenMP/debug-info-complex-byval.cpp 
b/clang/test/OpenMP/debug-info-complex-byval.cpp
index 895d73c3d818a9..0f7c0cfebdc468 100644
--- a/clang/test/OpenMP/debug-info-complex-byval.cpp
+++ b/clang/test/OpenMP/debug-info-complex-byval.cpp
@@ -45,6 +45,7 @@ void a() {
 // CHECK1-NEXT:    [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
 // CHECK1-NEXT:    [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
 // CHECK1-NEXT:    [[B_ADDR:%.*]] = alloca i64, align 8
+// CHECK1-NEXT:    [[COERCE:%.*]] = alloca { float, float }, align 4
 // CHECK1-NEXT:    store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], 
align 8
 // CHECK1-NEXT:      #dbg_declare(ptr [[DOTGLOBAL_TID__ADDR]], 
[[META34:![0-9]+]], !DIExpression(), [[META35:![0-9]+]])
 // CHECK1-NEXT:    store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], 
align 8
@@ -53,7 +54,15 @@ void a() {
 // CHECK1-NEXT:      #dbg_declare(ptr [[B_ADDR]], [[META37:![0-9]+]], 
!DIExpression(), [[META35]])
 // CHECK1-NEXT:    [[TMP0:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 
8, !dbg [[DBG38:![0-9]+]]
 // CHECK1-NEXT:    [[TMP1:%.*]] = load ptr, ptr [[DOTBOUND_TID__ADDR]], align 
8, !dbg [[DBG38]]
-// CHECK1-NEXT:    [[TMP2:%.*]] = load <2 x float>, ptr [[B_ADDR]], align 4, 
!dbg [[DBG38]]
-// CHECK1-NEXT:    call void @_Z1av.omp_outlined_debug__(ptr [[TMP0]], ptr 
[[TMP1]], <2 x float> [[TMP2]]) #[[ATTR3:[0-9]+]], !dbg [[DBG38]]
+// CHECK1-NEXT:    [[B_ADDR_REALP:%.*]] = getelementptr inbounds nuw { float, 
float }, ptr [[B_ADDR]], i32 0, i32 0, !dbg [[DBG38]]
+// CHECK1-NEXT:    [[B_ADDR_REAL:%.*]] = load float, ptr [[B_ADDR_REALP]], 
align 4, !dbg [[DBG38]]
+// CHECK1-NEXT:    [[B_ADDR_IMAGP:%.*]] = getelementptr inbounds nuw { float, 
float }, ptr [[B_ADDR]], i32 0, i32 1, !dbg [[DBG38]]
+// CHECK1-NEXT:    [[B_ADDR_IMAG:%.*]] = load float, ptr [[B_ADDR_IMAGP]], 
align 4, !dbg [[DBG38]]
+// CHECK1-NEXT:    [[COERCE_REALP:%.*]] = getelementptr inbounds nuw { float, 
float }, ptr [[COERCE]], i32 0, i32 0, !dbg [[DBG38]]
+// CHECK1-NEXT:    [[COERCE_IMAGP:%.*]] = getelementptr inbounds nuw { float, 
float }, ptr [[COERCE]], i32 0, i32 1, !dbg [[DBG38]]
+// CHECK1-NEXT:    store float [[B_ADDR_REAL]], ptr [[COERCE_REALP]], align 4, 
!dbg [[DBG38]]
+// CHECK1-NEXT:    store float [[B_ADDR_IMAG]], ptr [[COERCE_IMAGP]], align 4, 
!dbg [[DBG38]]
+// CHECK1-NEXT:    [[TMP2:%.*]] = load <2 x float>, ptr [[COERCE]], align 4, 
!dbg [[DBG38]]
+// CHECK1-NEXT:    call void @_Z1av.omp_outlined_debug__(ptr noundef [[TMP0]], 
ptr noundef [[TMP1]], <2 x float> noundef [[TMP2]]) #[[ATTR3:[0-9]+]], !dbg 
[[DBG38]]
 // CHECK1-NEXT:    ret void, !dbg [[DBG38]]
 //
diff --git a/clang/test/OpenMP/debug-info-openmp-array.cpp 
b/clang/test/OpenMP/debug-info-openmp-array.cpp
index b6a8d6f859a951..4689e11c9499a6 100644
--- a/clang/test/OpenMP/debug-info-openmp-array.cpp
+++ b/clang/test/OpenMP/debug-info-openmp-array.cpp
@@ -172,6 +172,6 @@ void f(int m) {
 // CHECK1-NEXT:    [[TMP4:%.*]] = load ptr, ptr [[DOTBOUND_TID__ADDR]], align 
8, !dbg [[DBG72]]
 // CHECK1-NEXT:    [[TMP5:%.*]] = load ptr, ptr [[M_ADDR]], align 8, !dbg 
[[DBG72]]
 // CHECK1-NEXT:    [[TMP6:%.*]] = load ptr, ptr [[CEN_ADDR]], align 8, !dbg 
[[DBG72]]
-// CHECK1-NEXT:    call void @_Z1fi.omp_outlined_debug__(ptr [[TMP3]], ptr 
[[TMP4]], ptr [[TMP5]], i64 [[TMP1]], ptr [[TMP6]]) #[[ATTR3:[0-9]+]], !dbg 
[[DBG72]]
+// CHECK1-NEXT:    call void @_Z1fi.omp_outlined_debug__(ptr noundef [[TMP3]], 
ptr noundef [[TMP4]], ptr noundef nonnull align 4 dereferenceable(4) [[TMP5]], 
i64 noundef [[TMP1]], ptr no...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/242299
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to