Skip to content

llvm-reduce: Fix overly conservative operands-to-args user restriction #133854

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

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Apr 1, 2025

I assume this was a leftover from typed pointers. It's easier to replace
the non-callee uses, they are just replacable pointer values.

Copy link
Contributor Author

arsenm commented Apr 1, 2025

@arsenm arsenm added the llvm-reduce label Apr 1, 2025 — with Graphite App
@arsenm arsenm requested review from aeubanks, fhahn, regehr and shiltian April 1, 2025 04:26
@arsenm arsenm marked this pull request as ready for review April 1, 2025 04:26
@@ -96,7 +96,7 @@ declare void @ptr_user(ptr)

; INTERESTING-LABEL: define void @calls_and_passes_func(
; REDUCED-LABEL: define void @calls_and_passes_func(ptr %has_callee_and_arg_user) {
; REDUCED: call void @has_callee_and_arg_user(ptr %has_callee_and_arg_user)
; REDUCED: call void @has_callee_and_arg_user(ptr %has_callee_and_arg_user, ptr null)
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we pass null here now, should we not ideally introduce a new argument?

Copy link
Contributor Author

@arsenm arsenm Apr 1, 2025

Choose a reason for hiding this comment

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

Whenever this this does anything, the call sites are adjusted to pass the default type value to the new argument

Copy link
Contributor

@aeubanks aeubanks left a comment

Choose a reason for hiding this comment

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

with this we start replacing functions that have indirect references so we may break indirect calls, but I think that's fine

return false;
});
static bool canReplaceFunction(const Function &F) {
// TODO: Add controls to avoid ABI breaks (e.g. don't break main)
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO llvm-reduce should be reducing main

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd just remove this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It shoul, but it would be useful to have a mode to opt out and avoid breaking anything needed to execute the function (bugpoint has a more primitive version of the option than the one I would like)

@arsenm
Copy link
Contributor Author

arsenm commented Apr 2, 2025

with this we start replacing functions that have indirect references so we may break indirect calls, but I think that's fine

ReduceArguments already does that (though eventually I think we need an option to preserve executability)

Base automatically changed from users/arsenm/llvm-reduce/increase-operands-to-args-test-coverage to main April 2, 2025 10:02
I assume this was a leftover from typed pointers. It's easier to replace
the non-callee uses, they are just replacable pointer values.
@arsenm arsenm force-pushed the users/arsenm/llvm-reduce/remove-operands-to-args-function-user-restriction branch from 83ba71f to e3463ee Compare April 2, 2025 10:04
Copy link
Contributor Author

@arsenm arsenm left a comment

Choose a reason for hiding this comment

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

ping

Copy link
Contributor Author

arsenm commented Apr 10, 2025

Merge activity

  • Apr 10, 1:08 AM EDT: A user started a stack merge that includes this pull request via Graphite.
  • Apr 10, 1:10 AM EDT: A user merged this pull request with Graphite.

@arsenm arsenm merged commit 843fb7b into main Apr 10, 2025
11 checks passed
@arsenm arsenm deleted the users/arsenm/llvm-reduce/remove-operands-to-args-function-user-restriction branch April 10, 2025 05:10
AllinLeeYL pushed a commit to AllinLeeYL/llvm-project that referenced this pull request Apr 10, 2025
llvm#133854)

I assume this was a leftover from typed pointers. It's easier to replace
the non-callee uses, they are just replacable pointer values.
var-const pushed a commit to ldionne/llvm-project that referenced this pull request Apr 17, 2025
llvm#133854)

I assume this was a leftover from typed pointers. It's easier to replace
the non-callee uses, they are just replacable pointer values.
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