[llvm-commits] patch: add 'halting' function attribute

Chris Lattner clattner at apple.com
Tue Jul 6 13:47:26 PDT 2010


On Jul 5, 2010, at 9:33 PM, Nick Lewycky wrote:

> The attached patch adds a function attribute, "halting", which models the assertion that a function does not have the side-effect of looping indefinitely. This is for llvm.org/PR965

Hi Nick,

I haven't had a chance to look at the patch yet, some thoughts:

>  * modifies the asm printer and parser, LangRef and VMCore to support the new bit
>  * all intrinsics are marked with 'halting' as they are with 'nounwind'
>  * the -simplify-libcalls pass now marks certain (non-I/O) library functions as being halting

Ok.

>  * a new pass named HaltingAttr is added to mark up functions with the halting attribute. If necessary, it queries SCEV for an upper bound on the loop trip count. It is not an SCC pass.

Why can't this be done in the existing bottom-up pass for inferring this?

>  * Instruction::mayHaveSideEffects considers not halting to be a side-effect
>  * Instruction::isSafeToSpeculativelyExecute will now return true for some call instructions (only for intrinsics marked 'readnone nounwind halting'). LLVM was audited to make sure this was safe, the only change made for it is in lib/Transforms/Scalar/Sink.cpp.

Makes sense.

-Chris



More information about the llvm-commits mailing list