[clang] [Clang] Freeze padded vectors before storing. (PR #164821)

Florian Hahn via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 23 11:36:05 PDT 2025


================
@@ -2300,6 +2300,9 @@ void CodeGenFunction::EmitStoreOfScalar(llvm::Value *Value, Address Addr,
         SmallVector<int, 16> Mask(NewVecTy->getNumElements(), -1);
         std::iota(Mask.begin(), Mask.begin() + VecTy->getNumElements(), 0);
         Value = Builder.CreateShuffleVector(Value, Mask, "extractVec");
+        // The extra lanes will be poison. Freeze the whole vector to make sure
+        // the padding memory is not poisoned, which may break coercion.
+        Value = Builder.CreateFreeze(Value);
----------------
fhahn wrote:

Happy to go with either. Not having the freeze is likely to be slightly better (e.g. we may be able to prove some lanes of the non-padding lanes could be poison), I just thought initially we might want to stay consistent w.r.t. shuffle with poison. 

Updated now

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


More information about the cfe-commits mailing list