[LLVMbugs] [Bug 23827] bad generated code for conditionals connected by (&)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jun 29 15:05:34 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23827

Sanjay Patel <spatel+llvm at rotateright.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #10 from Sanjay Patel <spatel+llvm at rotateright.com> ---
I've attached a test program (test harness in C, actual tests in asm) to check
performance of the current branch optimization that's happening for x86 in the
DAG. To try it out on Linux or Mac:

$ clang 23827_tester.c 23827_tests.s
$ ./a.out

As-is, the test program is modeling this C code:

extern int bar();//{ return 0; }

int foo(int x, int y) {
        if (x != 0 && y != 0) return bar();
        return 1;
}

I used clang to compile that down to asm while toggling the
setJumpIsExpensive() hook.

The 'super' cases are the asm for a bigger compound predicate because the DAG
optimization appears to happily turn any size predicate into multiple branches:

extern int bar();//{ return 0; }

int foo(int w, int x, int y, int z) {
        if (w != 0 && x != 0 && y != 0 && z != 0) return bar();
        return 1;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150629/13310fea/attachment.html>


More information about the llvm-bugs mailing list