Fixing MinSize attribute handling to be more consistent was discussed in D11363.
This patch adds bools to the SelectionDAG to cache a function's MinSize and OptSize attributes. The main benefit is that we always make optimizing for size the logical 'or' of these attributes, so we don't have to repeat that logic everywhere.
Quentin made a similar change to the DAGCombiner in r192476:
http://reviews.llvm.org/rL192476
...but here I'm pulling it one level higher, so it can be used in all DAG-related code.
The test changes confirm that a MinSize attribute alone can now trigger size optimizations (OptSize does not also have to be present).
If this looks ok, we can make a similar patch for machine-level passes.
Perhaps:
?