Skip to content

Commit a6d9730

Browse files
committed
Revert "Move "auto-init" instructions to the dominator of their users"
This could also move initialization of sret args, causing actually initialized parts of such return values to be uninitialized. See discussion on the code review. > As a result of -ftrivial-auto-var-init, clang generates instructions to > set alloca'd memory to a given pattern, right after the allocation site. > In some cases, this (somehow costly) operation could be delayed, leading > to conditional execution in some cases. > > This is not an uncommon situation: it happens ~500 times on the cPython > code base, and much more on the LLVM codebase. The benefit greatly > varies on the execution path, but it should not regress on performance. > > This is a recommit of cca0100 with > MemorySSA update fixes. > > Differential Revision: https://reviews.llvm.org/D137707 This reverts commit 50b2a11 and follow-up commit ad9ad37.
1 parent 3820e9a commit a6d9730

19 files changed

+0
-614
lines changed

llvm/include/llvm/Transforms/Utils/MoveAutoInit.h

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

llvm/lib/Passes/PassBuilder.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@
247247
#include "llvm/Transforms/Utils/LowerSwitch.h"
248248
#include "llvm/Transforms/Utils/Mem2Reg.h"
249249
#include "llvm/Transforms/Utils/MetaRenamer.h"
250-
#include "llvm/Transforms/Utils/MoveAutoInit.h"
251250
#include "llvm/Transforms/Utils/NameAnonGlobals.h"
252251
#include "llvm/Transforms/Utils/PredicateInfo.h"
253252
#include "llvm/Transforms/Utils/RelLookupTableConverter.h"

llvm/lib/Passes/PassBuilderPipelines.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@
125125
#include "llvm/Transforms/Utils/InjectTLIMappings.h"
126126
#include "llvm/Transforms/Utils/LibCallsShrinkWrap.h"
127127
#include "llvm/Transforms/Utils/Mem2Reg.h"
128-
#include "llvm/Transforms/Utils/MoveAutoInit.h"
129128
#include "llvm/Transforms/Utils/NameAnonGlobals.h"
130129
#include "llvm/Transforms/Utils/RelLookupTableConverter.h"
131130
#include "llvm/Transforms/Utils/SimplifyCFGOptions.h"
@@ -656,8 +655,6 @@ PassBuilder::buildFunctionSimplificationPipeline(OptimizationLevel Level,
656655
FPM.addPass(MemCpyOptPass());
657656

658657
FPM.addPass(DSEPass());
659-
FPM.addPass(MoveAutoInitPass());
660-
661658
FPM.addPass(createFunctionToLoopPassAdaptor(
662659
LICMPass(PTO.LicmMssaOptCap, PTO.LicmMssaNoAccForPromotionCap,
663660
/*AllowSpeculation=*/true),
@@ -1802,7 +1799,6 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level,
18021799

18031800
// Nuke dead stores.
18041801
MainFPM.addPass(DSEPass());
1805-
MainFPM.addPass(MoveAutoInitPass());
18061802
MainFPM.addPass(MergedLoadStoreMotionPass());
18071803

18081804
LoopPassManager LPM;

llvm/lib/Passes/PassRegistry.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ FUNCTION_PASS("mem2reg", PromotePass())
333333
FUNCTION_PASS("memcpyopt", MemCpyOptPass())
334334
FUNCTION_PASS("mergeicmps", MergeICmpsPass())
335335
FUNCTION_PASS("mergereturn", UnifyFunctionExitNodesPass())
336-
FUNCTION_PASS("move-auto-init", MoveAutoInitPass())
337336
FUNCTION_PASS("nary-reassociate", NaryReassociatePass())
338337
FUNCTION_PASS("newgvn", NewGVNPass())
339338
FUNCTION_PASS("jump-threading", JumpThreadingPass())

llvm/lib/Transforms/Utils/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ add_llvm_component_library(LLVMTransformUtils
5858
MetaRenamer.cpp
5959
MisExpect.cpp
6060
ModuleUtils.cpp
61-
MoveAutoInit.cpp
6261
NameAnonGlobals.cpp
6362
PredicateInfo.cpp
6463
PromoteMemoryToRegister.cpp

llvm/lib/Transforms/Utils/MoveAutoInit.cpp

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

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@
206206
; CHECK-O-NEXT: Running analysis: PostDominatorTreeAnalysis
207207
; CHECK-O23SZ-NEXT: Running pass: MemCpyOptPass
208208
; CHECK-O23SZ-NEXT: Running pass: DSEPass
209-
; CHECK-O23SZ-NEXT: Running pass: MoveAutoInitPass on foo
210209
; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass
211210
; CHECK-O23SZ-NEXT: Running pass: LCSSAPass
212211
; CHECK-O23SZ-NEXT: Running pass: LICMPass

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@
108108
; CHECK-O23SZ-NEXT: Running pass: MemCpyOptPass on foo
109109
; CHECK-O23SZ-NEXT: Running pass: DSEPass on foo
110110
; CHECK-O23SZ-NEXT: Running analysis: PostDominatorTreeAnalysis on foo
111-
; CHECK-O23SZ-NEXT: Running pass: MoveAutoInitPass on foo
112111
; CHECK-O23SZ-NEXT: Running pass: MergedLoadStoreMotionPass on foo
113112
; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass on foo
114113
; CHECK-O23SZ-NEXT: Running pass: LCSSAPass on foo

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@
149149
; CHECK-O-NEXT: Running analysis: PostDominatorTreeAnalysis
150150
; CHECK-O23SZ-NEXT: Running pass: MemCpyOptPass
151151
; CHECK-O23SZ-NEXT: Running pass: DSEPass
152-
; CHECK-O23SZ-NEXT: Running pass: MoveAutoInitPass on foo
153152
; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass
154153
; CHECK-O23SZ-NEXT: Running pass: LCSSAPass
155154
; CHECK-O23SZ-NEXT: Running pass: LICMPass on loop

llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@
136136
; CHECK-O-NEXT: Running pass: ADCEPass
137137
; CHECK-O23SZ-NEXT: Running pass: MemCpyOptPass
138138
; CHECK-O23SZ-NEXT: Running pass: DSEPass
139-
; CHECK-O23SZ-NEXT: Running pass: MoveAutoInitPass on foo
140139
; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass
141140
; CHECK-O23SZ-NEXT: Running pass: LCSSAPass
142141
; CHECK-O23SZ-NEXT: Running pass: LICMPass

llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@
143143
; CHECK-O-NEXT: Running pass: ADCEPass
144144
; CHECK-O23SZ-NEXT: Running pass: MemCpyOptPass
145145
; CHECK-O23SZ-NEXT: Running pass: DSEPass
146-
; CHECK-O23SZ-NEXT: Running pass: MoveAutoInitPass
147146
; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass
148147
; CHECK-O23SZ-NEXT: Running pass: LCSSAPass
149148
; CHECK-O23SZ-NEXT: Running pass: LICMPass

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@
147147
; CHECK-O-NEXT: Running analysis: PostDominatorTreeAnalysis
148148
; CHECK-O23SZ-NEXT: Running pass: MemCpyOptPass
149149
; CHECK-O23SZ-NEXT: Running pass: DSEPass
150-
; CHECK-O23SZ-NEXT: Running pass: MoveAutoInitPass
151150
; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass
152151
; CHECK-O23SZ-NEXT: Running pass: LCSSAPass
153152
; CHECK-O23SZ-NEXT: Running pass: LICMPass on loop

llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@
172172
; CHECK-O-NEXT: Running pass: ADCEPass
173173
; CHECK-O23SZ-NEXT: Running pass: MemCpyOptPass
174174
; CHECK-O23SZ-NEXT: Running pass: DSEPass
175-
; CHECK-O23SZ-NEXT: Running pass: MoveAutoInitPass on foo
176175
; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass
177176
; CHECK-O23SZ-NEXT: Running pass: LCSSAPass
178177
; CHECK-O23SZ-NEXT: Running pass: LICMPass

llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@
137137
; CHECK-O-NEXT: Running pass: ADCEPass
138138
; CHECK-O23SZ-NEXT: Running pass: MemCpyOptPass
139139
; CHECK-O23SZ-NEXT: Running pass: DSEPass
140-
; CHECK-O23SZ-NEXT: Running pass: MoveAutoInitPass on foo
141140
; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass
142141
; CHECK-O23SZ-NEXT: Running pass: LCSSAPass
143142
; CHECK-O23SZ-NEXT: Running pass: LICMPass

0 commit comments

Comments
 (0)