[PATCH] D11685: cache OptSize and MinSize attributes in the DAG

Michael Kuperstein michael.m.kuperstein at intel.com
Sat Aug 1 22:44:41 PDT 2015


mkuper added a comment.

Thanks, Sanjay.
LGTM, except that I'd prefer it to go in as two separate commits.


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:942
@@ +941,3 @@
+  Context = &F->getContext();
+  OptForSize = F->hasFnAttribute(Attribute::OptimizeForSize) ||
+               F->hasFnAttribute(Attribute::MinSize);
----------------
Perhaps:

```
  MinSize = F->hasFnAttribute(Attribute::MinSize);
  OptForSize = MinSize || F->hasFnAttribute(Attribute::OptimizeForSize);
```
?

================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:943
@@ +942,3 @@
+  OptForSize = F->hasFnAttribute(Attribute::OptimizeForSize) ||
+               F->hasFnAttribute(Attribute::MinSize);
+  MinSize = F->hasFnAttribute(Attribute::MinSize);
----------------
Actually, can we split this into two commits - one NFC for the caching, and one that actually changes the behavior?

Also, I don't think this || really belongs in the DAG - it ought to be just querying the Function or the MachineFunction, and MinSize should imply OptForSize on that level. Is that what you're aiming at?


http://reviews.llvm.org/D11685







More information about the llvm-commits mailing list