Skip to content

Commit 5b5d05c

Browse files
alsepkowCopilot
andcommitted
Trim verbose comments to focus on why, not what
Co-authored-by: Copilot <[email protected]>
1 parent d3479c7 commit 5b5d05c

2 files changed

Lines changed: 6 additions & 15 deletions

File tree

lib/Transforms/Scalar/GVN.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -853,10 +853,8 @@ static bool CanCoerceMustAliasedValueToLoad(Value *StoredVal,
853853
StoredVal->getType()->isArrayTy())
854854
return false;
855855

856-
// HLSL Change Begin - Don't coerce min precision vector types where
857-
// getTypeSizeInBits uses padded element sizes (e.g., <3 x half> = 96 bits)
858-
// but getPrimitiveSizeInBits returns the unpadded width (48 bits).
859-
// The coercion would create a bitcast between these mismatched sizes.
856+
// HLSL Change Begin - Reject types where padded and primitive sizes differ.
857+
// Coercion would create bitcasts between mismatched sizes.
860858
Type *StoredValTy = StoredVal->getType();
861859
uint64_t StoredPrimBits = StoredValTy->getPrimitiveSizeInBits();
862860
uint64_t LoadPrimBits = LoadTy->getPrimitiveSizeInBits();
@@ -1955,13 +1953,8 @@ bool GVN::processLoad(LoadInst *L) {
19551953
if (StoreInst *DepSI = dyn_cast<StoreInst>(DepInst)) {
19561954
Value *StoredVal = DepSI->getValueOperand();
19571955

1958-
// HLSL Change Begin - Don't forward stores of padded types when the load
1959-
// type differs (e.g., min precision vectors where i16:32/f16:32 means
1960-
// elements are padded to 32 bits). BasicAA returns MustAlias at offset 0
1961-
// regardless of access sizes, so a partial element store can appear as a
1962-
// Def to MemoryDependence. CanCoerceMustAliasedValueToLoad catches this,
1963-
// but we add a defense-in-depth check here for cross-type forwarding of
1964-
// padded types. Same-type forwarding is always safe.
1956+
// HLSL Change Begin - Defense-in-depth: skip cross-type forwarding for
1957+
// padded types (e.g., min precision vectors).
19651958
if (StoredVal->getType() != L->getType()) {
19661959
Type *StoredTy = StoredVal->getType();
19671960
uint64_t StoredPrimBits = StoredTy->getPrimitiveSizeInBits();

lib/Transforms/Scalar/SROA.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,10 +1671,8 @@ static Value *getNaturalGEPRecursively(IRBuilderTy &IRB, const DataLayout &DL,
16711671
// extremely poorly defined currently. The long-term goal is to remove GEPing
16721672
// over a vector from the IR completely.
16731673
if (VectorType *VecTy = dyn_cast<VectorType>(Ty)) {
1674-
// HLSL Change: Use alloc size instead of primitive type size for vector
1675-
// elements. DXC's data layout pads min precision types (i16:32, f16:32),
1676-
// so getTypeAllocSize matches the GEP offset stride while
1677-
// getTypeSizeInBits returns the unpadded primitive width.
1674+
// HLSL Change: Use alloc size for element stride to account for padded
1675+
// types.
16781676
unsigned ElementSizeInBits =
16791677
DL.getTypeAllocSizeInBits(VecTy->getScalarType());
16801678
if (ElementSizeInBits % 8 != 0) {

0 commit comments

Comments
 (0)