[PATCH] D101011: [Attr] Add "noipa" function attribute

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 22 13:14:04 PDT 2021


jdoerfert added inline comments.


================
Comment at: llvm/lib/IR/Globals.cpp:352
+    llvm_unreachable("Fully covered switch above!");
+  }
 //===----------------------------------------------------------------------===//
----------------
The only thing I'm not 100% convinced by is this part. I can see the appeal, but I can also imagine problems in the future. Not everything looking at the linkage might care about `noipa`. I'd rather introduce a helper that checks `noipa` and linkage, and maybe also the alwaysinline attribute. Basically,
```
    /// Determine whether the function \p F is IPO amendable
    ///
    /// If a function is exactly defined or it has alwaysinline attribute
    /// and is viable to be inlined, we say it is IPO amendable
    bool isFunctionIPOAmendable(const Function &F) {
    ┊ return !F->hasNoIPA() && (F.hasExactDefinition() || F.isAlwaysInlined());
    }
```
whereas the "always inlined" function does not exist yet.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101011/new/

https://reviews.llvm.org/D101011



More information about the llvm-commits mailing list