tree-object-size: Make unknown a computation
commit9fbb6fa123be81c55e888e5d117e63d05780f0ed
authorSiddhesh Poyarekar <siddhesh@gotplt.org>
Tue, 19 Oct 2021 04:06:35 +0000 (19 09:36 +0530)
committerSiddhesh Poyarekar <siddhesh@gotplt.org>
Wed, 20 Oct 2021 02:58:20 +0000 (20 08:28 +0530)
tree21192de96a3f53dd030f8955723ab079c615fd8c
parent3c8d8c0be95e99dc0cba7f6fad2429243582119f
tree-object-size: Make unknown a computation

Compute the unknown size value as a function of the min/max bit of
object_size_type.  This transforms into a neat little branchless
sequence on x86_64:

movl %edi, %eax
sarl %eax
xorl $1, %eax
negl %eax
cltq

which should be faster than loading the value from memory.  A quick
unscientific test using

`time make check-gcc RUNTESTFLAGS="dg.exp=builtin*"`

shaves about half a second off execution time with this.  Also simplify
implementation of unknown_object_size.

gcc/ChangeLog:

* tree-object-size.c (unknown): Make into a function.  Adjust
all uses.
(unknown_object_size): Simplify implementation.

Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
gcc/tree-object-size.c