This is an archive of the discontinued LLVM Phabricator instance.

[ArgPromo][Tests] Add and improve argument propagation tests
AbandonedPublic

Authored by jdoerfert on Jul 31 2019, 12:54 PM.

Details

Summary
This patch adds new tests and improves existing ones by:
 - adding comments and "FIXME"'s,
 - regular expressions for hard coded names,
 - remove some existing UB,

Related bugs: PR42852, PR887, PR42683

Event Timeline

jdoerfert created this revision.Jul 31 2019, 12:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 31 2019, 12:54 PM
Herald added a subscriber: bollu. · View Herald Transcript
vsk added a comment.Jul 31 2019, 1:37 PM

This looks reasonable to me. I wonder whether the verifier could be extended to ensure that pointer arguments to tail-calling sites don't point within an alloca? It could be useful to enforce even in control-dependent cases ('%Data2 = select %cond, <global>, <alloca>; tail call foo(%Data2)').

In D65531#1609064, @vsk wrote:

This looks reasonable to me. I wonder whether the verifier could be extended to ensure that pointer arguments to tail-calling sites don't point within an alloca? It could be useful to enforce even in control-dependent cases ('%Data2 = select %cond, <global>, <alloca>; tail call foo(%Data2)').

The control dependent case you mentioned is not statically verifiable. @reames is building a dynamic poison checker which could include a test for this. Though, I'm unsure if we have the cycles to do this in the near future.

I will now propose a set of "rewrite" patches for the argument promotion pass to improve functionality and fix all the problems, including PR42852, PR42850, PR42683, and PR42039. At the moment, we promote only very few arguments due to lack of functionality (e.g., bitcasts), placement in the pipeline (very late), lack of attribute support (no dereferenceable is derive by default), and conservative limits (unpack structs with <= 3 members only).

jdoerfert updated this revision to Diff 212680.Jul 31 2019, 3:31 PM

Add more test

jdoerfert retitled this revision from [ArgPromo][Tests] Examples to show missing 'tail' marker removal to [ArgPromo][Tests] Add and improve argument propagation tests.Jul 31 2019, 3:32 PM
jdoerfert edited the summary of this revision. (Show Details)
jdoerfert updated this revision to Diff 212721.Jul 31 2019, 9:22 PM
jdoerfert edited the summary of this revision. (Show Details)

Add bitcast tests

Is this still needed?

Is this still needed?

Nothing changed (afaik) since I posted them.

Is this still needed?

Nothing changed (afaik) since I posted them.

So why not land them then? :)
As long as existing tests aren't rewritten but new tests
are added there isn't much point in delaying inevitable.

jdoerfert abandoned this revision.Feb 10 2020, 8:43 AM