[clang] [llvm] [LLVM][SROA] Teach SROA how to "bitcast" between fixed and scalable vectors. (PR #130973)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 10 10:34:44 PDT 2025


================
@@ -1990,21 +2028,56 @@ static bool canConvertValue(const DataLayout &DL, Type *OldTy, Type *NewTy) {
 static Value *convertValue(const DataLayout &DL, IRBuilderTy &IRB, Value *V,
                            Type *NewTy) {
   Type *OldTy = V->getType();
-  assert(canConvertValue(DL, OldTy, NewTy) && "Value not convertable to type");
+
+#ifndef NDEBUG
+  BasicBlock *BB = IRB.GetInsertBlock();
+  assert(BB && BB->getParent() && "VScale unknown!");
----------------
paulwalker-arm wrote:

Yes.  My reasoning was that saying "Function* not available" is obvious from the code and the only reason we need the Function* is to read VScale, so I went with this.

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


More information about the llvm-commits mailing list