Skip to content

[KeyInstr][Clang] Ret atom #134652

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: users/OCHyams/ki-clang-builtins
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion clang/lib/CodeGen/CGCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3883,7 +3883,8 @@ void CodeGenFunction::EmitFunctionEpilog(const CGFunctionInfo &FI,

// Functions with no result always return void.
if (!ReturnValue.isValid()) {
Builder.CreateRetVoid();
auto *I = Builder.CreateRetVoid();
addRetToOverrideOrNewSourceAtom(I, nullptr);
return;
}

Expand Down Expand Up @@ -4065,6 +4066,9 @@ void CodeGenFunction::EmitFunctionEpilog(const CGFunctionInfo &FI,

if (RetDbgLoc)
Ret->setDebugLoc(std::move(RetDbgLoc));

llvm::Value *Backup = RV ? Ret->getOperand(0) : nullptr;
addRetToOverrideOrNewSourceAtom(cast<llvm::ReturnInst>(Ret), Backup);
}

void CodeGenFunction::EmitReturnValueCheck(llvm::Value *RV) {
Expand Down
2 changes: 2 additions & 0 deletions clang/lib/CodeGen/CGCleanup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1118,6 +1118,8 @@ void CodeGenFunction::EmitBranchThroughCleanup(JumpDest Dest) {

// Create the branch.
llvm::BranchInst *BI = Builder.CreateBr(Dest.getBlock());
// This is the primary instruction for this atom, acting in place of a ret.
addInstToCurrentSourceAtom(BI, nullptr);

// Calculate the innermost active normal cleanup.
EHScopeStack::stable_iterator
Expand Down
13 changes: 9 additions & 4 deletions clang/lib/CodeGen/CGStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1594,6 +1594,7 @@ static bool isSwiftAsyncCallee(const CallExpr *CE) {
/// if the function returns void, or may be missing one if the function returns
/// non-void. Fun stuff :).
void CodeGenFunction::EmitReturnStmt(const ReturnStmt &S) {
ApplyAtomGroup Grp(getDebugInfo());
if (requiresReturnValueCheck()) {
llvm::Constant *SLoc = EmitCheckSourceLocation(S.getBeginLoc());
auto *SLocPtr =
Expand All @@ -1603,6 +1604,7 @@ void CodeGenFunction::EmitReturnStmt(const ReturnStmt &S) {
CGM.getSanitizerMetadata()->disableSanitizerForGlobal(SLocPtr);
assert(ReturnLocation.isValid() && "No valid return location");
Builder.CreateStore(SLocPtr, ReturnLocation);
//*OCH?*//
}

// Returning from an outlined SEH helper is UB, and we already warn on it.
Expand Down Expand Up @@ -1669,16 +1671,19 @@ void CodeGenFunction::EmitReturnStmt(const ReturnStmt &S) {
// If this function returns a reference, take the address of the expression
// rather than the value.
RValue Result = EmitReferenceBindingToExpr(RV);
Builder.CreateStore(Result.getScalarVal(), ReturnValue);
auto *I = Builder.CreateStore(Result.getScalarVal(), ReturnValue);
addInstToCurrentSourceAtom(I, I->getValueOperand());
} else {
switch (getEvaluationKind(RV->getType())) {
case TEK_Scalar: {
llvm::Value *Ret = EmitScalarExpr(RV);
if (CurFnInfo->getReturnInfo().getKind() == ABIArgInfo::Indirect)
if (CurFnInfo->getReturnInfo().getKind() == ABIArgInfo::Indirect) {
EmitStoreOfScalar(Ret, MakeAddrLValue(ReturnValue, RV->getType()),
/*isInit*/ true);
else
Builder.CreateStore(Ret, ReturnValue);
} else {
auto *I = Builder.CreateStore(Ret, ReturnValue);
addInstToCurrentSourceAtom(I, I->getValueOperand());
}
break;
}
case TEK_Complex:
Expand Down
16 changes: 16 additions & 0 deletions clang/lib/CodeGen/CodeGenFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "clang/CodeGen/CGFunctionInfo.h"
#include "clang/Frontend/FrontendDiagnostic.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/Frontend/OpenMP/OMPIRBuilder.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Dominators.h"
Expand Down Expand Up @@ -339,6 +340,15 @@ llvm::DebugLoc CodeGenFunction::EmitReturnBlock() {
// later by the actual 'ret' instruction.
llvm::DebugLoc Loc = BI->getDebugLoc();
Builder.SetInsertPoint(BI->getParent());

// Key Instructions: If there's only one `ret` then we want to put the
// instruction in the same source atom group as the store to the ret-value
// alloca and unconditional `br` to the return block that we're about to
// delete. It all comes from the same source (`return (value)`).
if (auto *DI = getDebugInfo(); DI && BI->getDebugLoc())
DI->setRetInstSourceAtomOverride(
BI->getDebugLoc().get()->getAtomGroup());

BI->eraseFromParent();
delete ReturnBlock.getBlock();
ReturnBlock = JumpDest();
Expand Down Expand Up @@ -1543,6 +1553,12 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
Bypasses.Init(CGM, Body);
}

// Finalize function debug info on exit.
auto Cleanup = llvm::make_scope_exit([this] {
if (CGDebugInfo *DI = getDebugInfo())
DI->completeFunction();
});

// Emit the standard function prologue.
StartFunction(GD, ResTy, Fn, FnInfo, Args, Loc, BodyRange.getBegin());

Expand Down
3 changes: 3 additions & 0 deletions clang/test/KeyInstructions/agg.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ void fun(Struct a) {
// CHECK: %matins = insertelement <25 x float> %3, float 0.000000e+00, i64 0, !dbg [[G4R2:!.*]]
// CHECK: store <25 x float> %matins, ptr @m{{.*}}, !dbg [[G4R1:!.*]]
m[0][0] = 0;

// CHECK: ret{{.*}}, !dbg [[RET:!.*]]
}

// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
Expand All @@ -32,3 +34,4 @@ void fun(Struct a) {
// CHECK: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1)
// CHECK: [[G4R2]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 2)
// CHECK: [[G4R1]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 1)
// CHECK: [[RET:!.*]] = !DILocation({{.*}}, atomGroup: [[#]], atomRank: [[#]])
3 changes: 3 additions & 0 deletions clang/test/KeyInstructions/assign-scalar.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ void fun() {
// CHECK: %dec = add i64 %3, -1, !dbg [[G6R2:!.*]]
// CHECK: store i64 %dec, ptr @g{{.*}}, !dbg [[G6R1:!.*]]
g--;

// CHECK: ret{{.*}}, !dbg [[RET:!.*]]
}

// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
Expand All @@ -46,3 +48,4 @@ void fun() {
// CHECK: [[G5R1]] = !DILocation({{.*}}, atomGroup: 5, atomRank: 1)
// CHECK: [[G6R2]] = !DILocation({{.*}}, atomGroup: 6, atomRank: 2)
// CHECK: [[G6R1]] = !DILocation({{.*}}, atomGroup: 6, atomRank: 1)
// CHECK: [[RET:!.*]] = !DILocation({{.*}}, atomGroup: [[#]], atomRank: [[#]])
3 changes: 3 additions & 0 deletions clang/test/KeyInstructions/bitfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ void foo(int x, S s) {
// CHECK: %bf.set = or i8 %bf.clear, %bf.value, !dbg [[G1R2:!.*]]
// CHECK: store i8 %bf.set, ptr %s, align 4, !dbg [[G1R1:!.*]]
s.a = x;

// CHECK: ret{{.*}}, !dbg [[RET:!.*]]
}

// CHECK: [[G1R2]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 2)
// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
// CHECK: [[RET:!.*]] = !DILocation({{.*}}, atomGroup: [[#]], atomRank: [[#]])
3 changes: 3 additions & 0 deletions clang/test/KeyInstructions/builtin.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ void fun() {

// CHECK: call void @llvm.memset{{.*}}, !dbg [[G14R1:!.*]]
__builtin___memset_chk(f4, 0, sizeof(float), -1);

// CHECK: ret{{.*}}, !dbg [[RET:!.*]]
}

// CHECK: [[G1R2]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 2)
Expand All @@ -75,3 +77,4 @@ void fun() {
// CHECK: [[G12R1]] = !DILocation({{.*}}, atomGroup: 12, atomRank: 1)
// CHECK: [[G13R1]] = !DILocation({{.*}}, atomGroup: 13, atomRank: 1)
// CHECK: [[G14R1]] = !DILocation({{.*}}, atomGroup: 14, atomRank: 1)
// CHECK: [[RET:!.*]] = !DILocation({{.*}}, atomGroup: [[#]], atomRank: [[#]])
3 changes: 3 additions & 0 deletions clang/test/KeyInstructions/complex.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ void test() {
// CHECK: %add = fadd float %0, %1, !dbg [[G4R2:!.*]]
// CHECK: store float %add, ptr getelementptr inbounds nuw ({ float, float }, ptr @ci, i32 0, i32 1){{.*}}, !dbg [[G4R1:!.*]]
__imag ci = __imag ci + __imag ci;

// CHECK: ret{{.*}}, !dbg [[RET:!.*]]
}

// CHECK: [[G1R2]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 2)
Expand All @@ -38,3 +40,4 @@ void test() {
// CHECK: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1)
// CHECK: [[G4R2]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 2)
// CHECK: [[G4R1]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 1)
// CHECK: [[RET:!.*]] = !DILocation({{.*}}, atomGroup: [[#]], atomRank: [[#]])
3 changes: 3 additions & 0 deletions clang/test/KeyInstructions/do.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ void a(int A) {
// CHECK: %tobool = icmp ne i32 %dec, 0, !dbg [[G2R1:!.*]]
// CHECK: br i1 %tobool, label %do.body, label %do.end, !dbg [[G3R1:!.*]], !llvm.loop
do { } while (--A);

// CHECK: ret{{.*}}, !dbg [[RET:!.*]]
}

// CHECK: [[G1R2]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 2)
// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
// CHECK: [[G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)
// CHECK: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1)
// CHECK: [[RET:!.*]] = !DILocation({{.*}}, atomGroup: [[#]], atomRank: [[#]])
3 changes: 3 additions & 0 deletions clang/test/KeyInstructions/for.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ void a(int A) {
// CHECK: %inc = add{{.*}}, !dbg [[G4R2:!.*]]
// CHECK: store i32 %inc, ptr %i{{.*}}, !dbg [[G4R1:!.*]]
for (int i = 0; i < A; ++i) { }

// CHECK: ret{{.*}}, !dbg [[RET:!.*]]
}

// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
Expand All @@ -35,3 +37,4 @@ void a(int A) {
// CHECK: [[G5R1]] = !DILocation({{.*}}, atomGroup: 5, atomRank: 1)
// CHECK: [[G4R2]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 2)
// CHECK: [[G4R1]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 1)
// CHECK: [[RET:!.*]] = !DILocation({{.*}}, atomGroup: [[#]], atomRank: [[#]])
5 changes: 4 additions & 1 deletion clang/test/KeyInstructions/if.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ void a(int A) {
// CHECK-CXX: br i1 %tobool4, label %if.then5, label %if.end6{{.*}}, !dbg [[G5R1:!.*]]
if (int B = A; B)
;
#endif
#endif

// CHECK: ret{{.*}}, !dbg [[RET:!.*]]
}

// CHECK: [[G1R2]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 2)
Expand All @@ -44,3 +46,4 @@ void a(int A) {
// CHECK-CXX: [[G4R1]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 1)
// CHECK-CXX: [[G5R2]] = !DILocation({{.*}}, atomGroup: 5, atomRank: 2)
// CHECK-CXX: [[G5R1]] = !DILocation({{.*}}, atomGroup: 5, atomRank: 1)
// CHECK: [[RET:!.*]] = !DILocation({{.*}}, atomGroup: [[#]], atomRank: [[#]])
3 changes: 3 additions & 0 deletions clang/test/KeyInstructions/init-agg.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ void a() {

// CHECK: store i8 -86, ptr %uninit{{.*}}, !dbg [[G5R1:!.*]], !annotation
char uninit; // -ftrivial-auto-var-init=pattern

// CHECK: ret{{.*}}, !dbg [[RET:!.*]]
}

// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
Expand All @@ -41,3 +43,4 @@ void a() {
// CHECK: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1)
// CHECK: [[G4R1]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 1)
// CHECK: [[G5R1]] = !DILocation({{.*}}, atomGroup: 5, atomRank: 1)
// CHECK: [[RET:!.*]] = !DILocation({{.*}}, atomGroup: [[#]], atomRank: [[#]])
2 changes: 2 additions & 0 deletions clang/test/KeyInstructions/init-member.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ void fun() {

// CHECK: store i32 1, ptr %x{{.*}}, !dbg [[G1R1:!.*]]
// CHECK: store float 5.000000e+00, ptr %y{{.*}}, !dbg [[G2R1:!.*]]
// CHECK: ret{{.*}}, !dbg [[RET:!.*]]

// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
// CHECK: [[G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)
// CHECK: [[RET:!.*]] = !DILocation({{.*}}, atomGroup: [[#]], atomRank: [[#]])
4 changes: 2 additions & 2 deletions clang/test/KeyInstructions/init-scalar.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ void a() {
// CHECK: %add = add {{.*}}, !dbg [[G2R2:!.*]]
// CHECK: store i32 %add, ptr %B, align 4, !dbg [[G2R1:!.*]]
int B = 2 * A + 1;
// CHECK-TODO: ret{{.*}}, !dbg [[G3R1:!.*]]
// CHECK: ret{{.*}}, !dbg [[G3R1:!.*]]
}

// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
// CHECK: [[G2R2]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 2)
// CHECK: [[G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)
// CHECK-TODO: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1)
// CHECK: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1)
3 changes: 2 additions & 1 deletion clang/test/KeyInstructions/init-static.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ void g(int *a) {
// CHECK: %2 = load ptr, ptr %a.addr{{.*}}, !dbg [[G1R2:!.*]]
// CHECK: store ptr %2, ptr @_ZZ1gPiE1b{{.*}}, !dbg [[G1R1:!.*]]
static int &b = *a;
// CHECK: ret{{.*}}, !dbg [[RET:!.*]]
}

// CHECK: [[G1R2]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 2)
// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)

// CHECK: [[RET:!.*]] = !DILocation({{.*}}, atomGroup: [[#]], atomRank: [[#]])
25 changes: 25 additions & 0 deletions clang/test/KeyInstructions/return-va-arg.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// RUN: %clang -gkey-instructions -gno-column-info -x c++ %s -gmlt -S -emit-llvm -o - \
// RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank

// RUN: %clang -gkey-instructions -gno-column-info -x c %s -gmlt -S -emit-llvm -o - \
// RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank

typedef struct {
struct{} a;
double b;
} s1;

s1 f(int z, ...) {
__builtin_va_list list;
__builtin_va_start(list, z);
// CHECK: vaarg.end:
// CHECK-NEXT: %vaarg.addr = phi ptr
// CHECK-NEXT: call void @llvm.memcpy{{.*}}, !dbg [[G1R1:!.*]]
// CHECK-NEXT: {{.*}} = getelementptr{{.*}}
// CHECK-NEXT: [[LOAD:%.*]] = load double{{.*}}, !dbg [[G1R2:!.*]]
// CHECK-NEXT: ret double [[LOAD]], !dbg [[G1R1]]
return __builtin_va_arg(list, s1);
}

// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
// CHECK: [[G1R2]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 2)
90 changes: 90 additions & 0 deletions clang/test/KeyInstructions/return.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
// RUN: %clang -gkey-instructions -gno-column-info -x c++ %s -gmlt -S -emit-llvm -o - \
// RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-CXX

// RUN: %clang -gkey-instructions -gno-column-info -x c %s -gmlt -S -emit-llvm -o - \
// RUN: | FileCheck %s

// Check the stores to `retval` allocas and branches to `return` block are in
// the same atom group. They are both rank 1, which could in theory introduce
// an extra step in some optimized code. This low risk currently feels an
// acceptable for keeping the code a bit simpler (as opposed to adding
// scaffolding to make the store rank 2).

// Also check that in the case of a single return (no control flow) the
// return instruction inherits the atom group of the branch to the return
// block when the blocks get folded togather.

#ifdef __cplusplus
#define nomangle extern "C"
#else
#define nomangle
#endif

int g;
nomangle float a() {
// CHECK: float @a()
if (g)
// CHECK: if.then:
// CHECK-NEXT: %1 = load i32, ptr @g{{.*}}, !dbg [[G2R3:!.*]]
// CHECK-NEXT: %conv = sitofp i32 %1 to float{{.*}}, !dbg [[G2R2:!.*]]
// CHECK-NEXT: store float %conv, ptr %retval{{.*}}, !dbg [[G2R1:!.*]]
// CHECK-NEXT: br label %return{{.*}}, !dbg [[G2R1]]
return g;
// CHECK: if.end:
// CHECK-NEXT: store float 1.000000e+00, ptr %retval{{.*}}, !dbg [[G3R1:!.*]]
// CHECK-NEXT: br label %return, !dbg [[G3R1]]

// CHECK: return:
// CHECK-NEXT: %2 = load float, ptr %retval{{.*}}, !dbg [[G4R2:!.*]]
// CHECK-NEXT: ret float %2{{.*}}, !dbg [[G4R1:!.*]]
return 1;
}

// CHECK: void @b()
// CHECK: ret void{{.*}}, !dbg [[B_G1R1:!.*]]
nomangle void b() { return; }

// CHECK: i32 @c()
// CHECK: %add = add{{.*}}, !dbg [[C_G1R2:!.*]]
// CHECK: ret i32 %add{{.*}}, !dbg [[C_G1R1:!.*]]
nomangle int c() { return g + 1; }

// NOTE: (return) (g = 1) are two separate atoms.
// CHECK: i32 @d()
// CHECK: store{{.*}}, !dbg [[D_G2R1:!.*]]
// CHECK: ret i32 1{{.*}}, !dbg [[D_G1R1:!.*]]
nomangle int d() { return g = 1; }

// The implicit return here get the line number of the closing brace; make it
// key to match existing behaviour.
// CHECK: ret void, !dbg [[E_G1R1:!.*]]
nomangle void e() {}

#ifdef __cplusplus
// CHECK-CXX: ptr @_Z1fRi
int &f(int &r) {
// Include ctrl-flow to stop ret value store being elided.
if (r)
// CHECK-CXX: if.then:
// CHECK-CXX-NEXT: %2 = load ptr, ptr %r.addr{{.*}}, !dbg [[F_G2R2:!.*]]
// CHECK-CXX-NEXT: store ptr %2, ptr %retval{{.*}}, !dbg [[F_G2R1:!.*]]
// CHECK-CXX-NEXT: br label %return, !dbg [[F_G2R1:!.*]]
return r;
return g;
}
#endif

// CHECK: [[G2R3]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 3)
// CHECK: [[G2R2]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 2)
// CHECK: [[G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)
// CHECK: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1)
// CHECK: [[G4R2]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 2)
// CHECK: [[G4R1]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 1)
// CHECK: [[B_G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
// CHECK: [[C_G1R2]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 2)
// CHECK: [[C_G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
// CHECK: [[D_G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)
// CHECK: [[D_G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
// CHECK: [[E_G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
// CHECK-CXX: [[F_G2R2]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 2)
// CHECK-CXX: [[F_G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)
3 changes: 3 additions & 0 deletions clang/test/KeyInstructions/switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ void a(int A, int B) {
} break;
default: break;
}

// CHECK: ret{{.*}}, !dbg [[RET:!.*]]
}

// CHECK: [[G2R2]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 2)
Expand All @@ -49,3 +51,4 @@ void a(int A, int B) {
// CHECK: [[G3R2]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 2)
// CHECK: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1)
// CHECK-CXX: [[G4R1]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 1)
// CHECK: [[RET:!.*]] = !DILocation({{.*}}, atomGroup: [[#]], atomRank: [[#]])
Loading
Loading