Skip to content

Commit 231a9c2

Browse files
committed
Make DXIL version checking consistent across the file
1 parent e532ec1 commit 231a9c2

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

llvm/lib/Target/DirectX/DXILOpLowering.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,7 @@ class OpLowerer {
318318
/// model and taking into account binding information from
319319
/// DXILResourceAnalysis.
320320
bool lowerHandleFromBinding(Function &F) {
321-
const Triple &TT = M.getTargetTriple();
322-
if (TT.getDXILVersion() < VersionTuple(1, 6))
321+
if (MMDI.DXILVersion < VersionTuple(1, 6))
323322
return lowerToCreateHandle(F);
324323
return lowerToBindAndAnnotateHandle(F);
325324
}
@@ -488,8 +487,6 @@ class OpLowerer {
488487
}
489488

490489
[[nodiscard]] bool lowerRawBufferLoad(Function &F) {
491-
const Triple &TT = M.getTargetTriple();
492-
VersionTuple DXILVersion = TT.getDXILVersion();
493490
const DataLayout &DL = F.getDataLayout();
494491
IRBuilder<> &IRB = OpBuilder.getIRB();
495492
Type *Int8Ty = IRB.getInt8Ty();
@@ -513,7 +510,7 @@ class OpLowerer {
513510
ConstantInt::get(Int32Ty, DL.getPrefTypeAlign(ScalarTy).value());
514511

515512
Expected<CallInst *> OpCall =
516-
DXILVersion >= VersionTuple(1, 2)
513+
MMDI.DXILVersion >= VersionTuple(1, 2)
517514
? OpBuilder.tryCreateOp(OpCode::RawBufferLoad,
518515
{Handle, Index0, Index1, Mask, Align},
519516
CI->getName(), NewRetTy)
@@ -588,8 +585,6 @@ class OpLowerer {
588585
}
589586

590587
[[nodiscard]] bool lowerBufferStore(Function &F, bool IsRaw) {
591-
const Triple &TT = M.getTargetTriple();
592-
VersionTuple DXILVersion = TT.getDXILVersion();
593588
const DataLayout &DL = F.getDataLayout();
594589
IRBuilder<> &IRB = OpBuilder.getIRB();
595590
Type *Int8Ty = IRB.getInt8Ty();
@@ -656,7 +651,7 @@ class OpLowerer {
656651
SmallVector<Value *, 9> Args{
657652
Handle, Index0, Index1, DataElements[0],
658653
DataElements[1], DataElements[2], DataElements[3], Mask};
659-
if (IsRaw && DXILVersion >= VersionTuple(1, 2)) {
654+
if (IsRaw && MMDI.DXILVersion >= VersionTuple(1, 2)) {
660655
Op = OpCode::RawBufferStore;
661656
// RawBufferStore requires the alignment
662657
Args.push_back(

0 commit comments

Comments
 (0)