[llvm] [MemCpyOptimizer] Fix scalable vector crash calling performStackMoveO… (PR #67632)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 27 23:50:22 PDT 2023


================
@@ -1428,8 +1428,12 @@ bool MemCpyOptPass::performMemCpyToMemSetOptzn(MemCpyInst *MemCpy,
 // allocas that aren't captured.
 bool MemCpyOptPass::performStackMoveOptzn(Instruction *Load, Instruction *Store,
                                           AllocaInst *DestAlloca,
-                                          AllocaInst *SrcAlloca, uint64_t Size,
+                                          AllocaInst *SrcAlloca, TypeSize Size,
                                           BatchAAResults &BAA) {
+  // We can't optimize scalable types.
+  if (Size.isScalable())
+    return false;
----------------
nikic wrote:

You can instead replace the `Size != SrcSize->getFixedValue()` with `Size != SrcSize` below? (and same with DestSize).

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


More information about the llvm-commits mailing list