[llvm] [Passes] opt Segmentation fault with the pass "codegenprepare" (PR #89566)

via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 21 20:31:46 PDT 2024


https://github.com/coderchenlin updated https://github.com/llvm/llvm-project/pull/89566

>From d2965ce76903589a474dade873c2e688d390b5fe Mon Sep 17 00:00:00 2001
From: coderchenlin <chenlin138 at huawei.com>
Date: Mon, 22 Apr 2024 11:11:12 +0800
Subject: [PATCH] [Passes] The passes executed with "opt" tools should be
 independent from target. However, the CodegenPrepare pass is depended on
 target, it needs target to implement "getSubtargetImpl". the follow command
 will make the programe crash.

 "opt -passes=codegenprepare mutant.bc -o mutant.opt.bc"

Thus, I think removing CodegenPrepare form PassRegistry is the best
way to stop it.

 fixes #88692
---
 llvm/lib/Passes/PassRegistry.def | 1 -
 1 file changed, 1 deletion(-)

diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def
index 41f16d0915bf23..abb1227f5cab2d 100644
--- a/llvm/lib/Passes/PassRegistry.def
+++ b/llvm/lib/Passes/PassRegistry.def
@@ -309,7 +309,6 @@ FUNCTION_PASS("break-crit-edges", BreakCriticalEdgesPass())
 FUNCTION_PASS("callbr-prepare", CallBrPreparePass())
 FUNCTION_PASS("callsite-splitting", CallSiteSplittingPass())
 FUNCTION_PASS("chr", ControlHeightReductionPass())
-FUNCTION_PASS("codegenprepare", CodeGenPreparePass(TM))
 FUNCTION_PASS("consthoist", ConstantHoistingPass())
 FUNCTION_PASS("constraint-elimination", ConstraintEliminationPass())
 FUNCTION_PASS("coro-elide", CoroElidePass())



More information about the llvm-commits mailing list