Displaying 3 results from an estimated 3 matches for "4jl".
Did you mean:
42l
2020 Apr 05
2
Branch is not optimized because of right shift
Hi everyone,
In a twitch chat someone redirected me to an example that is not optimized:
https://godbolt.org/z/BL-4jL
I included the original source code and this is after -O2. We both thought
that the -8 branch could be optimized out. I added a nuw in the subtraction
and it actually does it.
Any thoughts on why that doesn't happen already?
Best,
Stefanos Baziotis
-------------- next part --------------
An...
2020 Apr 05
2
Branch is not optimized because of right shift
...:
>
> http://volta.cs.utah.edu:8080/z/b7Yj7j
>
> John
>
>
>
> On 4/4/20 6:29 PM, Stefanos Baziotis via llvm-dev wrote:
> > Hi everyone,
> >
> > In a twitch chat someone redirected me to an example that is not
> > optimized: https://godbolt.org/z/BL-4jL
> >
> > I included the original source code and this is after -O2. We both
> > thought that the -8 branch could be optimized out. I added a nuw in the
> > subtraction and it actually does it.
> >
> > Any thoughts on why that doesn't happen already?
> >...
2020 Apr 05
3
Branch is not optimized because of right shift
...do about it.
> >
> > A clearer version of the .ll: https://godbolt.org/z/2t4RU5
>
> I think the IR in both of your examples makes things harder for the
> compiler than expected from the original C source.
>
> With the IR in your original example (https://godbolt.org/z/BL-4jL), I
> think the problem is that the branch condition is '%0 - 16 < 12’, which
> allows us to limit the range of `%0 - 16` easily, but in the branch only %0
> is used. Sinking the lshr too early made the analysis harder.
>
> In the second example (https://godbolt.org/z/2t4RU5),...