Skip to content

[SimplifyCFG] Missed optimization: Fail to merge part of phi into one select #73380

@XChy

Description

@XChy

Alive2 proof: https://alive2.llvm.org/ce/z/gs8NJq
Missed example: https://godbolt.org/z/PsEvnzvM9

Description:

In src function, with %add in b1 and %sub in b2, we failed to merge them into a single select instruction, and further failed to merge two BasicBlock into the common destination.

Real-world motivation

This snippet of IR is derived from numpy/core/src/npymath/extr_halffloat.c (after O3 pipeline).
The example above is a reduced version. If you're interested in the original suboptimal IR and optimal IR, see also: https://godbolt.org/z/hq7ox6o3e

Let me know if you can confirm that it's an optimization opportunity, thanks.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions