[llvm] [NFC][TableGen] Refactor `getIntrinsicFnAttributeSet` (PR #106587)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 29 12:14:41 PDT 2024
================
@@ -481,9 +482,33 @@ static AttributeSet getIntrinsicArgAttributeSet(LLVMContext &C, unsigned ID) {
static AttributeSet getIntrinsicFnAttributeSet(LLVMContext &C, unsigned ID) {
switch (ID) {
default: llvm_unreachable("Invalid attribute set number");)";
- for (const CodeGenIntrinsic &Intrinsic : Ints) {
+
+ auto getEffectiveME = [](const CodeGenIntrinsic &Int) {
+ MemoryEffects ME = Int.ME;
+ // TODO: IntrHasSideEffects should affect not only readnone intrinsics.
+ if (ME.doesNotAccessMemory() && Int.hasSideEffects)
+ ME = MemoryEffects::unknown();
+ return ME;
+ };
+
+ // Returns true is `Int` has a non-empty set of function attributes.
+ // Note that NoUnwind = !canThrow, so we need to negate its sense for testing
+ // if the intrinsic has NoUnwind attribute.
+ auto hasFnAttributes = [&getEffectiveME](const CodeGenIntrinsic &Int) {
----------------
arsenm wrote:
These don't need to be lambdas, they can just be deeper functions
https://github.com/llvm/llvm-project/pull/106587
More information about the llvm-commits
mailing list