Skip to content

Commit 0402627

Browse files
author
Tony Varghese
committed
Changed the name of the pass to LowerCommentStringPass
1 parent a2904ba commit 0402627

File tree

14 files changed

+48
-48
lines changed

14 files changed

+48
-48
lines changed

clang/test/CodeGen/PowerPC/pragma-comment-copyright-aix-modules.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
// Verify that module interface emits copyright global when compiled to IR
88
// RUN: %clang_cc1 -std=c++20 -triple powerpc-ibm-aix -emit-llvm %t/copymod.cppm -o - \
99
// RUN: | FileCheck %s --check-prefix=CHECK-MOD
10-
// CHECK-MOD: @__loadtime_copyright_str = internal unnamed_addr constant [10 x i8] c"module me\00", section "__copyright_comment"
11-
// CHECK-MOD: @llvm.used = appending global {{.*}} @__loadtime_copyright_str
10+
// CHECK-MOD: @__loadtime_comment_str = internal unnamed_addr constant [10 x i8] c"module me\00", section "__loadtime_comment"
11+
// CHECK-MOD: @llvm.used = appending global {{.*}} @__loadtime_comment_str
1212

1313
// Compile an importing TU that uses the prebuilt module and verify that it
1414
// does NOT re-emit the module's copyright global.
1515
// RUN: %clang_cc1 -std=c++20 -triple powerpc-ibm-aix \
1616
// RUN: -fprebuilt-module-path=%t -emit-llvm %t/importmod.cc -o - \
1717
// RUN: | FileCheck %s --check-prefix=CHECK-IMPORT
18-
// CHECK-IMPORT-NOT: @__loadtime_copyright_str
18+
// CHECK-IMPORT-NOT: @__loadtime_comment_str
1919
// CHECK-IMPORT-NOT: c"module me\00"
2020

2121
//--- copymod.cppm

clang/test/CodeGen/lto-newpm-pipeline.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
// CHECK-FULL-O0: Running pass: VerifierPass
2929
// CHECK-FULL-O0-NEXT: Running analysis: VerifierAnalysis
30-
// CHECK-FULL-O0-NEXT: Running pass: CopyrightMetadataPass
30+
// CHECK-FULL-O0-NEXT: Running pass: LowerCommentStringPass
3131
// CHECK-FULL-O0-NEXT: Running analysis: InnerAnalysisManagerProxy
3232
// CHECK-FULL-O0-NEXT: Running pass: EntryExitInstrumenterPass
3333
// CHECK-FULL-O0-NEXT: Running pass: AlwaysInlinerPass
@@ -42,7 +42,7 @@
4242

4343
// CHECK-THIN-O0: Running pass: VerifierPass
4444
// CHECK-THIN-O0-NEXT: Running analysis: VerifierAnalysis
45-
// CHECK-THIN-O0-NEXT: Running pass: CopyrightMetadataPass
45+
// CHECK-THIN-O0-NEXT: Running pass: LowerCommentStringPass
4646
// CHECK-THIN-O0-NEXT: Running analysis: InnerAnalysisManagerProxy
4747
// CHECK-THIN-O0-NEXT: Running pass: EntryExitInstrumenterPass
4848
// CHECK-THIN-O0-NEXT: Running pass: AlwaysInlinerPass

llvm/include/llvm/Transforms/Utils/CopyrightMetadataPass.h renamed to llvm/include/llvm/Transforms/Utils/LowerCommentStringPass.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
//===-- CopyrightMetadataPass.h - Lower AIX copyright metadata -*- C++ -*-===//
1+
//===-- LowerCommentStringPass.h - Lower Comment string metadata -*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef LLVM_TRANSFORMS_UTILS_COPYRIGHTMETADATAPASS_H
10-
#define LLVM_TRANSFORMS_UTILS_COPYRIGHTMETADATAPASS_H
9+
#ifndef LLVM_TRANSFORMS_UTILS_LOWERCOMMENTSTRINGPASS_H
10+
#define LLVM_TRANSFORMS_UTILS_LOWERCOMMENTSTRINGPASS_H
1111

1212
#include "llvm/IR/PassManager.h"
1313

1414
namespace llvm {
15-
class CopyrightMetadataPass : public PassInfoMixin<CopyrightMetadataPass> {
15+
class LowerCommentStringPass : public PassInfoMixin<LowerCommentStringPass> {
1616
public:
1717
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
1818

@@ -22,4 +22,4 @@ class CopyrightMetadataPass : public PassInfoMixin<CopyrightMetadataPass> {
2222

2323
} // namespace llvm
2424

25-
#endif // LLVM_TRANSFORMS_UTILS_COPYRIGHTMETADATAPASS_H
25+
#endif // LLVM_TRANSFORMS_UTILS_LOWERCOMMENTSTRINGPASS_H

llvm/lib/Passes/PassBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@
347347
#include "llvm/Transforms/Utils/BreakCriticalEdges.h"
348348
#include "llvm/Transforms/Utils/CanonicalizeAliases.h"
349349
#include "llvm/Transforms/Utils/CanonicalizeFreezeInLoops.h"
350-
#include "llvm/Transforms/Utils/CopyrightMetadataPass.h"
350+
#include "llvm/Transforms/Utils/LowerCommentStringPass.h"
351351
#include "llvm/Transforms/Utils/CountVisits.h"
352352
#include "llvm/Transforms/Utils/DXILUpgrade.h"
353353
#include "llvm/Transforms/Utils/Debugify.h"

llvm/lib/Passes/PassBuilderPipelines.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
#include "llvm/Transforms/Utils/AddDiscriminators.h"
136136
#include "llvm/Transforms/Utils/AssumeBundleBuilder.h"
137137
#include "llvm/Transforms/Utils/CanonicalizeAliases.h"
138-
#include "llvm/Transforms/Utils/CopyrightMetadataPass.h"
138+
#include "llvm/Transforms/Utils/LowerCommentStringPass.h"
139139
#include "llvm/Transforms/Utils/CountVisits.h"
140140
#include "llvm/Transforms/Utils/EntryExitInstrumenter.h"
141141
#include "llvm/Transforms/Utils/ExtraPassManager.h"
@@ -1456,7 +1456,7 @@ PassBuilder::buildModuleOptimizationPipeline(OptimizationLevel Level,
14561456
ModulePassManager MPM;
14571457

14581458
// Process copyright metadata early, before any optimizations
1459-
MPM.addPass(CopyrightMetadataPass());
1459+
MPM.addPass(LowerCommentStringPass());
14601460

14611461
// Run partial inlining pass to partially inline functions that have
14621462
// large bodies.
@@ -2279,7 +2279,7 @@ PassBuilder::buildO0DefaultPipeline(OptimizationLevel Level,
22792279
ModulePassManager MPM;
22802280

22812281
// Process copyright metadata at O0 before any other transformations
2282-
MPM.addPass(CopyrightMetadataPass());
2282+
MPM.addPass(LowerCommentStringPass());
22832283

22842284
// Perform pseudo probe instrumentation in O0 mode. This is for the
22852285
// consistency between different build modes. For example, a LTO build can be

llvm/lib/Passes/PassRegistry.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ MODULE_PASS("check-debugify", NewPMCheckDebugifyPass())
6161
MODULE_PASS("constmerge", ConstantMergePass())
6262
MODULE_PASS("coro-cleanup", CoroCleanupPass())
6363
MODULE_PASS("coro-early", CoroEarlyPass())
64-
MODULE_PASS("copyright-metadata", CopyrightMetadataPass())
64+
MODULE_PASS("lower-comment-string", LowerCommentStringPass())
6565
MODULE_PASS("cross-dso-cfi", CrossDSOCFIPass())
6666
MODULE_PASS("ctx-instr-gen",
6767
PGOInstrumentationGen(PGOInstrumentationType::CTXPROF))

llvm/lib/Transforms/Utils/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ add_llvm_component_library(LLVMTransformUtils
1717
CodeLayout.cpp
1818
CodeMoverUtils.cpp
1919
ControlFlowUtils.cpp
20-
CopyrightMetadataPass.cpp
20+
LowerCommentStringPass.cpp
2121
CtorUtils.cpp
2222
CountVisits.cpp
2323
Debugify.cpp

llvm/lib/Transforms/Utils/CopyrightMetadataPass.cpp renamed to llvm/lib/Transforms/Utils/LowerCommentStringPass.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
//===-- CopyrightMetadataPass.cpp - Lower copyright metadata -------------===//
1+
//===-- LowerCommentStringPass.cpp - Lower Comment string metadata -------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===---------------------------------------------------------------------===//
88
//
9-
// CopyrightMetadataPass pass lowers module-level copyright metadata emitted by
10-
// Clang:
9+
// LowerCommentStringPass pass lowers module-level comment string metadata
10+
// emitted by Clang:
1111
//
1212
// !comment_string.loadtime = !{!"Copyright ..."}
1313
//
@@ -16,8 +16,8 @@
1616
// For each module (translation unit), the pass performs the following:
1717
//
1818
// 1. Creates a null-terminated, internal constant string global
19-
// (`__loadtime_copyright_str`) containing the copyright text in
20-
// `__copyright_comment` section.
19+
// (`__loadtime_comment_str`) containing the copyright text in
20+
// `__loadtime_comment` section.
2121
//
2222
// 2. Marks the string in `llvm.used` so it cannot be dropped by
2323
// optimization or LTO.
@@ -31,16 +31,16 @@
3131
// Input IR:
3232
// !comment_string.loadtime = !{!"Copyright"}
3333
// Output IR:
34-
// @__loadtime_copyright_str = internal constant [N x i8] c"Copyright\00",
35-
// section "__copyright_comment"
36-
// @llvm.used = appending global [1 x ptr] [ptr @__loadtime_copyright_str]
34+
// @__loadtime_comment_str = internal constant [N x i8] c"Copyright\00",
35+
// section "__loadtime_comment"
36+
// @llvm.used = appending global [1 x ptr] [ptr @__loadtime_comment_str]
3737
//
3838
// define i32 @func() !implicit.ref !5 { ... }
39-
// !5 = !{ptr @__loadtime_copyright_str}
39+
// !5 = !{ptr @__loadtime_comment_str}
4040
//
4141
//===----------------------------------------------------------------------===//
4242

43-
#include "llvm/Transforms/Utils/CopyrightMetadataPass.h"
43+
#include "llvm/Transforms/Utils/LowerCommentStringPass.h"
4444

4545
#include "llvm/ADT/SmallVector.h"
4646
#include "llvm/ADT/StringRef.h"
@@ -61,20 +61,20 @@
6161
#include "llvm/TargetParser/Triple.h"
6262
#include "llvm/Transforms/Utils/ModuleUtils.h"
6363

64-
#define DEBUG_TYPE "copyright-metadata"
64+
#define DEBUG_TYPE "lower-comment-string"
6565

6666
using namespace llvm;
6767

6868
static cl::opt<bool>
69-
DisableCopyrightMetadata("disable-copyright-metadata", cl::ReallyHidden,
70-
cl::desc("Disable copyright metadata pass."),
69+
DisableCopyrightMetadata("disable-lower-comment-string", cl::ReallyHidden,
70+
cl::desc("Disable LowerCommentString pass."),
7171
cl::init(false));
7272

7373
static bool isAIXTriple(const Module &M) {
7474
return Triple(M.getTargetTriple()).isOSAIX();
7575
}
7676

77-
PreservedAnalyses CopyrightMetadataPass::run(Module &M,
77+
PreservedAnalyses LowerCommentStringPass::run(Module &M,
7878
ModuleAnalysisManager &AM) {
7979
if (DisableCopyrightMetadata || !isAIXTriple(M))
8080
return PreservedAnalyses::all();
@@ -108,21 +108,21 @@ PreservedAnalyses CopyrightMetadataPass::run(Module &M,
108108
auto *StrGV = new GlobalVariable(M, StrInit->getType(),
109109
/*isConstant=*/true,
110110
GlobalValue::InternalLinkage, StrInit,
111-
/*Name=*/"__loadtime_copyright_str");
111+
/*Name=*/"__loadtime_comment_str");
112112
// Set unnamed_addr to allow the linker to merge identical strings
113113
StrGV->setUnnamedAddr(GlobalValue::UnnamedAddr::Global);
114114
StrGV->setAlignment(Align(1));
115-
// Place in the "__copyright_comment" section.
115+
// Place in the "__loadtime_comment" section.
116116
// The GV is constant, so we expect a read-only section.
117-
StrGV->setSection("__copyright_comment");
117+
StrGV->setSection("__loadtime_comment");
118118

119119
// 2. Add the string to llvm.used to prevent LLVM optimization/LTO passes from
120120
// removing it.
121121
appendToUsed(M, {StrGV});
122122

123123
// 3. Attach !implicit ref to every defined function
124124
// Create a metadata node pointing to the copyright string:
125-
// !N = !{ptr @__loadtime_copyright_str}
125+
// !N = !{ptr @__loadtime_comment_str}
126126
Metadata *Ops[] = {ConstantAsMetadata::get(StrGV)};
127127
MDNode *ImplicitRefMD = MDNode::get(Ctx, Ops);
128128

llvm/test/CodeGen/AArch64/print-pipeline-passes.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
; RUN: opt -mtriple=aarch64 -S -passes='default<O2>' -print-pipeline-passes < %s | FileCheck %s
33

44
; CHECK: loop-idiom-vectorize
5-
; O0: {{^}}copyright-metadata,function(ee-instrument<>),always-inline,coro-cond(coro-early,cgscc(coro-split),coro-cleanup,globaldce),alloc-token,function(annotation-remarks),verify,print{{$}}
5+
; O0: {{^}}lower-comment-string,function(ee-instrument<>),always-inline,coro-cond(coro-early,cgscc(coro-split),coro-cleanup,globaldce),alloc-token,function(annotation-remarks),verify,print{{$}}
66
define void @foo() {
77
entry:
88
ret void

llvm/test/Other/new-pm-defaults.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@
238238
; CHECK-O-NEXT: Running pass: CoroCleanupPass
239239
; CHECK-O-NEXT: Running pass: GlobalOptPass
240240
; CHECK-O-NEXT: Running pass: GlobalDCEPass
241-
; CHECK-O-NEXT: Running pass: CopyrightMetadataPass
241+
; CHECK-O-NEXT: Running pass: LowerCommentStringPass
242242
; CHECK-DEFAULT-NEXT: Running pass: EliminateAvailableExternallyPass
243243
; CHECK-LTO-NOT: Running pass: EliminateAvailableExternallyPass
244244
; CHECK-O-NEXT: Running pass: ReversePostOrderFunctionAttrsPass

0 commit comments

Comments
 (0)