Skip to content

Commit c0dbfbb

Browse files
committed
Rename bools set by module flags to be consistent
1 parent fe5d588 commit c0dbfbb

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

llvm/lib/Target/DirectX/DXILShaderFlags.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ void ModuleShaderFlags::updateFunctionFlags(ComputedShaderFlags &CSF,
143143
}
144144

145145
if (CSF.LowPrecisionPresent) {
146-
if (NativeLowPrecisionMode)
146+
if (CanSetNativeLowPrecisionMode)
147147
CSF.NativeLowPrecision = true;
148148
else
149149
CSF.MinimumPrecision = true;
@@ -214,20 +214,19 @@ void ModuleShaderFlags::initialize(Module &M, DXILResourceTypeMap &DRTM,
214214

215215
CanSetResMayNotAlias = MMDI.DXILVersion >= VersionTuple(1, 7);
216216
// The command line option -res-may-alias will set the dx.resmayalias module
217-
// flag to 1 and disable the ability to set the ResMayNotAlias flag
218-
if (auto *RMA = mdconst::extract_or_null<ConstantInt>(
217+
// flag to 1, thereby disabling the ability to set the ResMayNotAlias flag
218+
if (auto *ResMayAlias = mdconst::extract_or_null<ConstantInt>(
219219
M.getModuleFlag("dx.resmayalias")))
220-
if (RMA->getValue() != 0)
221-
CanSetResMayNotAlias = false;
220+
CanSetResMayNotAlias = !ResMayAlias->getValue().getBoolValue();
222221

223222
// NativeLowPrecisionMode can only be set when the command line option
224223
// -enable-16bit-types is provided. This is indicated by the dx.nativelowprec
225224
// module flag being set
226-
NativeLowPrecisionMode = false;
225+
CanSetNativeLowPrecisionMode = false;
227226
if (auto *NativeLowPrec = mdconst::extract_or_null<ConstantInt>(
228227
M.getModuleFlag("dx.nativelowprec")))
229228
if (MMDI.ShaderModelVersion >= VersionTuple(6, 2))
230-
NativeLowPrecisionMode = NativeLowPrec->getValue().getBoolValue();
229+
CanSetNativeLowPrecisionMode = NativeLowPrec->getValue().getBoolValue();
231230

232231
CallGraph CG(M);
233232

@@ -298,7 +297,7 @@ void ModuleShaderFlags::initialize(Module &M, DXILResourceTypeMap &DRTM,
298297
// is needed even if the module does not use 16-bit types because a
299298
// corresponding debug module may include 16-bit types, and tools that use the
300299
// debug module may expect it to have the same flags as the original
301-
CombinedSFMask.NativeLowPrecisionMode = NativeLowPrecisionMode;
300+
CombinedSFMask.NativeLowPrecisionMode = CanSetNativeLowPrecisionMode;
302301

303302
// Set the Max64UAVs flag if the number of UAVs is > 8
304303
uint32_t NumUAVs = 0;

llvm/lib/Target/DirectX/DXILShaderFlags.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ struct ModuleShaderFlags {
9292

9393
private:
9494
// Booleans set by module flags
95-
bool CanSetResMayNotAlias; // dx.resmayalias
96-
bool NativeLowPrecisionMode; // dx.nativelowprec
95+
bool CanSetResMayNotAlias; // dx.resmayalias
96+
bool CanSetNativeLowPrecisionMode; // dx.nativelowprec
9797

9898
/// Map of Function-Shader Flag Mask pairs representing properties of each of
9999
/// the functions in the module. Shader Flags of each function represent both

0 commit comments

Comments
 (0)