Skip to content

Commit 49de607

Browse files
Revert "[Remarks] Emit optimization remarks for atomics generating CAS loop"
This reverts commit 4357852. Still same compile time issues for -O0 -g, eg. +1.3% for sqlite3.
1 parent 265a996 commit 49de607

File tree

11 files changed

+7
-249
lines changed

11 files changed

+7
-249
lines changed

clang/test/CodeGenCUDA/atomics-remarks-gfx90a.cu

Lines changed: 0 additions & 16 deletions
This file was deleted.

clang/test/CodeGenOpenCL/atomics-remarks-gfx90a.cl

Lines changed: 0 additions & 46 deletions
This file was deleted.

llvm/lib/CodeGen/AtomicExpandPass.cpp

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "llvm/ADT/ArrayRef.h"
1818
#include "llvm/ADT/STLExtras.h"
1919
#include "llvm/ADT/SmallVector.h"
20-
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
2120
#include "llvm/CodeGen/AtomicExpandUtils.h"
2221
#include "llvm/CodeGen/RuntimeLibcalls.h"
2322
#include "llvm/CodeGen/TargetLowering.h"
@@ -59,7 +58,6 @@ namespace {
5958

6059
class AtomicExpand: public FunctionPass {
6160
const TargetLowering *TLI = nullptr;
62-
OptimizationRemarkEmitter *ORE;
6361

6462
public:
6563
static char ID; // Pass identification, replacement for typeid
@@ -71,7 +69,6 @@ namespace {
7169
bool runOnFunction(Function &F) override;
7270

7371
private:
74-
void getAnalysisUsage(AnalysisUsage &AU) const override;
7572
bool bracketInstWithFences(Instruction *I, AtomicOrdering Order);
7673
IntegerType *getCorrespondingIntegerType(Type *T, const DataLayout &DL);
7774
LoadInst *convertAtomicLoadToIntegerType(LoadInst *LI);
@@ -168,16 +165,11 @@ static bool atomicSizeSupported(const TargetLowering *TLI, Inst *I) {
168165
Size <= TLI->getMaxAtomicSizeInBitsSupported() / 8;
169166
}
170167

171-
void AtomicExpand::getAnalysisUsage(AnalysisUsage &AU) const {
172-
AU.addRequired<OptimizationRemarkEmitterWrapperPass>();
173-
}
174-
175168
bool AtomicExpand::runOnFunction(Function &F) {
176169
auto *TPC = getAnalysisIfAvailable<TargetPassConfig>();
177170
if (!TPC)
178171
return false;
179172

180-
ORE = &getAnalysis<OptimizationRemarkEmitterWrapperPass>().getORE();
181173
auto &TM = TPC->getTM<TargetMachine>();
182174
if (!TM.getSubtargetImpl(F)->enableAtomicExpand())
183175
return false;
@@ -578,9 +570,7 @@ static Value *performAtomicOp(AtomicRMWInst::BinOp Op, IRBuilder<> &Builder,
578570
}
579571

580572
bool AtomicExpand::tryExpandAtomicRMW(AtomicRMWInst *AI) {
581-
LLVMContext &Ctx = AI->getModule()->getContext();
582-
TargetLowering::AtomicExpansionKind Kind = TLI->shouldExpandAtomicRMWInIR(AI);
583-
switch (Kind) {
573+
switch (TLI->shouldExpandAtomicRMWInIR(AI)) {
584574
case TargetLoweringBase::AtomicExpansionKind::None:
585575
return false;
586576
case TargetLoweringBase::AtomicExpansionKind::LLSC: {
@@ -610,17 +600,6 @@ bool AtomicExpand::tryExpandAtomicRMW(AtomicRMWInst *AI) {
610600
expandPartwordAtomicRMW(AI,
611601
TargetLoweringBase::AtomicExpansionKind::CmpXChg);
612602
} else {
613-
SmallVector<StringRef> SSNs;
614-
Ctx.getSyncScopeNames(SSNs);
615-
auto MemScope = SSNs[AI->getSyncScopeID()].empty()
616-
? "system"
617-
: SSNs[AI->getSyncScopeID()];
618-
ORE->emit([&]() {
619-
return OptimizationRemark(DEBUG_TYPE, "Passed", AI->getFunction())
620-
<< "A compare and swap loop was generated for an atomic "
621-
<< AI->getOperationName(AI->getOperation()) << " operation at "
622-
<< MemScope << " memory scope";
623-
});
624603
expandAtomicRMWToCmpXchg(AI, createCmpXchgInstFun);
625604
}
626605
return true;

llvm/test/CodeGen/AArch64/O0-pipeline.ll

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,13 @@
88
; CHECK-NEXT: Target Pass Configuration
99
; CHECK-NEXT: Machine Module Information
1010
; CHECK-NEXT: Target Transform Information
11-
; CHECK-NEXT: Profile summary info
1211
; CHECK-NEXT: Create Garbage Collector Module Metadata
1312
; CHECK-NEXT: Assumption Cache Tracker
13+
; CHECK-NEXT: Profile summary info
1414
; CHECK-NEXT: Machine Branch Probability Analysis
1515
; CHECK-NEXT: ModulePass Manager
1616
; CHECK-NEXT: Pre-ISel Intrinsic Lowering
1717
; CHECK-NEXT: FunctionPass Manager
18-
; CHECK-NEXT: Dominator Tree Construction
19-
; CHECK-NEXT: Natural Loop Information
20-
; CHECK-NEXT: Lazy Branch Probability Analysis
21-
; CHECK-NEXT: Lazy Block Frequency Analysis
22-
; CHECK-NEXT: Optimization Remark Emitter
2318
; CHECK-NEXT: Expand Atomic instructions
2419
; CHECK-NEXT: Module Verifier
2520
; CHECK-NEXT: Lower Garbage Collection Instructions

llvm/test/CodeGen/AArch64/O3-pipeline.ll

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,15 @@
88
; CHECK-NEXT: Target Pass Configuration
99
; CHECK-NEXT: Machine Module Information
1010
; CHECK-NEXT: Target Transform Information
11-
; CHECK-NEXT: Profile summary info
1211
; CHECK-NEXT: Assumption Cache Tracker
12+
; CHECK-NEXT: Profile summary info
1313
; CHECK-NEXT: Type-Based Alias Analysis
1414
; CHECK-NEXT: Scoped NoAlias Alias Analysis
1515
; CHECK-NEXT: Create Garbage Collector Module Metadata
1616
; CHECK-NEXT: Machine Branch Probability Analysis
1717
; CHECK-NEXT: ModulePass Manager
1818
; CHECK-NEXT: Pre-ISel Intrinsic Lowering
1919
; CHECK-NEXT: FunctionPass Manager
20-
; CHECK-NEXT: Dominator Tree Construction
21-
; CHECK-NEXT: Natural Loop Information
22-
; CHECK-NEXT: Lazy Branch Probability Analysis
23-
; CHECK-NEXT: Lazy Block Frequency Analysis
24-
; CHECK-NEXT: Optimization Remark Emitter
2520
; CHECK-NEXT: Expand Atomic instructions
2621
; CHECK-NEXT: SVE intrinsics optimizations
2722
; CHECK-NEXT: FunctionPass Manager

llvm/test/CodeGen/AMDGPU/atomics-remarks-gfx90a.ll

Lines changed: 0 additions & 103 deletions
This file was deleted.

llvm/test/CodeGen/AMDGPU/llc-pipeline.ll

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@
4444
; GCN-O0-NEXT: Lower OpenCL enqueued blocks
4545
; GCN-O0-NEXT: Lower uses of LDS variables from non-kernel functions
4646
; GCN-O0-NEXT: FunctionPass Manager
47-
; GCN-O0-NEXT: Dominator Tree Construction
48-
; GCN-O0-NEXT: Natural Loop Information
49-
; GCN-O0-NEXT: Lazy Branch Probability Analysis
50-
; GCN-O0-NEXT: Lazy Block Frequency Analysis
51-
; GCN-O0-NEXT: Optimization Remark Emitter
5247
; GCN-O0-NEXT: Expand Atomic instructions
5348
; GCN-O0-NEXT: Lower constant intrinsics
5449
; GCN-O0-NEXT: Remove unreachable blocks from the CFG
@@ -185,11 +180,6 @@
185180
; GCN-O1-NEXT: Lower uses of LDS variables from non-kernel functions
186181
; GCN-O1-NEXT: FunctionPass Manager
187182
; GCN-O1-NEXT: Infer address spaces
188-
; GCN-O1-NEXT: Dominator Tree Construction
189-
; GCN-O1-NEXT: Natural Loop Information
190-
; GCN-O1-NEXT: Lazy Branch Probability Analysis
191-
; GCN-O1-NEXT: Lazy Block Frequency Analysis
192-
; GCN-O1-NEXT: Optimization Remark Emitter
193183
; GCN-O1-NEXT: Expand Atomic instructions
194184
; GCN-O1-NEXT: AMDGPU Promote Alloca
195185
; GCN-O1-NEXT: Dominator Tree Construction
@@ -441,11 +431,6 @@
441431
; GCN-O1-OPTS-NEXT: Lower uses of LDS variables from non-kernel functions
442432
; GCN-O1-OPTS-NEXT: FunctionPass Manager
443433
; GCN-O1-OPTS-NEXT: Infer address spaces
444-
; GCN-O1-OPTS-NEXT: Dominator Tree Construction
445-
; GCN-O1-OPTS-NEXT: Natural Loop Information
446-
; GCN-O1-OPTS-NEXT: Lazy Branch Probability Analysis
447-
; GCN-O1-OPTS-NEXT: Lazy Block Frequency Analysis
448-
; GCN-O1-OPTS-NEXT: Optimization Remark Emitter
449434
; GCN-O1-OPTS-NEXT: Expand Atomic instructions
450435
; GCN-O1-OPTS-NEXT: AMDGPU Promote Alloca
451436
; GCN-O1-OPTS-NEXT: Dominator Tree Construction
@@ -730,11 +715,6 @@
730715
; GCN-O2-NEXT: Lower uses of LDS variables from non-kernel functions
731716
; GCN-O2-NEXT: FunctionPass Manager
732717
; GCN-O2-NEXT: Infer address spaces
733-
; GCN-O2-NEXT: Dominator Tree Construction
734-
; GCN-O2-NEXT: Natural Loop Information
735-
; GCN-O2-NEXT: Lazy Branch Probability Analysis
736-
; GCN-O2-NEXT: Lazy Block Frequency Analysis
737-
; GCN-O2-NEXT: Optimization Remark Emitter
738718
; GCN-O2-NEXT: Expand Atomic instructions
739719
; GCN-O2-NEXT: AMDGPU Promote Alloca
740720
; GCN-O2-NEXT: Dominator Tree Construction
@@ -1021,11 +1001,6 @@
10211001
; GCN-O3-NEXT: Lower uses of LDS variables from non-kernel functions
10221002
; GCN-O3-NEXT: FunctionPass Manager
10231003
; GCN-O3-NEXT: Infer address spaces
1024-
; GCN-O3-NEXT: Dominator Tree Construction
1025-
; GCN-O3-NEXT: Natural Loop Information
1026-
; GCN-O3-NEXT: Lazy Branch Probability Analysis
1027-
; GCN-O3-NEXT: Lazy Block Frequency Analysis
1028-
; GCN-O3-NEXT: Optimization Remark Emitter
10291004
; GCN-O3-NEXT: Expand Atomic instructions
10301005
; GCN-O3-NEXT: AMDGPU Promote Alloca
10311006
; GCN-O3-NEXT: Dominator Tree Construction

llvm/test/CodeGen/ARM/O3-pipeline.ll

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55
; CHECK: ModulePass Manager
66
; CHECK-NEXT: Pre-ISel Intrinsic Lowering
77
; CHECK-NEXT: FunctionPass Manager
8-
; CHECK-NEXT: Dominator Tree Construction
9-
; CHECK-NEXT: Natural Loop Information
10-
; CHECK-NEXT: Lazy Branch Probability Analysis
11-
; CHECK-NEXT: Lazy Block Frequency Analysis
12-
; CHECK-NEXT: Optimization Remark Emitter
138
; CHECK-NEXT: Expand Atomic instructions
149
; CHECK-NEXT: Simplify the CFG
1510
; CHECK-NEXT: Dominator Tree Construction

llvm/test/CodeGen/PowerPC/O3-pipeline.ll

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,16 @@
88
; CHECK-NEXT: Target Pass Configuration
99
; CHECK-NEXT: Machine Module Information
1010
; CHECK-NEXT: Target Transform Information
11-
; CHECK-NEXT: Profile summary info
1211
; CHECK-NEXT: Assumption Cache Tracker
1312
; CHECK-NEXT: Type-Based Alias Analysis
1413
; CHECK-NEXT: Scoped NoAlias Alias Analysis
14+
; CHECK-NEXT: Profile summary info
1515
; CHECK-NEXT: Create Garbage Collector Module Metadata
1616
; CHECK-NEXT: Machine Branch Probability Analysis
1717
; CHECK-NEXT: ModulePass Manager
1818
; CHECK-NEXT: Pre-ISel Intrinsic Lowering
1919
; CHECK-NEXT: FunctionPass Manager
2020
; CHECK-NEXT: Convert i1 constants to i32/i64 if they are returned
21-
; CHECK-NEXT: Dominator Tree Construction
22-
; CHECK-NEXT: Natural Loop Information
23-
; CHECK-NEXT: Lazy Branch Probability Analysis
24-
; CHECK-NEXT: Lazy Block Frequency Analysis
25-
; CHECK-NEXT: Optimization Remark Emitter
2621
; CHECK-NEXT: Expand Atomic instructions
2722
; CHECK-NEXT: PPC Lower MASS Entries
2823
; CHECK-NEXT: FunctionPass Manager
@@ -211,5 +206,4 @@
211206

212207
define void @f() {
213208
ret void
214-
}
215-
209+
}

0 commit comments

Comments
 (0)