[clang] [CIR] Fix VecExtract index type in Vec truncation cast (PR #246065)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 25 08:51:44 PST 2026


================
@@ -3009,8 +3009,10 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *ce) {
       std::iota(mask.begin(), mask.end(), 0);
       return builder.createVecShuffle(loc, vec, mask);
     }
-    return builder.createExtractElement(loc, vec, /*idx=*/0);
+    mlir::Value idx = builder.getConstInt(loc, cgf.sizeTy, 0);
----------------
erichkeane wrote:

I'm a little shocked we don't hvae a type for this...   Also, why does 'createExtractElement' not just get this right/choose an integer? 

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


More information about the cfe-commits mailing list