diff options
author | Michael Buch <michaelbuch12@gmail.com> | 2024-05-02 23:18:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-02 23:18:16 +0100 |
commit | 4113e15153d5af39a12c6bcf16e6b35614dc13a2 (patch) | |
tree | 04a727a3ec5f5ebbe12281f0f31bacd1068ddf91 /clang/lib/CodeGen/CodeGenFunction.h | |
parent | 39172bcfe4ca6f4db09da0f76a3e324dd3888a51 (diff) | |
download | llvm-4113e15153d5af39a12c6bcf16e6b35614dc13a2.zip llvm-4113e15153d5af39a12c6bcf16e6b35614dc13a2.tar.gz llvm-4113e15153d5af39a12c6bcf16e6b35614dc13a2.tar.bz2 |
[clang][PGO] Apply artificial DebugLoc to llvm.instrprof.increment instructions (#90717)
Prior to this change the debug-location for the
`llvm.instrprof.increment` intrinsic was set to whatever the current
DIBuilder's current debug location was set to. This meant that for
switch-statements, a counter's location was set to the previous case's
debug-location, causing confusing stepping behaviour in debuggers. This
patch makes sure we attach a dummy debug-location for the increment
instructions.
rdar://123050737
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 6e7417f..ba24831 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -1648,8 +1648,10 @@ public: void incrementProfileCounter(const Stmt *S, llvm::Value *StepV = nullptr) { if (CGM.getCodeGenOpts().hasProfileClangInstr() && !CurFn->hasFnAttribute(llvm::Attribute::NoProfile) && - !CurFn->hasFnAttribute(llvm::Attribute::SkipProfile)) + !CurFn->hasFnAttribute(llvm::Attribute::SkipProfile)) { + auto AL = ApplyDebugLocation::CreateArtificial(*this); PGO.emitCounterSetOrIncrement(Builder, S, StepV); + } PGO.setCurrentStmt(S); } |