[KeyInstr][Clang] Agg copy atom

This commit is contained in:
Orlando Cazalet-Hyams 2025-04-03 16:00:26 +01:00
parent c1ec75f22a
commit 77f91f53a7
3 changed files with 10 additions and 3 deletions

View File

@ -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(),

View File

@ -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);
}

View File

@ -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)