Skip to content

Commit 110a5be

Browse files
authored
Remove LTO and ArgumentPromotion passes (#4078)
LTO was unused, and ArgumentPromotion would not have any effect on DXIL until you use noinline, and it might decompose HLSL/DXIL objects, which could break things.
1 parent 9adf10c commit 110a5be

12 files changed

Lines changed: 29 additions & 12 deletions

File tree

include/llvm/LinkAllPasses.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespace {
5555
(void) llvm::createBitTrackingDCEPass();
5656
(void) llvm::createAliasAnalysisCounterPass();
5757
(void) llvm::createAliasDebugger();
58-
(void) llvm::createArgumentPromotionPass();
58+
// (void) llvm::createArgumentPromotionPass(); // HLSL Change - do not link
5959
(void) llvm::createAlignmentFromAssumptionsPass();
6060
(void) llvm::createBasicAliasAnalysisPass();
6161
(void) llvm::createLibCallAliasAnalysisPass(nullptr);

lib/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ add_subdirectory(Bitcode)
77
add_subdirectory(Transforms)
88
add_subdirectory(Linker)
99
add_subdirectory(Analysis)
10-
add_subdirectory(LTO)
10+
# add_subdirectory(LTO) # HLSL Change
1111
# add_subdirectory(MC) # HLSL Change
1212
# add_subdirectory(Object) # HLSL Change
1313
add_subdirectory(Option)

lib/LLVMBuild.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ subdirectories =
2828
Linker
2929
IR
3030
IRReader
31-
LTO
3231
MC
3332
Object
3433
Option
@@ -48,7 +47,7 @@ subdirectories =
4847
DxcBindingTable
4948
Miniz
5049

51-
; HLSL Change: remove LibDriver, LineEditor, add HLSL, DxrtFallback, DXIL, DxilContainer, DxilDia, DxilPIXPasses, DxilRootSignature, DxcBindingTable
50+
; HLSL Change: remove LibDriver, LineEditor, add HLSL, DxrtFallback, DXIL, DxilContainer, DxilDia, DxilPIXPasses, DxilRootSignature, DxcBindingTable, LTO
5251

5352
[component_0]
5453
type = Group

lib/Transforms/IPO/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
set(HLSL_IGNORE_SOURCES ArgumentPromotion.cpp)
12
add_llvm_library(LLVMipo
2-
ArgumentPromotion.cpp
33
BarrierNoopPass.cpp
44
ConstantMerge.cpp
55
DeadArgumentElimination.cpp

lib/Transforms/IPO/IPO.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
using namespace llvm;
2323

2424
void llvm::initializeIPO(PassRegistry &Registry) {
25+
#if 0 // HLSL Change Starts: Disable ArgPromotion
2526
initializeArgPromotionPass(Registry);
27+
#endif // HLSL Change Ends
2628
initializeConstantMergePass(Registry);
2729
initializeDAEPass(Registry);
2830
initializeDAHPass(Registry);
@@ -53,9 +55,11 @@ void LLVMInitializeIPO(LLVMPassRegistryRef R) {
5355
initializeIPO(*unwrap(R));
5456
}
5557

58+
#if 0 // HLSL Change Starts: Disable ArgPromotion
5659
void LLVMAddArgumentPromotionPass(LLVMPassManagerRef PM) {
5760
unwrap(PM)->add(createArgumentPromotionPass());
5861
}
62+
#endif // HLSL Change Ends
5963

6064
void LLVMAddConstantMergePass(LLVMPassManagerRef PM) {
6165
unwrap(PM)->add(createConstantMergePass());

lib/Transforms/IPO/PassManagerBuilder.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,11 @@ void PassManagerBuilder::populateModulePassManager(
443443
}
444444
if (!DisableUnitAtATime)
445445
MPM.add(createFunctionAttrsPass()); // Set readonly/readnone attrs
446+
447+
#if 0 // HLSL Change Starts: Disable ArgumentPromotion
446448
if (OptLevel > 2)
447449
MPM.add(createArgumentPromotionPass()); // Scalarize uninlined fn args
450+
#endif // HLSL Change Ends
448451

449452
// Start of function pass.
450453
// Break up aggregate allocas, using SSAUpdater.
@@ -700,6 +703,7 @@ void PassManagerBuilder::populateModulePassManager(
700703
addExtensionsToPM(EP_OptimizerLast, MPM);
701704
}
702705

706+
#if 0 // HLSL Change: No LTO
703707
void PassManagerBuilder::addLTOOptimizationPasses(legacy::PassManagerBase &PM) {
704708
// Provide AliasAnalysis services for optimizations.
705709
addInitialAliasAnalysisPasses(PM);
@@ -834,6 +838,7 @@ void PassManagerBuilder::populateLTOPassManager(legacy::PassManagerBase &PM) {
834838
if (VerifyOutput)
835839
PM.add(createVerifierPass());
836840
}
841+
#endif
837842

838843
inline PassManagerBuilder *unwrap(LLVMPassManagerBuilderRef P) {
839844
return reinterpret_cast<PassManagerBuilder*>(P);
@@ -910,6 +915,7 @@ LLVMPassManagerBuilderPopulateModulePassManager(LLVMPassManagerBuilderRef PMB,
910915
Builder->populateModulePassManager(*MPM);
911916
}
912917

918+
#if 0 // HLSL Change: No LTO
913919
void LLVMPassManagerBuilderPopulateLTOPassManager(LLVMPassManagerBuilderRef PMB,
914920
LLVMPassManagerRef PM,
915921
LLVMBool Internalize,
@@ -924,3 +930,4 @@ void LLVMPassManagerBuilderPopulateLTOPassManager(LLVMPassManagerBuilderRef PMB,
924930

925931
Builder->populateLTOPassManager(*LPM);
926932
}
933+
#endif

tools/LLVMBuild.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ subdirectories =
2828
llvm-dwarfdump
2929
llvm-extract
3030
llvm-link
31-
llvm-lto
3231
llvm-mc
3332
llvm-mcmarkup
3433
llvm-nm
@@ -46,4 +45,4 @@ type = Group
4645
name = Tools
4746
parent = $ROOT
4847

49-
; HLSL Changes: remove bugpoint, llvm-ar, llvm-jitlistener
48+
; HLSL Changes: remove bugpoint, llvm-ar, llvm-jitlistener, llvm-lto

tools/clang/tools/dxcompiler/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ set(LLVM_LINK_COMPONENTS
2929
# libdriver
3030
# lineeditor
3131
linker
32-
lto
32+
# lto
3333
# mirparser # no support for LLVM codegen
3434
mssupport
3535
# object # no support for object files (coff, elf)

tools/clang/tools/dxrfallbackcompiler/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ set(LLVM_LINK_COMPONENTS
2727
# libdriver
2828
# lineeditor
2929
linker
30-
lto
30+
# lto
3131
# mirparser # no support for LLVM codegen
3232
mssupport
3333
# object # no support for object files (coff, elf)

tools/clang/unittests/DxrFallback/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ set(LLVM_LINK_COMPONENTS
1515
ipo
1616
irreader
1717
linker
18-
lto
18+
# lto
1919
mssupport
2020
option
2121
profiledata

0 commit comments

Comments
 (0)