Skip to content

Commit e92a5d1

Browse files
committed
Compound assign
1 parent b6f42ab commit e92a5d1

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

clang/lib/CodeGen/CGExprScalar.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,7 @@ class ScalarExprEmitter
897897
return result; \
898898
} \
899899
Value *VisitBin##OP##Assign(const CompoundAssignOperator *E) { \
900+
ApplyAtomGroup Grp(CGF.getDebugInfo()); \
900901
return EmitCompoundAssign(E, &ScalarExprEmitter::Emit##OP); \
901902
}
902903
HANDLEBINOP(Mul)
@@ -5741,6 +5742,7 @@ LValue CodeGenFunction::EmitObjCIsaExpr(const ObjCIsaExpr *E) {
57415742

57425743
LValue CodeGenFunction::EmitCompoundAssignmentLValue(
57435744
const CompoundAssignOperator *E) {
5745+
ApplyAtomGroup Grp(getDebugInfo());
57445746
ScalarExprEmitter Scalar(*this);
57455747
Value *Result = nullptr;
57465748
switch (E->getOpcode()) {

clang/test/KeyInstructions/assign.cpp renamed to clang/test/KeyInstructions/assign-scalar.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// RUN: %clang -gkey-instructions %s -gmlt -gcolumn-info -S -emit-llvm -o - -Wno-unused-variable \
1+
// RUN: %clang -gkey-instructions -x c++ %s -gmlt -gcolumn-info -S -emit-llvm -o - -Wno-unused-variable \
2+
// RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank
3+
4+
// RUN: %clang -gkey-instructions -x c %s -gmlt -gcolumn-info -S -emit-llvm -o - -Wno-unused-variable \
25
// RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank
36

47
unsigned long long g;
@@ -15,9 +18,17 @@ void fun() {
1518
// CHECK-NEXT: store i64 %0, ptr @g{{.*}}, !dbg [[G3R1:!.*]]
1619
// CHECK-NEXT: store i64 %0, ptr @g{{.*}}, !dbg [[G2R1:!.*]]
1720
g = g = g;
21+
22+
// Compound assignment.
23+
// CHECK: %1 = load i64, ptr @g
24+
// CHECK: %add = add i64 %1, 50, !dbg [[G4R2:!.*]]
25+
// CHECK: store i64 %add, ptr @g{{.*}}, !dbg [[G4R1:!.*]]
26+
g += 50;
1827
}
1928

2029
// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
2130
// CHECK: [[G2R2]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 2)
2231
// CHECK: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1)
2332
// CHECK: [[G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)
33+
// CHECK: [[G4R2]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 2)
34+
// CHECK: [[G4R1]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 1)

0 commit comments

Comments
 (0)