[flang-commits] [flang] 771af15 - [flang][CUDA] Stop using Operation::getAttrs in host stubs (NFC) (#226421)

via flang-commits flang-commits at lists.llvm.org
Fri Sep 25 03:09:41 PDT 2026


Author: Mehdi Amini
Date: 2026-09-25T10:09:32Z
New Revision: 771af157a35d7342a895a016f87b62b02a54aceb

URL: https://github.com/llvm/llvm-project/commit/771af157a35d7342a895a016f87b62b02a54aceb
DIFF: https://github.com/llvm/llvm-project/commit/771af157a35d7342a895a016f87b62b02a54aceb.diff

LOG: [flang][CUDA] Stop using Operation::getAttrs in host stubs (NFC) (#226421)

Copy function properties and discardable attributes separately when
creating a host stub.

Part of #155475

Assisted-by: Codex

Added: 
    

Modified: 
    flang/lib/Optimizer/Transforms/CUDA/CUFDeviceFuncTransform.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Optimizer/Transforms/CUDA/CUFDeviceFuncTransform.cpp b/flang/lib/Optimizer/Transforms/CUDA/CUFDeviceFuncTransform.cpp
index f5d605fbd4094..ff0f8da3c8216 100644
--- a/flang/lib/Optimizer/Transforms/CUDA/CUFDeviceFuncTransform.cpp
+++ b/flang/lib/Optimizer/Transforms/CUDA/CUFDeviceFuncTransform.cpp
@@ -170,7 +170,8 @@ class CUFDeviceFuncTransform
     auto emptyStub = func::FuncOp::create(modBuilder, loc, funcOp.getName(),
                                           funcOp.getFunctionType());
     emptyStub.setVisibility(funcOp.getVisibility());
-    emptyStub->setAttrs(funcOp->getAttrs());
+    emptyStub->copyProperties(funcOp->getPropertiesStorage());
+    emptyStub->setDiscardableAttrs(funcOp->getDiscardableAttrDictionary());
     auto entryBlock = emptyStub.addEntryBlock();
     modBuilder.setInsertionPointToEnd(entryBlock);
     // Add a return operation at the end of the stub with the location of the


        


More information about the flang-commits mailing list