[LLVMdev] [RFC] "noclone" function attribute

James Molloy James.Molloy at arm.com
Mon Dec 3 09:48:02 PST 2012


Thanks for the pointers. My patch now calls the attribute "noduplicate",
and updates CodeMetrics to have another field:

bool notDuplicatable;

Which semantically is "containsIndirectBr || containsNoDuplicateInst". I
didn't repurpose containsIndirectBr because I felt what I'm looking for
is sufficiently different (indirectbr inhibits inlining, whereas
noduplicate does not, if there is one call site).

I still need to ensure InlineCost is correct; patch will be incoming
tomorrow morning.

All uses use CodeMetrics, except for JumpThreading because it has an
early-exit mechanism as Nadav has explained.



On Mon, 2012-12-03 at 06:27 +0000, Nadav Rotem wrote:
> On Dec 2, 2012, at 10:11 PM, Chris Lattner <clattner at apple.com> wrote:
> > 3) Please change random parts of the compiler to use CodeMetrics,
> > instead of scattering random checks for this attribute throughout
> > the code.  Anything duplicating code and not using CodeMetrics is
> > just plain incorrect.
> One problem that we may run into when using CodeMetrics is compile
> time. In many cases we are looking for one particular trait and can
> exit as soon as we find it without having to scan the entire basic
> block or function.  For example, the jump threading pass stops
> scanning additional instructions as soon as it passes the cost
> threshold. 

More information about the llvm-dev mailing list