================
@@ -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())) {
----------------
andykaylor wrote:

The `GlobalInitAttrRewriter` would have used a `TypeSwitch` for its internal 
implementation, and since each type being handled/visited is just a single line 
I thought it was just as clean to put it inline here. I can move it back to 
using a separate class if you like.

https://github.com/llvm/llvm-project/pull/129293
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to