[llvm] [DirectX] Do not flatten GEP chains for unsupported types (PR #150484)
Deric C. via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 24 12:39:37 PDT 2025
================
@@ -263,8 +263,13 @@ bool DXILFlattenArraysVisitor::visitGetElementPtrInst(GetElementPtrInst &GEP) {
// merge the byte offsets. Otherwise, this GEP is itself the root of a GEP
// chain and we need to deterine the root array type
if (auto *PtrOpGEP = dyn_cast<GEPOperator>(PtrOperand)) {
- assert(GEPChainInfoMap.contains(PtrOpGEP) &&
- "Expected parent GEP to be visited before this GEP");
+
+ // If the parent GEP was not processed, then we do not want to process its
----------------
Icohedron wrote:
I could throw an error when there is an unsupported type, but would the DXILFlattenArrays pass really be the place to throw such errors?
Line 296 and below already has
```c++
// If the root type is not an array, we don't need to do any flattening
if (!isa<ArrayType>(RootTy))
return false;
```
to indicate that only arrays are applicable to this transformation.
The name of the pass "DXIL Flatten Arrays" to me also implies it only applies to arrays.
https://github.com/llvm/llvm-project/pull/150484
More information about the llvm-commits
mailing list