Levo DeLellis via llvm-dev
2020-Apr-27 07:13 UTC
[llvm-dev] Does anyone know a workaround for this branching bug I hit?
I believe you all can access the test file and the diff in my bug report https://bugs.llvm.org/show_bug.cgi?id=45690 In short, I'm experimenting with optimization and wrote branchless code -O2 generates a jump instruction causing my loop to be twice as slow. I changed the jne+movl to cmove and my loop seems to take half as long. I'm a little worried that this will interfere with other optimizations I make in the same function (bug report is a small reproduce). Is there a temporary workaround I can use? I'm thinking no and that I would have to suck it up. But I seen stranger things so I thought I'd ask. I guess for now I'll experiment allowing the slow jumps and I'll hand change it once I'm done optimizing that function -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200427/0b094639/attachment.html>
Craig Topper via llvm-dev
2020-Apr-27 07:27 UTC
[llvm-dev] Does anyone know a workaround for this branching bug I hit?
You can try "-mllvm -x86-cmov-converter=false". That should keep it as a cmov, but might give you performance issues elsewhere. ~Craig On Mon, Apr 27, 2020 at 12:14 AM Levo DeLellis via llvm-dev < llvm-dev at lists.llvm.org> wrote:> I believe you all can access the test file and the diff in my bug report > https://bugs.llvm.org/show_bug.cgi?id=45690 > > In short, I'm experimenting with optimization and wrote branchless code > -O2 generates a jump instruction causing my loop to be twice as slow. I > changed the jne+movl to cmove and my loop seems to take half as long. > > I'm a little worried that this will interfere with other optimizations I > make in the same function (bug report is a small reproduce). Is there a > temporary workaround I can use? I'm thinking no and that I would have to > suck it up. But I seen stranger things so I thought I'd ask. I guess for > now I'll experiment allowing the slow jumps and I'll hand change it once > I'm done optimizing that function > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200427/ff2c3607/attachment.html>