[PATCH] D14775: [FunctionAttrs] Provide a mechanism for adding function attributes from the command line

Chad Rosier via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 18 07:21:49 PST 2015


mcrosier added a subscriber: mcrosier.
mcrosier added a comment.

This is awesome!


================
Comment at: lib/Transforms/IPO/FunctionAttrs.cpp:1899
@@ +1898,3 @@
+    if (auto Kind = parseAttrKind(KV.second)) {
+      if (!F->hasFnAttribute(Kind)) {
+        Changed = true;
----------------
Maybe add the below before the if (!F->hasFnAtt..)

if (Kind == Attribute::None) {
  DEBUG(dbgs() << "ForcedAttribute: " << KV.second << " unknown or not handled.\n";
  continue;
}

I believe this will also prevent Changed from being set to true with unknown/unhandled attributes.

================
Comment at: lib/Transforms/IPO/FunctionAttrs.cpp:1904
@@ +1903,3 @@
+    } else {
+      assert(0 && "Unknown forced attribute!");
+    }
----------------
The default case will return Attribute::Node, so is this even reachable?


Repository:
  rL LLVM

http://reviews.llvm.org/D14775





More information about the llvm-commits mailing list