Issue 95946
Summary [CodeGen] Boolean _expression_ a != c && (b || (c || a)) and a != c && (b || c || a) lead to different (unoptimal) code
Labels new issue
Assignees
Reporter HendrikHuebner
    The following two functions lead to different results:

`bool fn1(bool a, bool b, bool c) {
    return a != c && (b || (c || a));
}

bool fn2(bool a, bool b, bool c) {
    return a != c && (b || c || a);
}
`
https://godbolt.org/z/v7jP7azxz

This _expression_ is equivalent to `a != c`, which seems it seems to be simplified to nicely in fn2 but not fn1. I think this is a codegen issue, since the expressions are semantically equivalent but generate different IR, since fn1 is generated with an extra block/branch. 

 
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to