Skip to content

[FPBuiltinFnSelection] Fold fdiv-by-exact-reciprocal-constant to fmul - #22948

Open
bader wants to merge 1 commit into
intel:syclfrom
bader:fpbuiltin-fdiv-exact-reciprocal
Open

[FPBuiltinFnSelection] Fold fdiv-by-exact-reciprocal-constant to fmul#22948
bader wants to merge 1 commit into
intel:syclfrom
bader:fpbuiltin-fdiv-exact-reciprocal

Conversation

@bader

@bader bader commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

llvm.fpbuiltin.fdiv hides the division from InstCombine's
foldFDivConstantDivisor until this pass lowers it to a real fdiv late
in the pipeline, so InstCombine never gets a second look. Replicate
the exact-reciprocal case of that fold here so X / C becomes X * (1/C)
whenever C has an exact FP inverse.

JIRA: CMPLRLLVM-77622

llvm.fpbuiltin.fdiv hides the division from InstCombine's
foldFDivConstantDivisor until this pass lowers it to a real fdiv late
in the pipeline, so InstCombine never gets a second look. Replicate
the exact-reciprocal case of that fold here so X / C becomes X * (1/C)
whenever C has an exact FP inverse.
@bader
bader requested a review from a team as a code owner August 14, 2026 23:29
@bader
bader requested a review from jcranmer-intel August 14, 2026 23:30

@YuriPlyakhin YuriPlyakhin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bader

bader commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

@jcranmer-intel, friendly reminder - I'm waiting your feedback on this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants