[llvm] [DirectX] Support ConstExpr GEPs (PR #150082)
Joshua Batista via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 22 14:51:18 PDT 2025
bob80905 wrote:
> > Curious question, is it possible for the innermost GEP to be a constexpr, but the outer GEPs not to be? Is that a worthy test case?
>
> Not sure what you mean exactly, but a ConstantExpr GEP's pointer operand can only be a Global Variable or another ConstantExpr GEP. A (virtual) register is not allowed in a ConstantExpr.
Specifically, I mean for this code block:
```
while (auto *NextGEP = dyn_cast<ConstantExpr>(BasePointer)) {
if (NextGEP->getOpcode() != Instruction::GetElementPtr)
```
Is it possible for a situation to happen so that the dyn_cast fails, but the opcode is indeed a GetElementPtr.
If that's possible then the GEP chain isn't fully complete. And when you say a `ConstantExpr GEP`, that makes me think there might exist non-ConstantExpr GEPs.
https://github.com/llvm/llvm-project/pull/150082
More information about the llvm-commits
mailing list