On Fri, Jun 18, 2021 at 9:40 AM Richard Kenner <kenner at adacore.com>
wrote:
> > Are there any studies or examples of TBAA optimization for C showing
> > substantive performance wins? I have not been able to find any
> > papers or even compelling examples.
>
> Consider:
>
> void
> square (float *arr, int *bound)
> {
> int i;
>
> for (i = 0; i <= *bound; i++)
> arr[i] = arr[i] * arr[i];
> }
>
> without TBAA you can't hoist the reference to *bound out of the loop.
That
> will prevent almost all loop optimizations.
>
The programmer can get this with a simple change, no?
void
square (float *arr, int *bound)
{
int i;
const int b = *bound;
for (i = 0; i <= b ; i++)
arr[i] = arr[i] * arr[i];
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20210618/34d9465b/attachment-0001.html>