[mlir][llvm] Fix replaceImmediateSubElements on LLVMPointerType
authorJeff Niu <jeff@modular.com>
Fri, 21 Oct 2022 21:08:10 +0000 (14:08 -0700)
committerJeff Niu <jeff@modular.com>
Fri, 21 Oct 2022 22:13:09 +0000 (15:13 -0700)
This method was assearting on opaque pointers because the element is
null.

Depends on D136498

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D136499

mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp

index 85e4391..f372473 100644 (file)
@@ -450,7 +450,7 @@ void LLVMPointerType::walkImmediateSubElements(
 
 Type LLVMPointerType::replaceImmediateSubElements(
     ArrayRef<Attribute> replAttrs, ArrayRef<Type> replTypes) const {
-  return get(replTypes.front(), getAddressSpace());
+  return get(getContext(), replTypes.front(), getAddressSpace());
 }
 
 //===----------------------------------------------------------------------===//