https://github.com/Men-cotton updated 
https://github.com/llvm/llvm-project/pull/233734

>From a67972cf484c287346c357c314b2a202c142f211 Mon Sep 17 00:00:00 2001
From: Steffen Holst Larsen <[email protected]>
Date: Tue, 20 Oct 2026 00:17:38 -0500
Subject: [PATCH 1/2] [CIR] Fix GCC ambiguity after #232835

After #232835, some GCC versions fail to compile CIR due to an
ambiguity in a call to `mlir::LLVM::InsertValueOp::create`. Fix this
ambiguity by explicitly specifying the last argument.

Signed-off-by: Steffen Holst Larsen <[email protected]>
---
 clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp 
b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
index 40e6a5624366c..e5d9e33b22596 100644
--- a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
+++ b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
@@ -950,8 +950,8 @@ mlir::Value 
CIRAttrToValue::visitCirAttr(cir::ConstArrayAttr attr) {
       auto prefix = cir::ConstArrayAttr::get(
           cir::ArrayType::get(arrayTy.getElementType(), arrayAttr.size()),
           arrayAttr);
-      return mlir::LLVM::InsertValueOp::create(rewriter, loc, result,
-                                               visit(prefix), int64_t{0});
+      return mlir::LLVM::InsertValueOp::create(
+          rewriter, loc, result, visit(prefix), llvm::ArrayRef<int64_t>{0});
     }
     for (auto [idx, elt] : llvm::enumerate(arrayAttr)) {
       mlir::Value init = visit(elt);

>From fd17cd317ee6878104a3d1928e8de7a518f7fdfa Mon Sep 17 00:00:00 2001
From: mencotton <[email protected]>
Date: Tue, 20 Oct 2026 19:54:41 -0500
Subject: [PATCH 2/2] fix: [CIR] Reuse the checked array initializer

---
 clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp 
b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
index 069859371df7a..22ee55a619d28 100644
--- a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
+++ b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
@@ -958,7 +958,7 @@ mlir::Value 
CIRAttrToValue::visitCirAttr(cir::ConstArrayAttr attr) {
       if (!init)
         return {};
       return mlir::LLVM::InsertValueOp::create(
-          rewriter, loc, result, visit(prefix), llvm::ArrayRef<int64_t>{0});
+          rewriter, loc, result, init, llvm::ArrayRef<int64_t>{0});
     }
     for (auto [idx, elt] : llvm::enumerate(arrayAttr)) {
       mlir::Value init = visit(elt);

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to