[llvm] [AMDGPU][PromoteAlloca] Correctly handle a variable vector index (PR #83597)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 3 21:21:06 PST 2024
================
@@ -401,7 +401,8 @@ static Value *promoteAllocaUserToVector(
// We're loading the full vector.
Type *AccessTy = Inst->getType();
TypeSize AccessSize = DL.getTypeStoreSize(AccessTy);
- if (AccessSize == VecStoreSize && cast<Constant>(Index)->isZeroValue()) {
+ if (AccessSize == VecStoreSize && isa<Constant>(Index) &&
+ cast<Constant>(Index)->isZeroValue()) {
----------------
arsenm wrote:
dyn_cast instead of isa+cast?
https://github.com/llvm/llvm-project/pull/83597
More information about the llvm-commits
mailing list