[llvm-branch-commits] [llvm] [llvm][fatlto] Drop any CFI related instrumentation after emitting bitcode (PR #112788)

Paul Kirth via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Oct 30 08:42:45 PDT 2024


https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/112788

>From ad89d61e60bac57cf8c66a974d741377ebe1db30 Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulkirth at google.com>
Date: Fri, 18 Oct 2024 01:59:26 +0000
Subject: [PATCH] Use new enum in constructor

Created using spr 1.3.4
---
 llvm/lib/Passes/PassBuilderPipelines.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index aec79304ab5c3c..0585e83e59a9ab 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -1631,8 +1631,11 @@ PassBuilder::buildFatLTODefaultPipeline(OptimizationLevel Level, bool ThinLTO,
   MPM.addPass(EmbedBitcodePass(ThinLTO, EmitSummary));
 
   // If we're doing FatLTO w/ CFI enabled, we don't want the type tests in the
-  // object file.
-  MPM.addPass(LowerTypeTestsPass(nullptr, nullptr, true, true));
+  // object code, only in the bitcode section, so drop it before we run
+  // module optimization and generate machine code. If llvm.type.test() isn't in
+  // the IR, this won't do anything.
+  MPM.addPass(
+      LowerTypeTestsPass(nullptr, nullptr, lowertypetests::DropTestKind::All));
 
   // Use the ThinLTO post-link pipeline with sample profiling
   if (ThinLTO && PGOOpt && PGOOpt->Action == PGOOptions::SampleUse)



More information about the llvm-branch-commits mailing list