[llvm] r182638 - Add a new function attribute 'cold' to functions.

Tobias Grosser tobias at grosser.es
Tue Jul 9 17:59:57 PDT 2013


On 05/24/2013 05:26 AM, Diego Novillo wrote:
> Author: dnovillo
> Date: Fri May 24 07:26:52 2013
> New Revision: 182638
>
> URL: http://llvm.org/viewvc/llvm-project?rev=182638&view=rev
> Log:
> Add a new function attribute 'cold' to functions.
>
> Other than recognizing the attribute, the patch does little else.
> It changes the branch probability analyzer so that edges into
> blocks postdominated by a cold function are given low weight.
>
> Added analysis and code generation tests.  Added documentation for the
> new attribute.

It seems this commit broke bitcode compatibility with LLVM 3.3, but 
surprisingly not with LLVM 3.2. This suggests that 3.2 did not yet
depend on the order of the attribute enum whereas 3.3 somehow seems
to depend on it. This may be related to Bill's attribute refactoring.

Here the tests I run:

$ ~/clang+llvm-3.2-x86_64-linux-ubuntu-12.04/bin/llvm-as \
   test_good.ll -o test_good_3.2.bc

$ ~/clang+llvm-3.3-amd64-Ubuntu-12.04.2/bin/llvm-as \
   test_good.ll -o test_good_3.3.bc

$ ./bin/opt -S test_good_3.2.bc
; ModuleID = 'test_good_3.2.bc'

; Function Attrs: nounwind
define void @foo() #0 {
   ret void
}

attributes #0 = { nounwind }

$ ./bin/opt -S test_good_3.3.bc
; ModuleID = 'test_good_3.3.bc'

; Function Attrs: noreturn
define void @foo() #0 {
   ret void
}

attributes #0 = { noreturn }

Cheers,
Tobias
-------------- next part --------------
define void @foo() nounwind {
  ret void
}


More information about the llvm-commits mailing list