From ce364576b2687a9bde5fdfcf9d6d5e00de330031 Mon Sep 17 00:00:00 2001 From: Arthur Eubanks Date: Wed, 31 Mar 2021 23:12:36 -0700 Subject: [PATCH] Remove "Rewrite Symbols" from codegen pipeline It breaks up the function pass manager in the codegen pipeline. With empty parameters, it looks at the -mllvm flag -rewrite-map-file. This is likely not in use. Add a check that we only have one function pass manager in the codegen pipeline. This required reverting commit 9583a3f2625818b78c0cf6d473cdedb9f23ad82c: "[AsmPrinter] Delete dead takeDeletedSymbsForFunction()". This was not NFC as initially thought. By coalescing two function psas managers, this exposed the reverted code as necessary. addr-label.ll was crashing due to an emitted blockaddress's block being removed but the label not emitted. Some tests relied on the fact that we had a module pass somewhere in the codegen pipeline. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D99707 --- lib/CodeGen/TargetPassConfig.cpp | 1 - test/CodeGen/AArch64/O0-pipeline.ll | 2 -- test/CodeGen/AArch64/O3-pipeline.ll | 2 -- test/CodeGen/ARM/O3-pipeline.ll | 2 -- test/CodeGen/Generic/addr-label.ll | 2 +- test/CodeGen/X86/O0-pipeline.ll | 2 -- test/CodeGen/X86/opt-pipeline.ll | 10 ++++++++-- test/CodeGen/X86/select_meta.ll | 2 +- test/Other/2010-05-06-Printer.ll | 2 -- 9 files changed, 10 insertions(+), 15 deletions(-) diff --git a/lib/CodeGen/TargetPassConfig.cpp b/lib/CodeGen/TargetPassConfig.cpp index 6e802354236..51454aa5c2a 100644 --- a/lib/CodeGen/TargetPassConfig.cpp +++ b/lib/CodeGen/TargetPassConfig.cpp @@ -924,7 +924,6 @@ void TargetPassConfig::addPassesToHandleExceptions() { void TargetPassConfig::addCodeGenPrepare() { if (getOptLevel() != CodeGenOpt::None && !DisableCGP) addPass(createCodeGenPreparePass()); - addPass(createRewriteSymbolsPass()); } /// Add common passes that perform LLVM IR to IR transforms in preparation for diff --git a/test/CodeGen/AArch64/O0-pipeline.ll b/test/CodeGen/AArch64/O0-pipeline.ll index 9cb9df9771d..e9351068eec 100644 --- a/test/CodeGen/AArch64/O0-pipeline.ll +++ b/test/CodeGen/AArch64/O0-pipeline.ll @@ -24,8 +24,6 @@ ; CHECK-NEXT: Scalarize Masked Memory Intrinsics ; CHECK-NEXT: Expand reduction intrinsics ; CHECK-NEXT: AArch64 Stack Tagging -; CHECK-NEXT: Rewrite Symbols -; CHECK-NEXT: FunctionPass Manager ; CHECK-NEXT: Exception handling preparation ; CHECK-NEXT: Safe Stack instrumentation pass ; CHECK-NEXT: Insert stack protectors diff --git a/test/CodeGen/AArch64/O3-pipeline.ll b/test/CodeGen/AArch64/O3-pipeline.ll index 0437adc8b9b..737e73af789 100644 --- a/test/CodeGen/AArch64/O3-pipeline.ll +++ b/test/CodeGen/AArch64/O3-pipeline.ll @@ -76,8 +76,6 @@ ; CHECK-NEXT: Interleaved Access Pass ; CHECK-NEXT: Natural Loop Information ; CHECK-NEXT: CodeGen Prepare -; CHECK-NEXT: Rewrite Symbols -; CHECK-NEXT: FunctionPass Manager ; CHECK-NEXT: Dominator Tree Construction ; CHECK-NEXT: Exception handling preparation ; CHECK-NEXT: AArch64 Promote Constant diff --git a/test/CodeGen/ARM/O3-pipeline.ll b/test/CodeGen/ARM/O3-pipeline.ll index 118beab8d29..dea1377bdc2 100644 --- a/test/CodeGen/ARM/O3-pipeline.ll +++ b/test/CodeGen/ARM/O3-pipeline.ll @@ -49,8 +49,6 @@ ; CHECK-NEXT: Dominator Tree Construction ; CHECK-NEXT: Natural Loop Information ; CHECK-NEXT: CodeGen Prepare -; CHECK-NEXT: Rewrite Symbols -; CHECK-NEXT: FunctionPass Manager ; CHECK-NEXT: Dominator Tree Construction ; CHECK-NEXT: Exception handling preparation ; CHECK-NEXT: Merge internal globals diff --git a/test/CodeGen/Generic/addr-label.ll b/test/CodeGen/Generic/addr-label.ll index 0dbe5021bbf..08e770f30d3 100644 --- a/test/CodeGen/Generic/addr-label.ll +++ b/test/CodeGen/Generic/addr-label.ll @@ -16,7 +16,7 @@ ret: } -;; Issues with referring to a label that gets RAUW'd later. +; Issues with referring to a label that gets RAUW'd later. define i32 @test2a() nounwind { entry: %target = bitcast i8* blockaddress(@test2b, %test_label) to i8* diff --git a/test/CodeGen/X86/O0-pipeline.ll b/test/CodeGen/X86/O0-pipeline.ll index e5b3584a033..b435e8b8c6c 100644 --- a/test/CodeGen/X86/O0-pipeline.ll +++ b/test/CodeGen/X86/O0-pipeline.ll @@ -28,8 +28,6 @@ ; CHECK-NEXT: Scalarize Masked Memory Intrinsics ; CHECK-NEXT: Expand reduction intrinsics ; CHECK-NEXT: Expand indirectbr instructions -; CHECK-NEXT: Rewrite Symbols -; CHECK-NEXT: FunctionPass Manager ; CHECK-NEXT: Exception handling preparation ; CHECK-NEXT: Safe Stack instrumentation pass ; CHECK-NEXT: Insert stack protectors diff --git a/test/CodeGen/X86/opt-pipeline.ll b/test/CodeGen/X86/opt-pipeline.ll index 9df12b7a3fd..02897274704 100644 --- a/test/CodeGen/X86/opt-pipeline.ll +++ b/test/CodeGen/X86/opt-pipeline.ll @@ -6,6 +6,8 @@ ; RUN: | grep -v 'Verify generated machine code' | FileCheck %s ; RUN: llc -mtriple=x86_64-- -O3 -debug-pass=Structure < %s -o /dev/null 2>&1 \ ; RUN: | grep -v 'Verify generated machine code' | FileCheck %s +; RUN: llc -mtriple=x86_64-- -O3 -debug-pass=Structure < %s -o /dev/null 2>&1 \ +; RUN: | FileCheck %s --check-prefix=FPM ; REQUIRES: asserts @@ -61,8 +63,6 @@ ; CHECK-NEXT: Expand indirectbr instructions ; CHECK-NEXT: Natural Loop Information ; CHECK-NEXT: CodeGen Prepare -; CHECK-NEXT: Rewrite Symbols -; CHECK-NEXT: FunctionPass Manager ; CHECK-NEXT: Dominator Tree Construction ; CHECK-NEXT: Exception handling preparation ; CHECK-NEXT: Safe Stack instrumentation pass @@ -203,6 +203,12 @@ ; CHECK-NEXT: X86 Assembly Printer ; CHECK-NEXT: Free MachineFunction +; We should only have one function pass manager. +; In the past, module passes have accidentally been added into the middle of +; the codegen pipeline, implicitly creating new function pass managers. +; FPM: FunctionPass Manager +; FPM-NOT: FunctionPass Manager + define void @f() { ret void } diff --git a/test/CodeGen/X86/select_meta.ll b/test/CodeGen/X86/select_meta.ll index 2c73f767e37..e89008406f1 100644 --- a/test/CodeGen/X86/select_meta.ll +++ b/test/CodeGen/X86/select_meta.ll @@ -1,4 +1,4 @@ -; RUN: llc -mtriple=x86_64-unknown-unknown -print-after-all < %s 2>&1 | FileCheck %s +; RUN: opt -mtriple=x86_64-unknown-unknown -codegenprepare -S < %s 2>&1 | FileCheck %s ; Function Attrs: norecurse nounwind readnone uwtable define i32 @foo(i32, i32, i32) { diff --git a/test/Other/2010-05-06-Printer.ll b/test/Other/2010-05-06-Printer.ll index decd977c3d2..fd73791d475 100644 --- a/test/Other/2010-05-06-Printer.ll +++ b/test/Other/2010-05-06-Printer.ll @@ -10,10 +10,8 @@ define void @foo(){ ret void } -;ALL-NOT: IR Dump After {{.*}}; ModuleID = ;ALL: define void @tester() ;ALL: define void @foo() -;ALL: ModuleID = ;FOO: IR Dump After ;FOO-NEXT: define void @foo()