@@ -59,6 +59,7 @@ class WriteDXILPass : public llvm::ModulePass {
59
59
60
60
static void legalizeLifetimeIntrinsics (Module &M) {
61
61
LLVMContext &Ctx = M.getContext ();
62
+ Type *I64Ty = IntegerType::get (Ctx, 64 );
62
63
Intrinsic::ID LifetimeIIDs[2 ] = {Intrinsic::lifetime_start,
63
64
Intrinsic::lifetime_end};
64
65
for (Intrinsic::ID &IID : LifetimeIIDs) {
@@ -73,8 +74,8 @@ static void legalizeLifetimeIntrinsics(Module &M) {
73
74
AttributeList Attr;
74
75
Attr = Attr.addFnAttribute (Ctx, Attribute::NoUnwind);
75
76
FunctionCallee LifetimeCallee = M.getOrInsertFunction (
76
- Intrinsic::getBaseName (IID), Attr, Type::getVoidTy (Ctx),
77
- IntegerType::get (Ctx, 64 ), PointerType::get (Ctx, 0 ));
77
+ Intrinsic::getBaseName (IID), Attr, Type::getVoidTy (Ctx), I64Ty,
78
+ PointerType::get (Ctx, 0 ));
78
79
79
80
// Replace all calls to lifetime intrinsics with calls to the
80
81
// LLVM 3.7-compliant version of the lifetime intrinsic
@@ -101,12 +102,11 @@ static void legalizeLifetimeIntrinsics(Module &M) {
101
102
AI->getAllocationSize (CI->getDataLayout ());
102
103
assert (AllocSize.has_value () &&
103
104
" Expected the allocation size of AllocaInst to be known" );
104
- CallInst *NewCI =
105
- CallInst::Create (LifetimeCallee,
106
- {ConstantInt::get (IntegerType::get (Ctx, 64 ),
107
- AllocSize.value ().getFixedValue ()),
108
- NoOpBitCast},
109
- " " , CI->getIterator ());
105
+ CallInst *NewCI = CallInst::Create (
106
+ LifetimeCallee,
107
+ {ConstantInt::get (I64Ty, AllocSize.value ().getFixedValue ()),
108
+ NoOpBitCast},
109
+ " " , CI->getIterator ());
110
110
for (Attribute ParamAttr : CI->getParamAttributes (0 ))
111
111
NewCI->addParamAttr (1 , ParamAttr);
112
112
0 commit comments