aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
diff options
context:
space:
mode:
authorFarzon Lotfi <1802579+farzonl@users.noreply.github.com>2024-11-13 16:36:24 -0500
committerGitHub <noreply@github.com>2024-11-13 16:36:24 -0500
commit5ac624c8234fe0a62cbf0447dbf7035ea29d062e (patch)
tree06988a9eacd93114d1f652872e66836fd394dd81 /llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
parentde6d48d05d7aa233248d2f725654931cb1e2f6fd (diff)
downloadllvm-5ac624c8234fe0a62cbf0447dbf7035ea29d062e.zip
llvm-5ac624c8234fe0a62cbf0447dbf7035ea29d062e.tar.gz
llvm-5ac624c8234fe0a62cbf0447dbf7035ea29d062e.tar.bz2
[DirectX] Flatten arrays (#114332)
- Relevant piece is `DXILFlattenArrays.cpp` - Loads and Store Instruction visits are just for finding GetElementPtrConstantExpr and splitting them. - Allocas needed to be replaced with flattened allocas. - Global arrays were similar to allocas. Only interesting piece here is around initializers. - Most of the work went into building correct GEP chains. The approach here was a recursive strategy via `recursivelyCollectGEPs`. - All intermediary GEPs get marked for deletion and only the leaf GEPs get updated with the new index. fixes [89646](https://github.com/llvm/llvm-project/issues/89646)
Diffstat (limited to 'llvm/lib/Target/DirectX/DirectXTargetMachine.cpp')
-rw-r--r--llvm/lib/Target/DirectX/DirectXTargetMachine.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Target/DirectX/DirectXTargetMachine.cpp b/llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
index 18251ea..59dbf05 100644
--- a/llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
+++ b/llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
@@ -13,6 +13,7 @@
#include "DirectXTargetMachine.h"
#include "DXILDataScalarization.h"
+#include "DXILFlattenArrays.h"
#include "DXILIntrinsicExpansion.h"
#include "DXILOpLowering.h"
#include "DXILPrettyPrinter.h"
@@ -48,6 +49,7 @@ extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeDirectXTarget() {
auto *PR = PassRegistry::getPassRegistry();
initializeDXILIntrinsicExpansionLegacyPass(*PR);
initializeDXILDataScalarizationLegacyPass(*PR);
+ initializeDXILFlattenArraysLegacyPass(*PR);
initializeScalarizerLegacyPassPass(*PR);
initializeDXILPrepareModulePass(*PR);
initializeEmbedDXILPassPass(*PR);
@@ -91,6 +93,7 @@ public:
addPass(createDXILDataScalarizationLegacyPass());
ScalarizerPassOptions DxilScalarOptions;
DxilScalarOptions.ScalarizeLoadStore = true;
+ addPass(createDXILFlattenArraysLegacyPass());
addPass(createScalarizerPass(DxilScalarOptions));
addPass(createDXILOpLoweringLegacyPass());
addPass(createDXILFinalizeLinkageLegacyPass());