[llvm] [InferAS] Support getAssumedAddrSpace for Arguments for NVPTX (PR #133991)

Alex MacLean via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 1 16:27:22 PDT 2025


================
@@ -966,8 +984,9 @@ bool InferAddressSpacesImpl::updateAddressSpace(
   // of all its pointer operands.
   unsigned NewAS = UninitializedAddressSpace;
 
-  const Operator &Op = cast<Operator>(V);
-  if (Op.getOpcode() == Instruction::Select) {
+  if (isa<Operator>(V) &&
+      cast<Operator>(V).getOpcode() == Instruction::Select) {
+    const Operator &Op = cast<Operator>(V);
----------------
AlexMaclean wrote:

I've added an assert to check that V is either an operator or an argument. The else branch will do a good job handling arguments. 

https://github.com/llvm/llvm-project/pull/133991


More information about the llvm-commits mailing list