Skip to content

Commit b6274d2

Browse files
committed
[KeyInstr][Clang] Multiple assignment (x = y = z)
1 parent 3b4ca1b commit b6274d2

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

clang/lib/CodeGen/CGExprScalar.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5067,6 +5067,7 @@ llvm::Value *CodeGenFunction::EmitWithOriginalRHSBitfieldAssignment(
50675067
}
50685068

50695069
Value *ScalarExprEmitter::VisitBinAssign(const BinaryOperator *E) {
5070+
ApplyAtomGroup Grp(CGF.getDebugInfo());
50705071
bool Ignore = TestAndClearIgnoreResultAssign();
50715072

50725073
Value *RHS;

clang/test/DebugInfo/KeyInstructions/assign.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,22 @@
22
// RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank
33

44
unsigned long long g;
5-
void fun() { g = 0; }
6-
5+
void fun() {
76
// CHECK: store i64 0, ptr @g{{.*}}, !dbg [[G1R1:!.*]]
7+
g = 0;
8+
9+
// Treat the two assignments as two atoms.
10+
//
11+
// FIXME: Because of the atomGroup implementation the load can only be
12+
// associated with one of the two stores, despite being a good backup
13+
// loction for both.
14+
// CHECK-NEXT: %0 = load i64, ptr @g{{.*}}, !dbg [[G2R2:!.*]]
15+
// CHECK-NEXT: store i64 %0, ptr @g{{.*}}, !dbg [[G3R1:!.*]]
16+
// CHECK-NEXT: store i64 %0, ptr @g{{.*}}, !dbg [[G2R1:!.*]]
17+
g = g = g;
18+
}
819

920
// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
21+
// CHECK: [[G2R2]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 2)
22+
// CHECK: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1)
23+
// CHECK: [[G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)

0 commit comments

Comments
 (0)