Page MenuHomePhabricator

[Utils] Reuse argument variable names in the body
Needs RevisionPublic

Authored by jdoerfert on Nov 1 2019, 10:54 AM.

Details

Summary

If we have int foo(int a) { return a; } and we run with --function-signature
enabled, we want a single variable declaration for a which is reused
later.

Event Timeline

jdoerfert created this revision.Nov 1 2019, 10:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 1 2019, 10:54 AM
Herald added a subscriber: bollu. · View Herald Transcript

Can you show the effect by regenerating some test?

Can you show the effect by regenerating some test?

Take line 8 here https://reviews.llvm.org/D68766#change-4geuqNmmUCZL

`; ARGPROMOTION-NEXT:    ret i32 [[X_VAL]]`

It uses [[X_VAL]] which is an argument of the function.
Without this check line would look like this:

`; ARGPROMOTION-NEXT:    ret i32 [[X:.%*]]`

which has no relationship to the argument.

lebedev.ri requested changes to this revision.Fri, Dec 6, 6:05 AM

Now that i believe there's some testing infra for these utils, add/update tests for this?

This revision now requires changes to proceed.Fri, Dec 6, 6:05 AM