-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CodeGen] inefficient code for multiple select instructions with same condition #122551
Comments
seems like CodeGen Prepare pass is actually duplicating an icmp: Edit: the more I look into the Codegen Prepare pass, the more it seems like this duplicated icmp is a bug, but I have no clue what is causing the Codegen Prepare pass to do this. It seems to still duplicate the icmp even when branch optimizations in the Codegen Prepare pass are turned off, so IG at least I know it's not that part... |
The function CodeGenPrepare::sinkCmpExpression does optimization work on the function foo. Let's consider several different versions of foo:
|
The example test case is at https://godbolt.org/z/fEEonKhn9.
Function foo is what I got from source code, there are two selects in two basic blocks, they use the same condition, it generates two pairs of "test + jns" instructions. An optimal result should be same as function expected, there is only one pair of "test + jns".
The text was updated successfully, but these errors were encountered: