[clang] [CIR] Realign CIR-to-LLVM IR lowering code with incubator (PR #129293)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 28 13:14:24 PST 2025


================
@@ -218,12 +221,31 @@ mlir::LogicalResult CIRToLLVMGlobalOpLowering::matchAndRewrite(
   SmallVector<mlir::NamedAttribute> attributes;
 
   if (init.has_value()) {
-    GlobalInitAttrRewriter initRewriter(llvmType, rewriter);
-    init = initRewriter.rewriteInitAttr(init.value());
-    // If initRewriter returned a null attribute, init will have a value but
-    // the value will be null. If that happens, initRewriter didn't handle the
-    // attribute type. It probably needs to be added to GlobalInitAttrRewriter.
-    if (!init.value()) {
+    if (mlir::isa<cir::FPAttr, cir::IntAttr>(init.value())) {
----------------
erichkeane wrote:

Ah, cool :D  I was beginning to think I was missing something, like another use of it!  I don't mind which you do (remove it and leave inline, or switch to the type).  There is a 'line' I suspect where 'leave inline' becomes too big/annoying and we want to move it, but we are far from it at the moment.

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


More information about the cfe-commits mailing list