LLVM 22.0.0git
SPIRVLegalizePointerCast.cpp
Go to the documentation of this file.
1//===-- SPIRVLegalizePointerCast.cpp ----------------------*- C++ -*-===//
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// The LLVM IR has multiple legal patterns we cannot lower to Logical SPIR-V.
10// This pass modifies such loads to have an IR we can directly lower to valid
11// logical SPIR-V.
12// OpenCL can avoid this because they rely on ptrcast, which is not supported
13// by logical SPIR-V.
14//
15// This pass relies on the assign_ptr_type intrinsic to deduce the type of the
16// pointed values, must replace all occurences of `ptrcast`. This is why
17// unhandled cases are reported as unreachable: we MUST cover all cases.
18//
19// 1. Loading the first element of an array
20//
21// %array = [10 x i32]
22// %value = load i32, ptr %array
23//
24// LLVM can skip the GEP instruction, and only request loading the first 4
25// bytes. In logical SPIR-V, we need an OpAccessChain to access the first
26// element. This pass will add a getelementptr instruction before the load.
27//
28//
29// 2. Implicit downcast from load
30//
31// %1 = getelementptr <4 x i32>, ptr %vec4, i64 0
32// %2 = load <3 x i32>, ptr %1
33//
34// The pointer in the GEP instruction is only used for offset computations,
35// but it doesn't NEED to match the pointed type. OpAccessChain however
36// requires this. Also, LLVM loads define the bitwidth of the load, not the
37// pointer. In this example, we can guess %vec4 is a vec4 thanks to the GEP
38// instruction basetype, but we only want to load the first 3 elements, hence
39// do a partial load. In logical SPIR-V, this is not legal. What we must do
40// is load the full vector (basetype), extract 3 elements, and recombine them
41// to form a 3-element vector.
42//
43//===----------------------------------------------------------------------===//
44
45#include "SPIRV.h"
46#include "SPIRVSubtarget.h"
47#include "SPIRVTargetMachine.h"
48#include "SPIRVUtils.h"
49#include "llvm/IR/IRBuilder.h"
51#include "llvm/IR/Intrinsics.h"
52#include "llvm/IR/IntrinsicsSPIRV.h"
55
56using namespace llvm;
57
58namespace {
59class SPIRVLegalizePointerCast : public FunctionPass {
60
61 // Builds the `spv_assign_type` assigning |Ty| to |Value| at the current
62 // builder position.
63 void buildAssignType(IRBuilder<> &B, Type *Ty, Value *Arg) {
64 Value *OfType = PoisonValue::get(Ty);
65 CallInst *AssignCI = buildIntrWithMD(Intrinsic::spv_assign_type,
66 {Arg->getType()}, OfType, Arg, {}, B);
67 GR->addAssignPtrTypeInstr(Arg, AssignCI);
68 }
69
70 // Loads parts of the vector of type |SourceType| from the pointer |Source|
71 // and create a new vector of type |TargetType|. |TargetType| must be a vector
72 // type, and element types of |TargetType| and |SourceType| must match.
73 // Returns the loaded value.
74 Value *loadVectorFromVector(IRBuilder<> &B, FixedVectorType *SourceType,
75 FixedVectorType *TargetType, Value *Source) {
76 LoadInst *NewLoad = B.CreateLoad(SourceType, Source);
77 buildAssignType(B, SourceType, NewLoad);
78 Value *AssignValue = NewLoad;
79 if (TargetType->getElementType() != SourceType->getElementType()) {
80 const DataLayout &DL = B.GetInsertBlock()->getModule()->getDataLayout();
81 [[maybe_unused]] TypeSize TargetTypeSize =
82 DL.getTypeSizeInBits(TargetType);
83 [[maybe_unused]] TypeSize SourceTypeSize =
84 DL.getTypeSizeInBits(SourceType);
85 assert(TargetTypeSize == SourceTypeSize);
86 AssignValue = B.CreateIntrinsic(Intrinsic::spv_bitcast,
87 {TargetType, SourceType}, {NewLoad});
88 buildAssignType(B, TargetType, AssignValue);
89 return AssignValue;
90 }
91
92 assert(TargetType->getNumElements() < SourceType->getNumElements());
93 SmallVector<int> Mask(/* Size= */ TargetType->getNumElements());
94 for (unsigned I = 0; I < TargetType->getNumElements(); ++I)
95 Mask[I] = I;
96 Value *Output = B.CreateShuffleVector(AssignValue, AssignValue, Mask);
97 buildAssignType(B, TargetType, Output);
98 return Output;
99 }
100
101 // Loads the first value in an aggregate pointed by |Source| of containing
102 // elements of type |ElementType|. Load flags will be copied from |BadLoad|,
103 // which should be the load being legalized. Returns the loaded value.
104 Value *loadFirstValueFromAggregate(IRBuilder<> &B, Type *ElementType,
105 Value *Source, LoadInst *BadLoad) {
107 BadLoad->getPointerOperandType()};
108 SmallVector<Value *, 3> Args{/* isInBounds= */ B.getInt1(false), Source,
109 B.getInt32(0), B.getInt32(0)};
110 auto *GEP = B.CreateIntrinsic(Intrinsic::spv_gep, {Types}, {Args});
111 GR->buildAssignPtr(B, ElementType, GEP);
112
113 LoadInst *LI = B.CreateLoad(ElementType, GEP);
114 LI->setAlignment(BadLoad->getAlign());
115 buildAssignType(B, ElementType, LI);
116 return LI;
117 }
118
119 // Loads elements from an array and constructs a vector.
120 Value *loadVectorFromArray(IRBuilder<> &B, FixedVectorType *TargetType,
121 Value *Source) {
122 // Load each element of the array.
123 SmallVector<Value *, 4> LoadedElements;
124 for (unsigned i = 0; i < TargetType->getNumElements(); ++i) {
125 // Create a GEP to access the i-th element of the array.
126 SmallVector<Type *, 2> Types = {Source->getType(), Source->getType()};
128 Args.push_back(B.getInt1(false));
129 Args.push_back(Source);
130 Args.push_back(B.getInt32(0));
131 Args.push_back(ConstantInt::get(B.getInt32Ty(), i));
132 auto *ElementPtr = B.CreateIntrinsic(Intrinsic::spv_gep, {Types}, {Args});
133 GR->buildAssignPtr(B, TargetType->getElementType(), ElementPtr);
134
135 // Load the value from the element pointer.
136 Value *Load = B.CreateLoad(TargetType->getElementType(), ElementPtr);
137 buildAssignType(B, TargetType->getElementType(), Load);
138 LoadedElements.push_back(Load);
139 }
140
141 // Build the vector from the loaded elements.
142 Value *NewVector = PoisonValue::get(TargetType);
143 buildAssignType(B, TargetType, NewVector);
144
145 for (unsigned i = 0; i < TargetType->getNumElements(); ++i) {
146 Value *Index = B.getInt32(i);
147 SmallVector<Type *, 4> Types = {TargetType, TargetType,
148 TargetType->getElementType(),
149 Index->getType()};
150 SmallVector<Value *> Args = {NewVector, LoadedElements[i], Index};
151 NewVector = B.CreateIntrinsic(Intrinsic::spv_insertelt, {Types}, {Args});
152 buildAssignType(B, TargetType, NewVector);
153 }
154 return NewVector;
155 }
156
157 // Stores elements from a vector into an array.
158 void storeArrayFromVector(IRBuilder<> &B, Value *SrcVector,
159 Value *DstArrayPtr, ArrayType *ArrTy,
160 Align Alignment) {
161 auto *VecTy = cast<FixedVectorType>(SrcVector->getType());
162
163 // Ensure the element types of the array and vector are the same.
164 assert(VecTy->getElementType() == ArrTy->getElementType() &&
165 "Element types of array and vector must be the same.");
166
167 for (unsigned i = 0; i < VecTy->getNumElements(); ++i) {
168 // Create a GEP to access the i-th element of the array.
169 SmallVector<Type *, 2> Types = {DstArrayPtr->getType(),
170 DstArrayPtr->getType()};
172 Args.push_back(B.getInt1(false));
173 Args.push_back(DstArrayPtr);
174 Args.push_back(B.getInt32(0));
175 Args.push_back(ConstantInt::get(B.getInt32Ty(), i));
176 auto *ElementPtr = B.CreateIntrinsic(Intrinsic::spv_gep, {Types}, {Args});
177 GR->buildAssignPtr(B, ArrTy->getElementType(), ElementPtr);
178
179 // Extract the element from the vector and store it.
180 Value *Index = B.getInt32(i);
181 SmallVector<Type *, 3> EltTypes = {VecTy->getElementType(), VecTy,
182 Index->getType()};
183 SmallVector<Value *, 2> EltArgs = {SrcVector, Index};
184 Value *Element =
185 B.CreateIntrinsic(Intrinsic::spv_extractelt, {EltTypes}, {EltArgs});
186 buildAssignType(B, VecTy->getElementType(), Element);
187
188 Types = {Element->getType(), ElementPtr->getType()};
189 Args = {Element, ElementPtr, B.getInt16(2), B.getInt8(Alignment.value())};
190 B.CreateIntrinsic(Intrinsic::spv_store, {Types}, {Args});
191 }
192 }
193
194 // Replaces the load instruction to get rid of the ptrcast used as source
195 // operand.
196 void transformLoad(IRBuilder<> &B, LoadInst *LI, Value *CastedOperand,
197 Value *OriginalOperand) {
198 Type *FromTy = GR->findDeducedElementType(OriginalOperand);
199 Type *ToTy = GR->findDeducedElementType(CastedOperand);
200 Value *Output = nullptr;
201
202 auto *SAT = dyn_cast<ArrayType>(FromTy);
203 auto *SVT = dyn_cast<FixedVectorType>(FromTy);
204 auto *SST = dyn_cast<StructType>(FromTy);
205 auto *DVT = dyn_cast<FixedVectorType>(ToTy);
206
207 B.SetInsertPoint(LI);
208
209 // Destination is the element type of Source, and source is an array ->
210 // Loading 1st element.
211 // - float a = array[0];
212 if (SAT && SAT->getElementType() == ToTy)
213 Output = loadFirstValueFromAggregate(B, SAT->getElementType(),
214 OriginalOperand, LI);
215 // Destination is the element type of Source, and source is a vector ->
216 // Vector to scalar.
217 // - float a = vector.x;
218 else if (!DVT && SVT && SVT->getElementType() == ToTy) {
219 Output = loadFirstValueFromAggregate(B, SVT->getElementType(),
220 OriginalOperand, LI);
221 }
222 // Destination is a smaller vector than source or different vector type.
223 // - float3 v3 = vector4;
224 // - float4 v2 = int4;
225 else if (SVT && DVT)
226 Output = loadVectorFromVector(B, SVT, DVT, OriginalOperand);
227 // Destination is the scalar type stored at the start of an aggregate.
228 // - struct S { float m };
229 // - float v = s.m;
230 else if (SST && SST->getTypeAtIndex(0u) == ToTy)
231 Output = loadFirstValueFromAggregate(B, ToTy, OriginalOperand, LI);
232 else if (SAT && DVT && SAT->getElementType() == DVT->getElementType())
233 Output = loadVectorFromArray(B, DVT, OriginalOperand);
234 else
235 llvm_unreachable("Unimplemented implicit down-cast from load.");
236
237 GR->replaceAllUsesWith(LI, Output, /* DeleteOld= */ true);
238 DeadInstructions.push_back(LI);
239 }
240
241 // Creates an spv_insertelt instruction (equivalent to llvm's insertelement).
242 Value *makeInsertElement(IRBuilder<> &B, Value *Vector, Value *Element,
243 unsigned Index) {
244 Type *Int32Ty = Type::getInt32Ty(B.getContext());
245 SmallVector<Type *, 4> Types = {Vector->getType(), Vector->getType(),
246 Element->getType(), Int32Ty};
247 SmallVector<Value *> Args = {Vector, Element, B.getInt32(Index)};
248 Instruction *NewI =
249 B.CreateIntrinsic(Intrinsic::spv_insertelt, {Types}, {Args});
250 buildAssignType(B, Vector->getType(), NewI);
251 return NewI;
252 }
253
254 // Creates an spv_extractelt instruction (equivalent to llvm's
255 // extractelement).
256 Value *makeExtractElement(IRBuilder<> &B, Type *ElementType, Value *Vector,
257 unsigned Index) {
258 Type *Int32Ty = Type::getInt32Ty(B.getContext());
260 SmallVector<Value *> Args = {Vector, B.getInt32(Index)};
261 Instruction *NewI =
262 B.CreateIntrinsic(Intrinsic::spv_extractelt, {Types}, {Args});
263 buildAssignType(B, ElementType, NewI);
264 return NewI;
265 }
266
267 // Stores the given Src vector operand into the Dst vector, adjusting the size
268 // if required.
269 Value *storeVectorFromVector(IRBuilder<> &B, Value *Src, Value *Dst,
270 Align Alignment) {
271 FixedVectorType *SrcType = cast<FixedVectorType>(Src->getType());
272 FixedVectorType *DstType =
273 cast<FixedVectorType>(GR->findDeducedElementType(Dst));
274 auto dstNumElements = DstType->getNumElements();
275 auto srcNumElements = SrcType->getNumElements();
276
277 // if the element type differs, it is a bitcast.
278 if (DstType->getElementType() != SrcType->getElementType()) {
279 // Support bitcast between vectors of different sizes only if
280 // the total bitwidth is the same.
281 [[maybe_unused]] auto dstBitWidth =
282 DstType->getElementType()->getScalarSizeInBits() * dstNumElements;
283 [[maybe_unused]] auto srcBitWidth =
284 SrcType->getElementType()->getScalarSizeInBits() * srcNumElements;
285 assert(dstBitWidth == srcBitWidth &&
286 "Unsupported bitcast between vectors of different sizes.");
287
288 Src =
289 B.CreateIntrinsic(Intrinsic::spv_bitcast, {DstType, SrcType}, {Src});
290 buildAssignType(B, DstType, Src);
291 SrcType = DstType;
292
293 StoreInst *SI = B.CreateStore(Src, Dst);
294 SI->setAlignment(Alignment);
295 return SI;
296 }
297
298 assert(DstType->getNumElements() >= SrcType->getNumElements());
299 LoadInst *LI = B.CreateLoad(DstType, Dst);
300 LI->setAlignment(Alignment);
301 Value *OldValues = LI;
302 buildAssignType(B, OldValues->getType(), OldValues);
303 Value *NewValues = Src;
304
305 for (unsigned I = 0; I < SrcType->getNumElements(); ++I) {
306 Value *Element =
307 makeExtractElement(B, SrcType->getElementType(), NewValues, I);
308 OldValues = makeInsertElement(B, OldValues, Element, I);
309 }
310
311 StoreInst *SI = B.CreateStore(OldValues, Dst);
312 SI->setAlignment(Alignment);
313 return SI;
314 }
315
316 void buildGEPIndexChain(IRBuilder<> &B, Type *Search, Type *Aggregate,
317 SmallVectorImpl<Value *> &Indices) {
318 Indices.push_back(B.getInt32(0));
319
320 if (Search == Aggregate)
321 return;
322
323 if (auto *ST = dyn_cast<StructType>(Aggregate))
324 buildGEPIndexChain(B, Search, ST->getTypeAtIndex(0u), Indices);
325 else if (auto *AT = dyn_cast<ArrayType>(Aggregate))
326 buildGEPIndexChain(B, Search, AT->getElementType(), Indices);
327 else if (auto *VT = dyn_cast<FixedVectorType>(Aggregate))
328 buildGEPIndexChain(B, Search, VT->getElementType(), Indices);
329 else
330 llvm_unreachable("Bad access chain?");
331 }
332
333 // Stores the given Src value into the first entry of the Dst aggregate.
334 Value *storeToFirstValueAggregate(IRBuilder<> &B, Value *Src, Value *Dst,
335 Type *DstPointeeType, Align Alignment) {
336 SmallVector<Type *, 2> Types = {Dst->getType(), Dst->getType()};
337 SmallVector<Value *, 3> Args{/* isInBounds= */ B.getInt1(true), Dst};
338 buildGEPIndexChain(B, Src->getType(), DstPointeeType, Args);
339 auto *GEP = B.CreateIntrinsic(Intrinsic::spv_gep, {Types}, {Args});
340 GR->buildAssignPtr(B, Src->getType(), GEP);
341 StoreInst *SI = B.CreateStore(Src, GEP);
342 SI->setAlignment(Alignment);
343 return SI;
344 }
345
346 bool isTypeFirstElementAggregate(Type *Search, Type *Aggregate) {
347 if (Search == Aggregate)
348 return true;
349 if (auto *ST = dyn_cast<StructType>(Aggregate))
350 return isTypeFirstElementAggregate(Search, ST->getTypeAtIndex(0u));
351 if (auto *VT = dyn_cast<FixedVectorType>(Aggregate))
352 return isTypeFirstElementAggregate(Search, VT->getElementType());
353 if (auto *AT = dyn_cast<ArrayType>(Aggregate))
354 return isTypeFirstElementAggregate(Search, AT->getElementType());
355 return false;
356 }
357
358 // Transforms a store instruction (or SPV intrinsic) using a ptrcast as
359 // operand into a valid logical SPIR-V store with no ptrcast.
360 void transformStore(IRBuilder<> &B, Instruction *BadStore, Value *Src,
361 Value *Dst, Align Alignment) {
362 Type *ToTy = GR->findDeducedElementType(Dst);
363 Type *FromTy = Src->getType();
364
365 auto *S_VT = dyn_cast<FixedVectorType>(FromTy);
366 auto *D_ST = dyn_cast<StructType>(ToTy);
367 auto *D_VT = dyn_cast<FixedVectorType>(ToTy);
368 auto *D_AT = dyn_cast<ArrayType>(ToTy);
369
370 B.SetInsertPoint(BadStore);
371 if (D_ST && isTypeFirstElementAggregate(FromTy, D_ST))
372 storeToFirstValueAggregate(B, Src, Dst, D_ST, Alignment);
373 else if (D_VT && S_VT)
374 storeVectorFromVector(B, Src, Dst, Alignment);
375 else if (D_VT && !S_VT && FromTy == D_VT->getElementType())
376 storeToFirstValueAggregate(B, Src, Dst, D_VT, Alignment);
377 else if (D_AT && S_VT && S_VT->getElementType() == D_AT->getElementType())
378 storeArrayFromVector(B, Src, Dst, D_AT, Alignment);
379 else
380 llvm_unreachable("Unsupported ptrcast use in store. Please fix.");
381
382 DeadInstructions.push_back(BadStore);
383 }
384
385 void legalizePointerCast(IntrinsicInst *II) {
386 Value *CastedOperand = II;
387 Value *OriginalOperand = II->getOperand(0);
388
389 IRBuilder<> B(II->getContext());
390 std::vector<Value *> Users;
391 for (Use &U : II->uses())
392 Users.push_back(U.getUser());
393
394 for (Value *User : Users) {
395 if (LoadInst *LI = dyn_cast<LoadInst>(User)) {
396 transformLoad(B, LI, CastedOperand, OriginalOperand);
397 continue;
398 }
399
400 if (StoreInst *SI = dyn_cast<StoreInst>(User)) {
401 transformStore(B, SI, SI->getValueOperand(), OriginalOperand,
402 SI->getAlign());
403 continue;
404 }
405
406 if (IntrinsicInst *Intrin = dyn_cast<IntrinsicInst>(User)) {
407 if (Intrin->getIntrinsicID() == Intrinsic::spv_assign_ptr_type) {
408 DeadInstructions.push_back(Intrin);
409 continue;
410 }
411
412 if (Intrin->getIntrinsicID() == Intrinsic::spv_gep) {
413 GR->replaceAllUsesWith(CastedOperand, OriginalOperand,
414 /* DeleteOld= */ false);
415 continue;
416 }
417
418 if (Intrin->getIntrinsicID() == Intrinsic::spv_store) {
419 Align Alignment;
420 if (ConstantInt *C = dyn_cast<ConstantInt>(Intrin->getOperand(3)))
421 Alignment = Align(C->getZExtValue());
422 transformStore(B, Intrin, Intrin->getArgOperand(0), OriginalOperand,
423 Alignment);
424 continue;
425 }
426 }
427
428 llvm_unreachable("Unsupported ptrcast user. Please fix.");
429 }
430
431 DeadInstructions.push_back(II);
432 }
433
434public:
435 SPIRVLegalizePointerCast(SPIRVTargetMachine *TM) : FunctionPass(ID), TM(TM) {}
436
437 bool runOnFunction(Function &F) override {
438 const SPIRVSubtarget &ST = TM->getSubtarget<SPIRVSubtarget>(F);
439 GR = ST.getSPIRVGlobalRegistry();
440 DeadInstructions.clear();
441
442 std::vector<IntrinsicInst *> WorkList;
443 for (auto &BB : F) {
444 for (auto &I : BB) {
445 auto *II = dyn_cast<IntrinsicInst>(&I);
446 if (II && II->getIntrinsicID() == Intrinsic::spv_ptrcast)
447 WorkList.push_back(II);
448 }
449 }
450
451 for (IntrinsicInst *II : WorkList)
452 legalizePointerCast(II);
453
454 for (Instruction *I : DeadInstructions)
455 I->eraseFromParent();
456
457 return DeadInstructions.size() != 0;
458 }
459
460private:
461 SPIRVTargetMachine *TM = nullptr;
462 SPIRVGlobalRegistry *GR = nullptr;
463 std::vector<Instruction *> DeadInstructions;
464
465public:
466 static char ID;
467};
468} // namespace
469
470char SPIRVLegalizePointerCast::ID = 0;
471INITIALIZE_PASS(SPIRVLegalizePointerCast, "spirv-legalize-bitcast",
472 "SPIRV legalize bitcast pass", false, false)
473
475 return new SPIRVLegalizePointerCast(TM);
476}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static bool runOnFunction(Function &F, bool PostInlining)
Hexagon Common GEP
iv Induction Variable Users
Definition IVUsers.cpp:48
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
uint64_t IntrinsicInst * II
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Definition PassSupport.h:56
unsigned getNumElements() const
FunctionPass class - This class is used to implement most global optimizations.
Definition Pass.h:314
void setAlignment(Align Align)
Type * getPointerOperandType() const
Align getAlign() const
Return the alignment of the access that is being performed.
static LLVM_ABI PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
void push_back(const T &Elt)
LLVM_ABI unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
Definition Type.cpp:230
Type * getType() const
All values are typed, get the type of this value.
Definition Value.h:256
Type * getElementType() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
ElementType
The element type of an SRV or UAV resource.
Definition DXILABI.h:60
friend class Instruction
Iterator for Instructions in a `BasicBlock.
Definition BasicBlock.h:73
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr Value
Definition InstrProf.h:137
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:643
FunctionAddr VTableAddr uintptr_t uintptr_t Int32Ty
Definition InstrProf.h:296
CallInst * buildIntrWithMD(Intrinsic::ID IntrID, ArrayRef< Type * > Types, Value *Arg, Value *Arg2, ArrayRef< Constant * > Imms, IRBuilder<> &B)
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
IRBuilder(LLVMContext &, FolderTy, InserterTy, MDNode *, ArrayRef< OperandBundleDef >) -> IRBuilder< FolderTy, InserterTy >
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:559
FunctionPass * createSPIRVLegalizePointerCastPass(SPIRVTargetMachine *TM)
constexpr uint64_t value() const
This is a hole in the type system and should not be abused.
Definition Alignment.h:77