Skip to content

Commit 77f91f5

Browse files
committed
[KeyInstr][Clang] Agg copy atom
1 parent c1ec75f commit 77f91f5

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

clang/lib/CodeGen/CGExprAgg.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,6 +1332,7 @@ static bool isBlockVarRef(const Expr *E) {
13321332
}
13331333

13341334
void AggExprEmitter::VisitBinAssign(const BinaryOperator *E) {
1335+
ApplyAtomGroup Grp(CGF.getDebugInfo());
13351336
// For an assignment to work, the value on the right has
13361337
// to be compatible with the value on the left.
13371338
assert(CGF.getContext().hasSameUnqualifiedType(E->getLHS()->getType(),

clang/lib/CodeGen/CodeGenFunction.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3042,6 +3042,7 @@ class CodeGenFunction : public CodeGenTypeCache {
30423042

30433043
/// Emit an aggregate assignment.
30443044
void EmitAggregateAssign(LValue Dest, LValue Src, QualType EltTy) {
3045+
ApplyAtomGroup Grp(getDebugInfo());
30453046
bool IsVolatile = hasVolatileMember(EltTy);
30463047
EmitAggregateCopy(Dest, Src, EltTy, AggValueSlot::MayOverlap, IsVolatile);
30473048
}

clang/test/KeyInstructions/agg.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1+
// RUN: %clang -gkey-instructions -x c++ %s -gmlt -S -emit-llvm -o - \
2+
// RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank
13

2-
// RUN: %clang -gkey-instructions %s -gmlt -S -emit-llvm -o - \
4+
// RUN: %clang -gkey-instructions -x c %s -gmlt -S -emit-llvm -o - \
35
// RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank
46

57
typedef struct { int a, b, c; } Struct;
68
void fun(Struct a) {
7-
// CHECK: call void @llvm.memcpy{{.*}}, !dbg [[G1R1:!.*]]
9+
// CHECK: call void @llvm.memcpy{{.*}}, !dbg [[G1R1:!.*]]
810
Struct b = a;
11+
12+
// CHECK: call void @llvm.memcpy{{.*}}, !dbg [[G2R1:!.*]]
13+
b = a;
914
}
1015

1116
// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
12-
17+
// CHECK: [[G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)

0 commit comments

Comments
 (0)