[llvm] [CodeGen] Fix EVT::changeVectorElementType assertion on simple-to-extended fallback (PR #173413)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 23 13:12:36 PST 2025


================
@@ -99,20 +99,21 @@ namespace llvm {
 
     /// Return a VT for a vector type whose attributes match ourselves
     /// with the exception of the element type that is chosen by the caller.
-    EVT changeVectorElementType(EVT EltVT) const {
-      if (isSimple()) {
-        assert(EltVT.isSimple() &&
-               "Can't change simple vector VT to have extended element VT");
-        return getSimpleVT().changeVectorElementType(EltVT.getSimpleVT());
+    EVT changeVectorElementType(LLVMContext &Context, EVT EltVT) const {
+      if (isSimple() and EltVT.isSimple()) {
+        MVT M = MVT::getVectorVT(EltVT.getSimpleVT(), getVectorElementCount());
+        if (M != MVT::INVALID_SIMPLE_VALUE_TYPE) {
----------------
topperc wrote:

Dropy curly braces

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


More information about the llvm-commits mailing list