diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp index 53858932ede0..26bc2666d975 100644 --- a/clang/lib/CodeGen/CGExprAgg.cpp +++ b/clang/lib/CodeGen/CGExprAgg.cpp @@ -1332,6 +1332,7 @@ static bool isBlockVarRef(const Expr *E) { } void AggExprEmitter::VisitBinAssign(const BinaryOperator *E) { + ApplyAtomGroup Grp(CGF.getDebugInfo()); // For an assignment to work, the value on the right has // to be compatible with the value on the left. assert(CGF.getContext().hasSameUnqualifiedType(E->getLHS()->getType(), diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index d8b1c4e4efb7..0a72784f311e 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -3042,6 +3042,7 @@ public: /// Emit an aggregate assignment. void EmitAggregateAssign(LValue Dest, LValue Src, QualType EltTy) { + ApplyAtomGroup Grp(getDebugInfo()); bool IsVolatile = hasVolatileMember(EltTy); EmitAggregateCopy(Dest, Src, EltTy, AggValueSlot::MayOverlap, IsVolatile); } diff --git a/clang/test/KeyInstructions/agg.c b/clang/test/KeyInstructions/agg.c index 5990859a5b54..177e1ea8b9fc 100644 --- a/clang/test/KeyInstructions/agg.c +++ b/clang/test/KeyInstructions/agg.c @@ -1,12 +1,17 @@ +// RUN: %clang -gkey-instructions -x c++ %s -gmlt -S -emit-llvm -o - \ +// RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank -// RUN: %clang -gkey-instructions %s -gmlt -S -emit-llvm -o - \ +// RUN: %clang -gkey-instructions -x c %s -gmlt -S -emit-llvm -o - \ // RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank typedef struct { int a, b, c; } Struct; void fun(Struct a) { -// CHECK: call void @llvm.memcpy{{.*}}, !dbg [[G1R1:!.*]] +// CHECK: call void @llvm.memcpy{{.*}}, !dbg [[G1R1:!.*]] Struct b = a; + +// CHECK: call void @llvm.memcpy{{.*}}, !dbg [[G2R1:!.*]] + b = a; } // CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1) - +// CHECK: [[G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)