Victor Yodaiken via llvm-dev
llvm-dev at lists.llvm.org
Fri Jun 18 07:58:02 PDT 2021
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.
> 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?
square (float *arr, int *bound)
const int b = *bound;
for (i = 0; i <= b ; i++)
arr[i] = arr[i] * arr[i];
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev