[clang] [CIR] Upstream insert op for VectorType (PR #139146)

Henrich Lauko via cfe-commits cfe-commits at lists.llvm.org
Thu May 8 23:47:18 PDT 2025


================
@@ -666,18 +678,26 @@ CIRGenFunction::emitArraySubscriptExpr(const clang::ArraySubscriptExpr *e) {
   assert((e->getIdx() == e->getLHS() || e->getIdx() == e->getRHS()) &&
          "index was neither LHS nor RHS");
 
-  auto emitIdxAfterBase = [&]() -> mlir::Value {
+  auto emitIdxAfterBase = [&](bool promote) -> mlir::Value {
     const mlir::Value idx = emitScalarExpr(e->getIdx());
 
     // Extend or truncate the index type to 32 or 64-bits.
     auto ptrTy = mlir::dyn_cast<cir::PointerType>(idx.getType());
-    if (ptrTy && mlir::isa<cir::IntType>(ptrTy.getPointee()))
+    if (promote && ptrTy && mlir::isa<cir::IntType>(ptrTy.getPointee()))
----------------
xlauko wrote:

```suggestion
    if (promote && ptrTy.isPtrTo<cir::IntType>())
```

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


More information about the cfe-commits mailing list