Skip to content

Commit fe42e72

Browse files
authored
[CodeGen] Port AtomicExpand to new Pass Manager (#71220)
Port the `atomicexpand` pass to the new Pass Manager. Fixes #64559
1 parent 4bf06c1 commit fe42e72

File tree

68 files changed

+201
-141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+201
-141
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//===-- AtomicExpand.h - Expand Atomic Instructions -------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_CODEGEN_ATOMICEXPAND_H
10+
#define LLVM_CODEGEN_ATOMICEXPAND_H
11+
12+
#include "llvm/IR/PassManager.h"
13+
14+
namespace llvm {
15+
16+
class Function;
17+
class TargetMachine;
18+
19+
class AtomicExpandPass : public PassInfoMixin<AtomicExpandPass> {
20+
private:
21+
const TargetMachine *TM;
22+
23+
public:
24+
AtomicExpandPass(const TargetMachine *TM) : TM(TM) {}
25+
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
26+
};
27+
28+
} // end namespace llvm
29+
30+
#endif // LLVM_CODEGEN_ATOMICEXPAND_H

llvm/include/llvm/CodeGen/Passes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ namespace llvm {
4444
/// AtomicExpandPass - At IR level this pass replace atomic instructions with
4545
/// __atomic_* library calls, or target specific instruction which implement the
4646
/// same semantics in a way which better fits the target backend.
47-
FunctionPass *createAtomicExpandPass();
47+
FunctionPass *createAtomicExpandLegacyPass();
4848

4949
/// createUnreachableBlockEliminationPass - The LLVM code generator does not
5050
/// work well with unreachable basic blocks (what live ranges make sense for a

llvm/include/llvm/InitializePasses.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void initializeAAResultsWrapperPassPass(PassRegistry&);
5252
void initializeAlwaysInlinerLegacyPassPass(PassRegistry&);
5353
void initializeAssignmentTrackingAnalysisPass(PassRegistry &);
5454
void initializeAssumptionCacheTrackerPass(PassRegistry&);
55-
void initializeAtomicExpandPass(PassRegistry&);
55+
void initializeAtomicExpandLegacyPass(PassRegistry &);
5656
void initializeBasicBlockPathCloningPass(PassRegistry &);
5757
void initializeBasicBlockSectionsProfileReaderWrapperPassPass(PassRegistry &);
5858
void initializeBasicBlockSectionsPass(PassRegistry &);

llvm/include/llvm/LinkAllPasses.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ namespace {
6060
if (std::getenv("bar") != (char*) -1)
6161
return;
6262

63+
(void)llvm::createAtomicExpandLegacyPass();
6364
(void) llvm::createBasicAAWrapperPass();
6465
(void) llvm::createSCEVAAWrapperPass();
6566
(void) llvm::createTypeBasedAAWrapperPass();

0 commit comments

Comments
 (0)