Skip to content
Merged
14 changes: 6 additions & 8 deletions llvm/lib/Target/DirectX/DXILShaderFlags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,13 @@ static bool checkWaveOps(Intrinsic::ID IID) {
// instruction is ever extracted.
// This is our proof that the module requires TiledResources
// to be set, as if check access fully mapped was used.
bool checkIfStatusIsExtracted(const Instruction *I) {
auto *II = dyn_cast<IntrinsicInst>(I);
assert(II && "intrinsic instruction expected in checkIfStatusIsExtracted");
auto IID = II->getIntrinsicID();
bool checkIfStatusIsExtracted(const IntrinsicInst &II) {
auto IID = II.getIntrinsicID();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better not to use auto here. Also we probably need [[maybe_unused]] to avoid an unused variable warning in release builds.

assert(IID == Intrinsic::dx_resource_load_typedbuffer ||
IID == Intrinsic::dx_resource_load_rawbuffer &&
"unexpected intrinsic ID, only dx_resource_load_typedbuffer and "
"dx_resource_load_rawbuffer are expected");
for (const User *U : I->users()) {
for (const User *U : II.users()) {
if (const ExtractValueInst *EVI = dyn_cast<ExtractValueInst>(U)) {
// Resource load operations return a {result, status} pair
// check if we extract the status
Expand Down Expand Up @@ -188,7 +186,7 @@ void ModuleShaderFlags::updateFunctionFlags(ComputedShaderFlags &CSF,
}
}

if (auto *II = dyn_cast<IntrinsicInst>(&I)) {
if (const auto *II = dyn_cast<IntrinsicInst>(&I)) {
switch (II->getIntrinsicID()) {
default:
break;
Expand Down Expand Up @@ -216,12 +214,12 @@ void ModuleShaderFlags::updateFunctionFlags(ComputedShaderFlags &CSF,
DRTM[cast<TargetExtType>(II->getArgOperand(0)->getType())];
if (RTI.isTyped())
CSF.TypedUAVLoadAdditionalFormats |= RTI.getTyped().ElementCount > 1;
if (!CSF.TiledResources && checkIfStatusIsExtracted(&I))
if (!CSF.TiledResources && checkIfStatusIsExtracted(*II))
CSF.TiledResources = true;
break;
}
case Intrinsic::dx_resource_load_rawbuffer: {
if (!CSF.TiledResources && checkIfStatusIsExtracted(&I))
if (!CSF.TiledResources && checkIfStatusIsExtracted(*II))
CSF.TiledResources = true;
break;
}
Expand Down
Loading