1//===- DXILDataScalarization.cpp - Perform DXIL Data Legalization ---------===//
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#include "DXILDataScalarization.h"
10#include "DirectX.h"
11#include "llvm/ADT/PostOrderIterator.h"
12#include "llvm/ADT/STLExtras.h"
13#include "llvm/IR/DerivedTypes.h"
14#include "llvm/IR/GlobalVariable.h"
15#include "llvm/IR/IRBuilder.h"
16#include "llvm/IR/InstVisitor.h"
17#include "llvm/IR/Instructions.h"
18#include "llvm/IR/Module.h"
19#include "llvm/IR/Operator.h"
20#include "llvm/IR/PassManager.h"
21#include "llvm/IR/ReplaceConstant.h"
22#include "llvm/IR/Type.h"
23#include "llvm/Support/Casting.h"
24#include "llvm/Transforms/Utils/Cloning.h"
25#include "llvm/Transforms/Utils/Local.h"
26
27#define DEBUG_TYPE "dxil-data-scalarization"
28static const int MaxVecSize = 4;
29
30using namespace llvm;
31
32class DXILDataScalarizationLegacy : public ModulePass {
33
34public:
35 bool runOnModule(Module &M) override;
36 DXILDataScalarizationLegacy() : ModulePass(ID) {}
37
38 static char ID; // Pass identification.
39};
40
41static bool findAndReplaceVectors(Module &M);
42
43class DataScalarizerVisitor : public InstVisitor<DataScalarizerVisitor, bool> {
44public:
45 DataScalarizerVisitor() : GlobalMap() {}
46 bool visit(Function &F);
47 // InstVisitor methods. They return true if the instruction was scalarized,
48 // false if nothing changed.
49 bool visitAllocaInst(AllocaInst &AI);
50 bool visitInstruction(Instruction &I) { return false; }
51 bool visitSelectInst(SelectInst &SI) { return false; }
52 bool visitICmpInst(ICmpInst &ICI) { return false; }
53 bool visitFCmpInst(FCmpInst &FCI) { return false; }
54 bool visitUnaryOperator(UnaryOperator &UO) { return false; }
55 bool visitBinaryOperator(BinaryOperator &BO) { return false; }
56 bool visitGetElementPtrInst(GetElementPtrInst &GEPI);
57 bool visitCastInst(CastInst &CI) { return false; }
58 bool visitBitCastInst(BitCastInst &BCI) { return false; }
59 bool visitInsertElementInst(InsertElementInst &IEI);
60 bool visitExtractElementInst(ExtractElementInst &EEI);
61 bool visitShuffleVectorInst(ShuffleVectorInst &SVI) { return false; }
62 bool visitPHINode(PHINode &PHI) { return false; }
63 bool visitLoadInst(LoadInst &LI);
64 bool visitStoreInst(StoreInst &SI);
65 bool visitCallInst(CallInst &ICI) { return false; }
66 bool visitFreezeInst(FreezeInst &FI) { return false; }
67 friend bool findAndReplaceVectors(llvm::Module &M);
68
69private:
70 typedef std::tuple<AllocaInst *, Type *, SmallVector<Value *, 4>>
71 AllocaAndGEPs;
72 typedef SmallDenseMap<Value *, AllocaAndGEPs>
73 VectorToArrayMap; // A map from a vector-typed Value to its corresponding
74 // AllocaInst and GEPs to each element of an array
75 VectorToArrayMap VectorAllocaMap;
76 AllocaAndGEPs createArrayFromVector(IRBuilder<> &Builder, Value *Vec,
77 const Twine &Name);
78 bool replaceDynamicInsertElementInst(InsertElementInst &IEI);
79 bool replaceDynamicExtractElementInst(ExtractElementInst &EEI);
80
81 GlobalVariable *lookupReplacementGlobal(Value *CurrOperand);
82 DenseMap<GlobalVariable *, GlobalVariable *> GlobalMap;
83};
84
85bool DataScalarizerVisitor::visit(Function &F) {
86 bool MadeChange = false;
87 ReversePostOrderTraversal<Function *> RPOT(&F);
88 for (BasicBlock *BB : make_early_inc_range(Range&: RPOT)) {
89 for (Instruction &I : make_early_inc_range(Range&: *BB))
90 MadeChange |= InstVisitor::visit(I);
91 }
92 VectorAllocaMap.clear();
93 return MadeChange;
94}
95
96GlobalVariable *
97DataScalarizerVisitor::lookupReplacementGlobal(Value *CurrOperand) {
98 if (GlobalVariable *OldGlobal = dyn_cast<GlobalVariable>(Val: CurrOperand)) {
99 auto It = GlobalMap.find(Val: OldGlobal);
100 if (It != GlobalMap.end()) {
101 return It->second; // Found, return the new global
102 }
103 }
104 return nullptr; // Not found
105}
106
107// Helper function to check if a type is a vector or an array of vectors
108static bool isVectorOrArrayOfVectors(Type *T) {
109 if (isa<VectorType>(Val: T))
110 return true;
111 if (ArrayType *ArrayTy = dyn_cast<ArrayType>(Val: T))
112 return isVectorOrArrayOfVectors(T: ArrayTy->getElementType());
113 return false;
114}
115
116// Recursively creates an array-like version of a given vector type.
117static Type *equivalentArrayTypeFromVector(Type *T) {
118 if (auto *VecTy = dyn_cast<VectorType>(Val: T))
119 return ArrayType::get(ElementType: VecTy->getElementType(),
120 NumElements: dyn_cast<FixedVectorType>(Val: VecTy)->getNumElements());
121 if (auto *ArrayTy = dyn_cast<ArrayType>(Val: T)) {
122 Type *NewElementType =
123 equivalentArrayTypeFromVector(T: ArrayTy->getElementType());
124 return ArrayType::get(ElementType: NewElementType, NumElements: ArrayTy->getNumElements());
125 }
126 // If it's not a vector or array, return the original type.
127 return T;
128}
129
130bool DataScalarizerVisitor::visitAllocaInst(AllocaInst &AI) {
131 Type *AllocatedType = AI.getAllocatedType();
132 if (!isVectorOrArrayOfVectors(T: AllocatedType))
133 return false;
134
135 IRBuilder<> Builder(&AI);
136 Type *NewType = equivalentArrayTypeFromVector(T: AllocatedType);
137 AllocaInst *ArrAlloca =
138 Builder.CreateAlloca(Ty: NewType, ArraySize: nullptr, Name: AI.getName() + ".scalarized");
139 ArrAlloca->setAlignment(AI.getAlign());
140 AI.replaceAllUsesWith(V: ArrAlloca);
141 AI.eraseFromParent();
142 return true;
143}
144
145bool DataScalarizerVisitor::visitLoadInst(LoadInst &LI) {
146 Value *PtrOperand = LI.getPointerOperand();
147 ConstantExpr *CE = dyn_cast<ConstantExpr>(Val: PtrOperand);
148 if (CE && CE->getOpcode() == Instruction::GetElementPtr) {
149 GetElementPtrInst *OldGEP = cast<GetElementPtrInst>(Val: CE->getAsInstruction());
150 OldGEP->insertBefore(InsertPos: LI.getIterator());
151 IRBuilder<> Builder(&LI);
152 LoadInst *NewLoad = Builder.CreateLoad(Ty: LI.getType(), Ptr: OldGEP, Name: LI.getName());
153 NewLoad->setAlignment(LI.getAlign());
154 LI.replaceAllUsesWith(V: NewLoad);
155 LI.eraseFromParent();
156 visitGetElementPtrInst(GEPI&: *OldGEP);
157 return true;
158 }
159 if (GlobalVariable *NewGlobal = lookupReplacementGlobal(CurrOperand: PtrOperand))
160 LI.setOperand(i_nocapture: LI.getPointerOperandIndex(), Val_nocapture: NewGlobal);
161 return false;
162}
163
164bool DataScalarizerVisitor::visitStoreInst(StoreInst &SI) {
165
166 Value *PtrOperand = SI.getPointerOperand();
167 ConstantExpr *CE = dyn_cast<ConstantExpr>(Val: PtrOperand);
168 if (CE && CE->getOpcode() == Instruction::GetElementPtr) {
169 GetElementPtrInst *OldGEP = cast<GetElementPtrInst>(Val: CE->getAsInstruction());
170 OldGEP->insertBefore(InsertPos: SI.getIterator());
171 IRBuilder<> Builder(&SI);
172 StoreInst *NewStore = Builder.CreateStore(Val: SI.getValueOperand(), Ptr: OldGEP);
173 NewStore->setAlignment(SI.getAlign());
174 SI.replaceAllUsesWith(V: NewStore);
175 SI.eraseFromParent();
176 visitGetElementPtrInst(GEPI&: *OldGEP);
177 return true;
178 }
179 if (GlobalVariable *NewGlobal = lookupReplacementGlobal(CurrOperand: PtrOperand))
180 SI.setOperand(i_nocapture: SI.getPointerOperandIndex(), Val_nocapture: NewGlobal);
181
182 return false;
183}
184
185DataScalarizerVisitor::AllocaAndGEPs
186DataScalarizerVisitor::createArrayFromVector(IRBuilder<> &Builder, Value *Vec,
187 const Twine &Name = "") {
188 // If there is already an alloca for this vector, return it
189 if (VectorAllocaMap.contains(Val: Vec))
190 return VectorAllocaMap[Vec];
191
192 auto InsertPoint = Builder.GetInsertPoint();
193
194 // Allocate the array to hold the vector elements
195 Builder.SetInsertPointPastAllocas(Builder.GetInsertBlock()->getParent());
196 Type *ArrTy = equivalentArrayTypeFromVector(T: Vec->getType());
197 // DXIL indexable temps cannot hold i1 elements; booleans occupy 32 bits in
198 // memory. Widen i1 element arrays to i32.
199 Type *ArrElemTy = ArrTy->getArrayElementType();
200 bool WidenBool = ArrElemTy->isIntegerTy(BitWidth: 1);
201 if (WidenBool) {
202 ArrElemTy = Builder.getInt32Ty();
203 ArrTy = ArrayType::get(ElementType: ArrElemTy, NumElements: ArrTy->getArrayNumElements());
204 }
205 AllocaInst *ArrAlloca =
206 Builder.CreateAlloca(Ty: ArrTy, ArraySize: nullptr, Name: Name + ".alloca");
207 const uint64_t ArrNumElems = ArrTy->getArrayNumElements();
208
209 // Create loads and stores to populate the array immediately after the
210 // original vector's defining instruction if available, else immediately after
211 // the alloca
212 if (auto *Instr = dyn_cast<Instruction>(Val: Vec))
213 Builder.SetInsertPoint(Instr->getNextNode());
214 SmallVector<Value *, 4> GEPs(ArrNumElems);
215 for (unsigned I = 0; I < ArrNumElems; ++I) {
216 Value *EE = Builder.CreateExtractElement(Vec, Idx: I, Name: Name + ".extract");
217 if (WidenBool)
218 EE = Builder.CreateZExt(V: EE, DestTy: ArrElemTy, Name: Name + ".zext");
219 GEPs[I] = GetElementPtrInst::CreateInBounds(
220 PointeeType: ArrTy, Ptr: ArrAlloca, IdxList: {Builder.getInt32(C: 0), Builder.getInt32(C: I)},
221 NameStr: Name + ".index", InsertBefore: Builder.GetInsertPoint());
222 Builder.CreateStore(Val: EE, Ptr: GEPs[I]);
223 }
224
225 VectorAllocaMap.insert(KV: {Vec, {ArrAlloca, ArrTy, GEPs}});
226 Builder.SetInsertPoint(InsertPoint);
227 return {ArrAlloca, ArrTy, GEPs};
228}
229
230/// Returns a pair of Value* with the first being a GEP into ArrAlloca using
231/// indices {0, Index}, and the second Value* being a Load of the GEP
232static std::pair<Value *, Value *>
233dynamicallyLoadArray(IRBuilder<> &Builder, AllocaInst *ArrAlloca, Type *ArrTy,
234 Value *Index, const Twine &Name = "") {
235 Value *GEP = GetElementPtrInst::CreateInBounds(
236 PointeeType: ArrTy, Ptr: ArrAlloca, IdxList: {Builder.getInt32(C: 0), Index}, NameStr: Name + ".index",
237 InsertBefore: Builder.GetInsertPoint());
238 Value *Load =
239 Builder.CreateLoad(Ty: ArrTy->getArrayElementType(), Ptr: GEP, Name: Name + ".load");
240 return std::make_pair(x&: GEP, y&: Load);
241}
242
243bool DataScalarizerVisitor::replaceDynamicInsertElementInst(
244 InsertElementInst &IEI) {
245 IRBuilder<> Builder(&IEI);
246
247 Value *Vec = IEI.getOperand(i_nocapture: 0);
248 Value *Val = IEI.getOperand(i_nocapture: 1);
249 Value *Index = IEI.getOperand(i_nocapture: 2);
250
251 AllocaAndGEPs ArrAllocaAndGEPs =
252 createArrayFromVector(Builder, Vec, Name: IEI.getName());
253 AllocaInst *ArrAlloca = std::get<0>(t&: ArrAllocaAndGEPs);
254 Type *ArrTy = std::get<1>(t&: ArrAllocaAndGEPs);
255 SmallVector<Value *, 4> &ArrGEPs = std::get<2>(t&: ArrAllocaAndGEPs);
256
257 // The array element type may have been widened (e.g. i1 -> i32) so that the
258 // indexable temp uses a legal DXIL memory type. Convert between the vector
259 // element type and the (possibly wider) array element type as needed.
260 Type *ArrElemTy = ArrTy->getArrayElementType();
261 Type *VecElemTy = cast<VectorType>(Val: Vec->getType())->getElementType();
262 bool WidenBool = ArrElemTy != VecElemTy && VecElemTy->isIntegerTy(BitWidth: 1);
263
264 auto GEPAndLoad =
265 dynamicallyLoadArray(Builder, ArrAlloca, ArrTy, Index, Name: IEI.getName());
266 Value *GEP = GEPAndLoad.first;
267 Value *Load = GEPAndLoad.second;
268
269 Value *StoreVal = Val;
270 if (WidenBool)
271 StoreVal = Builder.CreateZExt(V: Val, DestTy: ArrElemTy, Name: IEI.getName() + ".zext");
272 Builder.CreateStore(Val: StoreVal, Ptr: GEP);
273 Value *NewIEI = PoisonValue::get(T: Vec->getType());
274 for (unsigned I = 0; I < ArrTy->getArrayNumElements(); ++I) {
275 Value *EltLoad =
276 Builder.CreateLoad(Ty: ArrElemTy, Ptr: ArrGEPs[I], Name: IEI.getName() + ".load");
277 if (WidenBool)
278 EltLoad =
279 Builder.CreateTrunc(V: EltLoad, DestTy: VecElemTy, Name: IEI.getName() + ".trunc");
280 NewIEI = Builder.CreateInsertElement(Vec: NewIEI, NewElt: EltLoad, Idx: Builder.getInt32(C: I),
281 Name: IEI.getName() + ".insert");
282 }
283
284 // Store back the original value so the Alloca can be reused for subsequent
285 // insertelement instructions on the same vector
286 Builder.CreateStore(Val: Load, Ptr: GEP);
287
288 IEI.replaceAllUsesWith(V: NewIEI);
289 IEI.eraseFromParent();
290 return true;
291}
292
293bool DataScalarizerVisitor::visitInsertElementInst(InsertElementInst &IEI) {
294 // If the index is a constant then we don't need to scalarize it
295 Value *Index = IEI.getOperand(i_nocapture: 2);
296 if (isa<ConstantInt>(Val: Index))
297 return false;
298 return replaceDynamicInsertElementInst(IEI);
299}
300
301bool DataScalarizerVisitor::replaceDynamicExtractElementInst(
302 ExtractElementInst &EEI) {
303 IRBuilder<> Builder(&EEI);
304
305 AllocaAndGEPs ArrAllocaAndGEPs =
306 createArrayFromVector(Builder, Vec: EEI.getVectorOperand(), Name: EEI.getName());
307 AllocaInst *ArrAlloca = std::get<0>(t&: ArrAllocaAndGEPs);
308 Type *ArrTy = std::get<1>(t&: ArrAllocaAndGEPs);
309
310 auto GEPAndLoad = dynamicallyLoadArray(Builder, ArrAlloca, ArrTy,
311 Index: EEI.getIndexOperand(), Name: EEI.getName());
312 Value *Load = GEPAndLoad.second;
313
314 // The array element type may have been widened (e.g. i1 -> i32) so that the
315 // indexable temp uses a legal DXIL memory type. Truncate back to the original
316 // element type of the extractelement if necessary.
317 if (Load->getType() != EEI.getType()) {
318 assert(Load->getType()->isIntegerTy(32) && EEI.getType()->isIntegerTy(1) &&
319 "Unexpected type mismatch: only i32 -> i1 widening is supported");
320 Load = Builder.CreateTrunc(V: Load, DestTy: EEI.getType(), Name: EEI.getName() + ".trunc");
321 }
322
323 EEI.replaceAllUsesWith(V: Load);
324 EEI.eraseFromParent();
325 return true;
326}
327
328bool DataScalarizerVisitor::visitExtractElementInst(ExtractElementInst &EEI) {
329 // If the index is a constant then we don't need to scalarize it
330 Value *Index = EEI.getIndexOperand();
331 if (isa<ConstantInt>(Val: Index))
332 return false;
333 return replaceDynamicExtractElementInst(EEI);
334}
335
336bool DataScalarizerVisitor::visitGetElementPtrInst(GetElementPtrInst &GEPI) {
337 GEPOperator *GOp = cast<GEPOperator>(Val: &GEPI);
338 Value *PtrOperand = GOp->getPointerOperand();
339 Type *GEPType = GOp->getSourceElementType();
340
341 // Replace a GEP ConstantExpr pointer operand with a GEP instruction so that
342 // it can be visited
343 if (auto *PtrOpGEPCE = dyn_cast<ConstantExpr>(Val: PtrOperand);
344 PtrOpGEPCE && PtrOpGEPCE->getOpcode() == Instruction::GetElementPtr) {
345 GetElementPtrInst *OldGEPI =
346 cast<GetElementPtrInst>(Val: PtrOpGEPCE->getAsInstruction());
347 OldGEPI->insertBefore(InsertPos: GEPI.getIterator());
348
349 SmallVector<Value *> Indices(GEPI.indices());
350 GetElementPtrInst *NewGEPI = GetElementPtrInst::Create(
351 PointeeType: GEPI.getSourceElementType(), Ptr: OldGEPI, IdxList: Indices, NW: GEPI.getNoWrapFlags(),
352 NameStr: GEPI.getName(), InsertBefore: GEPI.getIterator());
353
354 GEPI.replaceAllUsesWith(V: NewGEPI);
355 GEPI.eraseFromParent();
356 visitGetElementPtrInst(GEPI&: *OldGEPI);
357 visitGetElementPtrInst(GEPI&: *NewGEPI);
358 return true;
359 }
360
361 Type *NewGEPType = equivalentArrayTypeFromVector(T: GEPType);
362 Value *NewPtrOperand = PtrOperand;
363 if (GlobalVariable *NewGlobal = lookupReplacementGlobal(CurrOperand: PtrOperand))
364 NewPtrOperand = NewGlobal;
365
366 bool NeedsTransform = NewPtrOperand != PtrOperand || NewGEPType != GEPType;
367 if (!NeedsTransform)
368 return false;
369
370 SmallVector<Value *, MaxVecSize> Indices(GOp->idx_begin(), GOp->idx_end());
371 Value *NewGEP = GetElementPtrInst::Create(PointeeType: NewGEPType, Ptr: NewPtrOperand, IdxList: Indices,
372 NW: GOp->getNoWrapFlags(),
373 NameStr: GOp->getName(), InsertBefore: GEPI.getIterator());
374
375 GOp->replaceAllUsesWith(V: NewGEP);
376
377 if (auto *OldGEPI = dyn_cast<GetElementPtrInst>(Val: GOp))
378 OldGEPI->eraseFromParent();
379
380 return true;
381}
382
383static Constant *transformInitializer(Constant *Init, Type *OrigType,
384 Type *NewType, LLVMContext &Ctx) {
385 // Handle ConstantAggregateZero (zero-initialized constants)
386 if (isa<ConstantAggregateZero>(Val: Init)) {
387 return ConstantAggregateZero::get(Ty: NewType);
388 }
389
390 // Handle UndefValue (undefined constants)
391 if (isa<UndefValue>(Val: Init)) {
392 return UndefValue::get(T: NewType);
393 }
394
395 // Handle vector to array transformation
396 if (isa<VectorType>(Val: OrigType) && isa<ArrayType>(Val: NewType)) {
397 // Convert vector initializer to array initializer
398 SmallVector<Constant *, MaxVecSize> ArrayElements;
399
400 unsigned E = cast<FixedVectorType>(Val: OrigType)->getNumElements();
401 for (unsigned I = 0; I != E; ++I)
402 if (Constant *Elt = Init->getAggregateElement(Elt: I))
403 ArrayElements.push_back(Elt);
404
405 assert(ArrayElements.size() == E &&
406 "Expected fixed length constant aggregate for vector initializer!");
407 return ConstantArray::get(T: cast<ArrayType>(Val: NewType), V: ArrayElements);
408 }
409
410 // Handle array of vectors transformation
411 if (auto *ArrayTy = dyn_cast<ArrayType>(Val: OrigType)) {
412 auto *ArrayInit = dyn_cast<ConstantArray>(Val: Init);
413 assert(ArrayInit && "Expected a ConstantArray for array initializer!");
414
415 SmallVector<Constant *, MaxVecSize> NewArrayElements;
416 for (unsigned I = 0; I < ArrayTy->getNumElements(); ++I) {
417 // Recursively transform array elements
418 Constant *NewElemInit = transformInitializer(
419 Init: ArrayInit->getOperand(i_nocapture: I), OrigType: ArrayTy->getElementType(),
420 NewType: cast<ArrayType>(Val: NewType)->getElementType(), Ctx);
421 NewArrayElements.push_back(Elt: NewElemInit);
422 }
423
424 return ConstantArray::get(T: cast<ArrayType>(Val: NewType), V: NewArrayElements);
425 }
426
427 // If not a vector or array, return the original initializer
428 return Init;
429}
430
431static bool findAndReplaceVectors(Module &M) {
432 bool MadeChange = false;
433 LLVMContext &Ctx = M.getContext();
434 IRBuilder<> Builder(M);
435 DataScalarizerVisitor Impl;
436 for (GlobalVariable &G : M.globals()) {
437 Type *OrigType = G.getValueType();
438
439 Type *NewType = equivalentArrayTypeFromVector(T: OrigType);
440 if (OrigType != NewType) {
441 // Create a new global variable with the updated type
442 // Note: Initializer is set via transformInitializer
443 GlobalVariable *NewGlobal = new GlobalVariable(
444 M, NewType, G.isConstant(), G.getLinkage(),
445 /*Initializer=*/nullptr, G.getName() + ".scalarized", &G,
446 G.getThreadLocalMode(), G.getAddressSpace(),
447 G.isExternallyInitialized());
448
449 // Copy relevant attributes
450 NewGlobal->setUnnamedAddr(G.getUnnamedAddr());
451 if (G.getAlign()) {
452 NewGlobal->setAlignment(G.getAlign());
453 }
454
455 if (G.hasInitializer()) {
456 Constant *Init = G.getInitializer();
457 Constant *NewInit = transformInitializer(Init, OrigType, NewType, Ctx);
458 NewGlobal->setInitializer(NewInit);
459 }
460
461 // Note: we want to do G.replaceAllUsesWith(NewGlobal);, but it assumes
462 // type equality. Instead we will use the visitor pattern.
463 Impl.GlobalMap[&G] = NewGlobal;
464 }
465 }
466
467 for (auto &F : make_early_inc_range(Range: M.functions())) {
468 if (F.isDeclaration())
469 continue;
470 MadeChange |= Impl.visit(F);
471 }
472
473 // Remove the old globals after the iteration
474 for (auto &[Old, New] : Impl.GlobalMap) {
475 Old->eraseFromParent();
476 MadeChange = true;
477 }
478 return MadeChange;
479}
480
481PreservedAnalyses DXILDataScalarization::run(Module &M,
482 ModuleAnalysisManager &) {
483 bool MadeChanges = findAndReplaceVectors(M);
484 if (!MadeChanges)
485 return PreservedAnalyses::all();
486 PreservedAnalyses PA;
487 return PA;
488}
489
490bool DXILDataScalarizationLegacy::runOnModule(Module &M) {
491 return findAndReplaceVectors(M);
492}
493
494char DXILDataScalarizationLegacy::ID = 0;
495
496INITIALIZE_PASS_BEGIN(DXILDataScalarizationLegacy, DEBUG_TYPE,
497 "DXIL Data Scalarization", false, false)
498INITIALIZE_PASS_END(DXILDataScalarizationLegacy, DEBUG_TYPE,
499 "DXIL Data Scalarization", false, false)
500
501ModulePass *llvm::createDXILDataScalarizationLegacyPass() {
502 return new DXILDataScalarizationLegacy();
503}
504