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