[clang] [llvm] [EntryExitInstrumenter] Move passes out of clang into LLVM default pipelines (PR #92171)

2024-05-31 Thread Egor Pasko via cfe-commits
pasko wrote: > looks like `CodeGen/AMDGPU/llc-pipeline.ll` is failing Fixed. https://github.com/llvm/llvm-project/pull/92171 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [EntryExitInstrumenter] Move passes out of clang into LLVM default pipelines (PR #92171)

2024-05-30 Thread Egor Pasko via cfe-commits
https://github.com/pasko updated https://github.com/llvm/llvm-project/pull/92171 >From df3f8dfc47cd8d7b220ed712dc7c2cab1c563f50 Mon Sep 17 00:00:00 2001 From: Egor Pasko Date: Mon, 6 May 2024 19:48:59 +0200 Subject: [PATCH 01/16] wip: Move instrumentation passes This change is not ready for

[clang] [llvm] [EntryExitInstrumenter] Move passes out of clang into LLVM default pipelines (PR #92171)

2024-05-30 Thread Egor Pasko via cfe-commits
@@ -1030,6 +1036,12 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level, Phase != ThinOrFullLTOPhase::ThinLTOPostLink) MPM.addPass(SampleProfileProbePass(TM)); + // Instrument function entry and exit before all inlining. + if

[clang] [llvm] [EntryExitInstrumenter] Move passes out of clang into LLVM default pipelines (PR #92171)

2024-05-30 Thread Egor Pasko via cfe-commits
https://github.com/pasko updated https://github.com/llvm/llvm-project/pull/92171 >From df3f8dfc47cd8d7b220ed712dc7c2cab1c563f50 Mon Sep 17 00:00:00 2001 From: Egor Pasko Date: Mon, 6 May 2024 19:48:59 +0200 Subject: [PATCH 01/15] wip: Move instrumentation passes This change is not ready for

[clang] [llvm] [EntryExitInstrumenter] Move passes out of clang into LLVM default pipelines (PR #92171)

2024-05-27 Thread Egor Pasko via cfe-commits
@@ -1030,6 +1036,12 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level, Phase != ThinOrFullLTOPhase::ThinLTOPostLink) MPM.addPass(SampleProfileProbePass(TM)); + // Instrument function entry and exit before all inlining. + if

[clang] [llvm] [EntryExitInstrumenter] Move passes out of clang into LLVM default pipelines (PR #92171)

2024-05-27 Thread Egor Pasko via cfe-commits
https://github.com/pasko updated https://github.com/llvm/llvm-project/pull/92171 >From df3f8dfc47cd8d7b220ed712dc7c2cab1c563f50 Mon Sep 17 00:00:00 2001 From: Egor Pasko Date: Mon, 6 May 2024 19:48:59 +0200 Subject: [PATCH 01/12] wip: Move instrumentation passes This change is not ready for

[clang] [llvm] [EntryExitInstrumenter] Move passes out of clang into LLVM default pipelines (PR #92171)

2024-05-27 Thread Egor Pasko via cfe-commits
@@ -1,25 +1,13 @@ // RUN: %clang_cc1 -pg -triple powerpc-ibm-aix7.2.0.0 -emit-llvm %s -o - | FileCheck %s pasko wrote: Done. https://github.com/llvm/llvm-project/pull/92171 ___ cfe-commits mailing list

[clang] [llvm] [EntryExitInstrumenter] Move passes out of clang into LLVM default pipelines (PR #92171)

2024-05-27 Thread Egor Pasko via cfe-commits
@@ -1,5 +1,5 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -debug-info-kind=standalone -emit-llvm -o - %s -finstrument-functions | FileCheck %s pasko wrote: Done. https://github.com/llvm/llvm-project/pull/92171

[clang] [llvm] [EntryExitInstrumenter] Move passes out of clang into LLVM default pipelines (PR #92171)

2024-05-27 Thread Egor Pasko via cfe-commits
https://github.com/pasko edited https://github.com/llvm/llvm-project/pull/92171 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Move instrumentation passes (PR #92171)

2024-05-24 Thread Egor Pasko via cfe-commits
https://github.com/pasko ready_for_review https://github.com/llvm/llvm-project/pull/92171 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Move instrumentation passes (PR #92171)

2024-05-24 Thread Egor Pasko via cfe-commits
https://github.com/pasko edited https://github.com/llvm/llvm-project/pull/92171 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Move instrumentation passes (PR #92171)

2024-05-24 Thread Egor Pasko via cfe-commits
https://github.com/pasko edited https://github.com/llvm/llvm-project/pull/92171 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-24 Thread Egor Pasko via cfe-commits
https://github.com/pasko updated https://github.com/llvm/llvm-project/pull/92171 >From df3f8dfc47cd8d7b220ed712dc7c2cab1c563f50 Mon Sep 17 00:00:00 2001 From: Egor Pasko Date: Mon, 6 May 2024 19:48:59 +0200 Subject: [PATCH 01/11] wip: Move instrumentation passes This change is not ready for

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-24 Thread Egor Pasko via cfe-commits
@@ -1,37 +1,27 @@ // REQUIRES: x86-registered-target -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -finstrument-functions -O0 -o - -emit-llvm %s | FileCheck %s -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -finstrument-functions -O2 -o - -emit-llvm %s | FileCheck %s

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-24 Thread Egor Pasko via cfe-commits
@@ -1,37 +1,27 @@ // REQUIRES: x86-registered-target -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -finstrument-functions -O0 -o - -emit-llvm %s | FileCheck %s -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -finstrument-functions -O2 -o - -emit-llvm %s | FileCheck %s

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-24 Thread Egor Pasko via cfe-commits
@@ -1,37 +1,27 @@ // REQUIRES: x86-registered-target -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -finstrument-functions -O0 -o - -emit-llvm %s | FileCheck %s -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -finstrument-functions -O2 -o - -emit-llvm %s | FileCheck %s

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-23 Thread Egor Pasko via cfe-commits
https://github.com/pasko updated https://github.com/llvm/llvm-project/pull/92171 >From df3f8dfc47cd8d7b220ed712dc7c2cab1c563f50 Mon Sep 17 00:00:00 2001 From: Egor Pasko Date: Mon, 6 May 2024 19:48:59 +0200 Subject: [PATCH 01/10] wip: Move instrumentation passes This change is not ready for

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-23 Thread Egor Pasko via cfe-commits
@@ -1,41 +0,0 @@ -// REQUIRES: arm-registered-target,aarch64-registered-target - -// RUN: %clang -target armv7-unknown-none-eabi -pg -S -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,UNSUPPORTED -// RUN: %clang -target armv7-unknown-none-eabi -pg -meabi gnu -S

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-23 Thread Egor Pasko via cfe-commits
https://github.com/pasko updated https://github.com/llvm/llvm-project/pull/92171 >From df3f8dfc47cd8d7b220ed712dc7c2cab1c563f50 Mon Sep 17 00:00:00 2001 From: Egor Pasko Date: Mon, 6 May 2024 19:48:59 +0200 Subject: [PATCH 1/9] wip: Move instrumentation passes This change is not ready for

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-23 Thread Egor Pasko via cfe-commits
https://github.com/pasko updated https://github.com/llvm/llvm-project/pull/92171 >From df3f8dfc47cd8d7b220ed712dc7c2cab1c563f50 Mon Sep 17 00:00:00 2001 From: Egor Pasko Date: Mon, 6 May 2024 19:48:59 +0200 Subject: [PATCH 1/9] wip: Move instrumentation passes This change is not ready for

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-23 Thread Egor Pasko via cfe-commits
@@ -0,0 +1,44 @@ +; RUN: opt -passes="default" -S < %s | FileCheck -check-prefix=PRELTO %s +; RUN: opt -passes="default" -S < %s | FileCheck -check-prefix=PRELTO %s +; RUN: opt -passes="thinlto-pre-link,thinlto" -S < %s | FileCheck -check-prefix=PRELTO %s pasko

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-23 Thread Egor Pasko via cfe-commits
@@ -0,0 +1,44 @@ +; RUN: opt -passes="default" -S < %s | FileCheck -check-prefix=PRELTO %s pasko wrote: Done. Went with INSTRUMENT/NOINSTRUMENT. https://github.com/llvm/llvm-project/pull/92171 ___ cfe-commits mailing

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-23 Thread Egor Pasko via cfe-commits
@@ -0,0 +1,44 @@ +; RUN: opt -passes="default" -S < %s | FileCheck -check-prefix=PRELTO %s +; RUN: opt -passes="default" -S < %s | FileCheck -check-prefix=PRELTO %s +; RUN: opt -passes="thinlto-pre-link,thinlto" -S < %s | FileCheck -check-prefix=PRELTO %s +; RUN: opt

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-23 Thread Egor Pasko via cfe-commits
@@ -0,0 +1,29 @@ +; RUN: llc -mtriple=x86_64-- -O0 < %s | FileCheck %s +; RUN: llc -mtriple=x86_64-- -O1 < %s | FileCheck %s +; RUN: llc -mtriple=x86_64-- -O2 < %s | FileCheck %s + +; The codegen should insert post-inlining instrumentation calls and should not +; insert

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-22 Thread Egor Pasko via cfe-commits
@@ -0,0 +1,31 @@ +; RUN: opt -passes="default" -S < %s | FileCheck %s pasko wrote: Done, I think, but it is evening, and I might be missing something. https://github.com/llvm/llvm-project/pull/92171 ___ cfe-commits

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-22 Thread Egor Pasko via cfe-commits
https://github.com/pasko updated https://github.com/llvm/llvm-project/pull/92171 >From df3f8dfc47cd8d7b220ed712dc7c2cab1c563f50 Mon Sep 17 00:00:00 2001 From: Egor Pasko Date: Mon, 6 May 2024 19:48:59 +0200 Subject: [PATCH 1/7] wip: Move instrumentation passes This change is not ready for

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-22 Thread Egor Pasko via cfe-commits
https://github.com/pasko updated https://github.com/llvm/llvm-project/pull/92171 >From df3f8dfc47cd8d7b220ed712dc7c2cab1c563f50 Mon Sep 17 00:00:00 2001 From: Egor Pasko Date: Mon, 6 May 2024 19:48:59 +0200 Subject: [PATCH 1/6] wip: Move instrumentation passes This change is not ready for

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-22 Thread Egor Pasko via cfe-commits
@@ -0,0 +1,31 @@ +; RUN: opt -passes="default" -S < %s | FileCheck %s +; RUN: opt -passes="thinlto-pre-link" -S < %s | FileCheck %s +; RUN: opt -passes="thinlto-pre-link,thinlto" -S < %s | FileCheck %s pasko wrote: Ah, good idea! I still went with O2 for

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-22 Thread Egor Pasko via cfe-commits
@@ -0,0 +1,31 @@ +; RUN: opt -passes="default" -S < %s | FileCheck %s +; RUN: opt -passes="thinlto-pre-link" -S < %s | FileCheck %s +; RUN: opt -passes="thinlto-pre-link,thinlto" -S < %s | FileCheck %s + +target triple = "x86_64-unknown-linux" + +define void @leaf_function() #0 {

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-22 Thread Egor Pasko via cfe-commits
@@ -0,0 +1,29 @@ +; RUN: llc -mtriple=x86_64-- -O0 < %s | FileCheck %s +; RUN: llc -mtriple=x86_64-- -O1 < %s | FileCheck %s +; RUN: llc -mtriple=x86_64-- -O2 < %s | FileCheck %s + +; The codegen should insert post-inlining instrumentation calls and should not +; insert

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-21 Thread Egor Pasko via cfe-commits
pasko wrote: Hello @aeubanks, I added a couple of new tests as you suggested. I do not have good intuition on their coverage. I think I will need to add a few cases, like always_inline or slightly more complicated code. Can you please take a look at the general structure? Does it roughly

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-21 Thread Egor Pasko via cfe-commits
https://github.com/pasko updated https://github.com/llvm/llvm-project/pull/92171 >From df3f8dfc47cd8d7b220ed712dc7c2cab1c563f50 Mon Sep 17 00:00:00 2001 From: Egor Pasko Date: Mon, 6 May 2024 19:48:59 +0200 Subject: [PATCH 1/4] wip: Move instrumentation passes This change is not ready for

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-16 Thread Egor Pasko via cfe-commits
https://github.com/pasko updated https://github.com/llvm/llvm-project/pull/92171 >From df3f8dfc47cd8d7b220ed712dc7c2cab1c563f50 Mon Sep 17 00:00:00 2001 From: Egor Pasko Date: Mon, 6 May 2024 19:48:59 +0200 Subject: [PATCH 1/3] wip: Move instrumentation passes This change is not ready for

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-16 Thread Egor Pasko via cfe-commits
@@ -1028,6 +1029,14 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level, Phase != ThinOrFullLTOPhase::ThinLTOPostLink) MPM.addPass(SampleProfileProbePass(TM)); + // Instrument function entry and exit before all inlining. + if (Phase !=

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-16 Thread Egor Pasko via cfe-commits
@@ -101,6 +101,7 @@ void initializeEarlyMachineLICMPass(PassRegistry&); void initializeEarlyTailDuplicatePass(PassRegistry&); void initializeEdgeBundlesPass(PassRegistry&); void initializeEHContGuardCatchretPass(PassRegistry &); +void

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-15 Thread Egor Pasko via cfe-commits
pasko wrote: @aeubanks Thanks for the first set of comments. I think I addressed them all and checked that instrumentation is still WAI in my ThinkLTO example. I did not run/update tests yet, this is TBD. Another round of review pre-tests would be appreciated.

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-15 Thread Egor Pasko via cfe-commits
pasko wrote: > can you add links to https://reviews.llvm.org/D97608, > [rust-lang/rust#92109](https://github.com/rust-lang/rust/issues/92109), #52853 Done (Updated the toplevel comment on the PR) https://github.com/llvm/llvm-project/pull/92171 ___

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-15 Thread Egor Pasko via cfe-commits
https://github.com/pasko edited https://github.com/llvm/llvm-project/pull/92171 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-15 Thread Egor Pasko via cfe-commits
https://github.com/pasko updated https://github.com/llvm/llvm-project/pull/92171 >From df3f8dfc47cd8d7b220ed712dc7c2cab1c563f50 Mon Sep 17 00:00:00 2001 From: Egor Pasko Date: Mon, 6 May 2024 19:48:59 +0200 Subject: [PATCH 1/2] wip: Move instrumentation passes This change is not ready for

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-15 Thread Egor Pasko via cfe-commits
https://github.com/pasko edited https://github.com/llvm/llvm-project/pull/92171 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-15 Thread Egor Pasko via cfe-commits
@@ -135,6 +138,65 @@ static bool runOnFunction(Function , bool PostInlining) { return Changed; } +namespace { +struct EntryExitInstrumenter : public FunctionPass { + static char ID; + EntryExitInstrumenter() : FunctionPass(ID) { +

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-15 Thread Egor Pasko via cfe-commits
@@ -1016,6 +1000,11 @@ void EmitAssemblyHelper::RunOptimizationPipeline( if (!IsThinLTOPostLink) { addSanitizers(TargetTriple, CodeGenOpts, LangOpts, PB); addKCFIPass(TargetTriple, LangOpts, PB); + PB.registerPipelineStartEPCallback( pasko

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-15 Thread Egor Pasko via cfe-commits
@@ -670,9 +670,6 @@ void CodeGenPassBuilder::addIRPasses( !Opt.DisablePartialLibcallInlining) addPass(PartiallyInlineLibCallsPass()); - // Instrument function entry and exit, e.g. with calls to mcount(). - addPass(EntryExitInstrumenterPass(/*PostInlining=*/true));

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-14 Thread Egor Pasko via cfe-commits
https://github.com/pasko converted_to_draft https://github.com/llvm/llvm-project/pull/92171 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-14 Thread Egor Pasko via cfe-commits
https://github.com/pasko created https://github.com/llvm/llvm-project/pull/92171 This change is not ready for landing yet. Move EntryExitInstrumenter(PostInlining=true) to as late as possible and EntryExitInstrumenter(PostInlining=false) to an early pre-inlining stage (but skip for ThinLTO