Skip to content

[GlobalISel] Add constant-folding of FP binops to combiner. #65230

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

Merged
merged 2 commits into from
Sep 7, 2023

Conversation

aemerson
Copy link
Contributor

@aemerson aemerson commented Sep 3, 2023

No description provided.

@aemerson
Copy link
Contributor Author

aemerson commented Sep 5, 2023

@arsenm this PR is ready for review

@aemerson aemerson requested a review from Pierre-vh September 5, 2023 06:26
@aemerson aemerson force-pushed the eng/gisel/opts-series-1 branch from ccdb60c to e18d3e0 Compare September 6, 2023 03:08
@aemerson aemerson requested a review from a team as a code owner September 6, 2023 03:08
@aemerson aemerson force-pushed the eng/gisel/opts-series-1 branch from e18d3e0 to 5bfc6a1 Compare September 6, 2023 03:34
@@ -2645,6 +2645,14 @@ void CombinerHelper::replaceInstWithConstant(MachineInstr &MI, APInt C) {
MI.eraseFromParent();
}

void CombinerHelper::replaceInstWithFConstant(MachineInstr &MI, ConstantFP *CFP) {
assert(MI.getNumDefs() == 1 && "Expected only one def?");
APFloat C = CFP->getValueAPF();
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't really need this temporary copy

void CombinerHelper::replaceInstWithFConstant(MachineInstr &MI, ConstantFP *CFP) {
assert(MI.getNumDefs() == 1 && "Expected only one def?");
APFloat C = CFP->getValueAPF();
Builder.setInstr(MI);
Copy link
Contributor

Choose a reason for hiding this comment

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

We should really just fix the combiner to always set the insert point before the apply

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed.

@aemerson aemerson force-pushed the eng/gisel/opts-series-1 branch from fad3cc7 to 34d91b6 Compare September 7, 2023 05:00
@arsenm arsenm merged commit 1cc9f62 into llvm:main Sep 7, 2023
@aemerson aemerson deleted the eng/gisel/opts-series-1 branch September 7, 2023 17:02
@aemerson
Copy link
Contributor Author

aemerson commented Sep 7, 2023

I was waiting for you to approve before merging.

@arsenm
Copy link
Contributor

arsenm commented Sep 7, 2023

I was waiting for you to approve before merging.

For some reason GitHub makes it more difficult to find the approve without merge option

avillega pushed a commit to avillega/llvm-project that referenced this pull request Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants