[llvm-branch-commits] [mlir] [mlir][LLVMIR] implement PromotableAliaserInterface (PR #199226)

Tobias Gysi via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri May 22 08:52:06 PDT 2026


================
@@ -536,6 +536,18 @@ DeletionKind LLVM::BitcastOp::removeBlockingUses(
   return DeletionKind::Delete;
 }
 
+void LLVM::BitcastOp::getPromotableSlotAliases(
+    OpOperand &aliasedSlotPointerOperand, const MemorySlot &parentSlot,
+    SmallVectorImpl<MemorySlot> &newMemorySlots) {
+  // Only pointer-to-pointer bitcasts alias a memory slot. With opaque
+  // pointers, the alias slot keeps the parent's element type since the
+  // pointer type itself does not carry it.
+  if (!isa<LLVM::LLVMPointerType>(getResult().getType()) ||
+      !isa<LLVM::LLVMPointerType>(getArg().getType()))
+    return;
----------------
gysit wrote:

I wonder if we should add this given that such a bitcast should fold and probably not be created in the first place (due to opaque pointers)?

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


More information about the llvm-branch-commits mailing list