[llvm-dev] Questions about jump threading optimization and what we can do

Karl Rehm via llvm-dev llvm-dev at lists.llvm.org
Mon Feb 3 13:09:56 PST 2020


I think SimplifyCFG could be abusing the undef value for this. If num is
defined before the loop, it no longer becomes optimized:
https://godbolt.org/z/woHRQf

On Mon, Feb 3, 2020 at 3:50 PM Karl Rehm <klrehm123 at gmail.com> wrote:

> Hm. I assumed that JumpThreading would be the primary factor in optimizing
> code like this. Guess not. I'll need to look into SimplifyCFG to see what
> prevents it from doing the same thing to the other loop:
> https://godbolt.org/z/F6NjdG
>
> On Mon, Feb 3, 2020 at 3:09 PM Michael Kruse <llvmdev at meinersbur.de>
> wrote:
>
>> I assumed the LLVM-IR behind the godbolt link represented the C code
>> you used before.
>>
>> SimplifyCFG actually helps the loop being removed:
>> https://godbolt.org/z/5v7SXh
>>
>> But this doesn't even involve JumpThreading.
>>
>> Michael
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200203/9a2f7f49/attachment.html>


More information about the llvm-dev mailing list