1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 12:43:36 +01:00
Commit Graph

18 Commits

Author SHA1 Message Date
Nicolai Hähnle
5d6415281f [IR] Memory intrinsics are not unconditionally nosync
Remove the `nosync` attribute from the memory intrinsic definitions
(i.e. memset, memcpy, memmove).

Like native memory accesses, memory intrinsics can be volatile. This is
indicated by an immarg in the intrinsic call. All else equal, a volatile
memory intrinsic is `sync`, so we cannot annotate the intrinsic functions
themselves as `nosync`. The attributor and function-attr passes know to
take the volatile bit into account.

Since `nosync` is a default attribute, this means we have to stop using
the DefaultAttrIntrinsic tablegen class for memory intrinsics, and
specify all default attributes other than `nosync` explicitly.

Most of the test changes are trivial churn, but one test case
(in nosync.ll) was in fact incorrect before this change.

Differential Revision: https://reviews.llvm.org/D102295
2021-05-21 03:40:59 +02:00
Johannes Doerfert
24773fbc70 [Attributor] Derive willreturn based on mustprogress
Since D86233 we have `mustprogress` which, in combination with
`readonly`, implies `willreturn`. The idea is that every side-effect
has to be modeled as a "write". Consequently, `readonly` means there
is no side-effect, and `mustprogress` guarantees that we cannot "loop"
forever without side-effect.

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D94125
2021-03-11 23:31:44 -06:00
Johannes Doerfert
0f695356f4 [Attributor][NFC] Update tests after D94741
The update_test_checks script can now check for global symbols and is able
to handle them properly when they differ across prefixes, e.g.,
attribute #0 might be different in different runs.

This patch simply updates all the Attributor tests with the new script.

Reviewed By: sstefan1

Differential Revision: https://reviews.llvm.org/D97906
2021-03-11 23:31:39 -06:00
aqjune
4a7f071301 [ValueTracking] Dereferenced pointers are noundef
This is a follow-up of D95238's LangRef update.
This patch updates `programUndefinedIfUndefOrPoison(V)` to return true if
`V` is used by any memory-accessing instruction.
Interestingly, this affected many tests in Attributors, mainly about adding noundefs.
The tests are updated using llvm/utils/update_test_checks.py. I checked that the diffs
are about updating noundefs.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D96642
2021-02-14 22:50:48 +09:00
sstefan1
34a5b0392e [IR] Make nosync, nofree and willreturn default for intrinsics.
D70365 allows us to make attributes default. This is a follow up to
actually make nosync, nofree and willreturn default. The approach we
chose, for now, is to opt-in to default attributes to avoid introducing
problems to target specific intrinsics. Intrinsics with default
attributes can be created using `DefaultAttrsIntrinsic` class.
2020-10-20 11:57:19 +02:00
Shinji Okumura
8185014ab8 [Attributor] Fix AANoUndef identification
Even though `noundef` IR attribute might be attached to non-void type values, AANoUndef is mistakenly identified for pointer type values only.
This patch fixes that.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D86737
2020-08-30 05:39:25 +09:00
sstefan1
861127265e [Attributor][NFC] rerun update_test_checks without --scrub-attributes 2020-08-29 19:34:10 +02:00
Shinji Okumura
8816b1755f [Attributor] Deduce noundef attribute
This patch introduces a new abstract attribute `AANoUndef` which corresponds to `noundef` IR attribute and deduce them.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D85184
2020-08-18 18:05:54 +09:00
Arthur Eubanks
00d3b0ba7d [NewPM][Attributor] Pin tests with -attributor to legacy PM
All these tests already explicitly test against both legacy PM and NPM.

$ sed -i 's/ -attributor / -attributor -enable-new-pm=0 /g' $(rg --path-separator // -l -- -passes=)
$ sed -i 's/ -attributor-cgscc / -attributor-cgscc -enable-new-pm=0 /g' $(rg --path-separator // -l -- -passes=)

Now all tests in Transforms/Attributor/ pass under NPM.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D84813
2020-07-29 09:02:30 -07:00
sstefan1
1d4c473484 [Attributor][NFC] applying update_test_checks with --check-attributes
Summary:
All tests are updated, except wrapper.ll since it is not working nicely
with newly created functions.

Reviewers: jdoerfert, uenoku, baziotis, homerdin

Subscribers: arphaman, jfb, kuter, bbn, okura, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D84130
2020-07-20 08:17:34 +02:00
Johannes Doerfert
2ebd299e0e [Attributor][NFC] Remove obsolete option from tests
Since D76871 it is sufficient to run `opt -atributor` or
`-attributor-cgscc`.
2020-04-21 15:22:10 -05:00
Johannes Doerfert
00f7cba872 [Attributor] Unify testing (=updates,prefixes,run configurations,...)
When the Attributor was created the test update scripts were not well
suited to deal with the challenges of IR attribute checking. This
partially improved.

Since then we also added three additional configurations that need
testing; in total we now have the following four:
{ TUNIT, CGSCC } x { old pass manager (OPM), new pass manager (NPM) }

Finally, the number of developers and tests grew rapidly (partially due
to the addition of ArgumentPromotion and IPConstantProp tests), which
resulted in tests only being run in some configurations, different
prefixes being used, and different "styles" of checks being used.

Due to the above reasons I believed we needed to take another look at
the test update scripts. While we started to use them, via UTC_ARGS:
--enable/disable, the other problems remained. To improve the testing
situation for *all* configurations, to simplify future updates to the
test, and to help identify subtle effects of future changes, we now use
the test update scripts for (almost) all Attributor tests.

An exhaustive prefix list minimizes the number of check lines and makes
it easy to identify and compare configurations.

Tests have been adjusted in the process but we tried to keep their
intend unchanged.

Reviewed By: sstefan1

Differential Revision: https://reviews.llvm.org/D76588
2020-04-15 19:59:51 -05:00
Florian Hahn
c966f6d515 Temporarily revert "[Attributor] Unify testing (=updates,...)"
This patch reverts the 2 patches below, as on most systems the disabled
tests actually pass and that causes most bots to be red, including
  http://green.lab.llvm.org/green/job/clang-stage1-RA/8541/
  http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-expensive/15646/
  http://lab.llvm.org:8011/builders/clang-ppc64le-linux-lnt/builds/23690
  http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/16751

* [Attributor] Disable three tests until the SCC update bug was fixed
  commit 2ae1a76c27295370d552f57352508b7af4dba791.

* [Attributor] Unify testing (=updates,prefixes,run configurations,...)
  2bcf5793e14577ed3c9f15a77a35179ae544fff4.
2020-04-09 11:11:50 +01:00
Johannes Doerfert
12b4002a61 [Attributor] Unify testing (=updates,prefixes,run configurations,...)
When the Attributor was created the test update scripts were not well
suited to deal with the challenges of IR attribute checking. This
partially improved.

Since then we also added three additional configurations that need
testing; in total we now have the following four:
{ TUNIT, CGSCC } x { old pass manager (OPM), new pass manager (NPM) }

Finally, the number of developers and tests grew rapidly (partially due
to the addition of ArgumentPromotion and IPConstantProp tests), which
resulted in tests only being run in some configurations, different
prefixes being used, and different "styles" of checks being used.

Due to the above reasons I believed we needed to take another look at
the test update scripts. While we started to use them, via UTC_ARGS:
--enable/disable, the other problems remained. To improve the testing
situation for *all* configurations, to simplify future updates to the
test, and to help identify subtle effects of future changes, we now use
the test update scripts for (almost) all Attributor tests.

An exhaustive prefix list minimizes the number of check lines and makes
it easy to identify and compare configurations.

Tests have been adjusted in the process but we tried to keep their
intend unchanged.

Reviewed By: sstefan1

Differential Revision: https://reviews.llvm.org/D76588
2020-04-08 22:52:46 -05:00
Johannes Doerfert
07870c8135 [Attributor] Derive memory location attributes (argmemonly, ...)
In addition to memory behavior attributes (readonly/writeonly) we now
derive memory location attributes (argmemonly/inaccessiblememonly/...).
The former is part of AAMemoryBehavior and the latter part of
AAMemoryLocation. While they are similar in nature it got messy when
they were put in a single AA. Location attributes for arguments and
floating values will follow later.

Note that both memory attributes kinds can derive readnone. If there are
no accesses AAMemoryBehavior will derive readnone. If there are accesses
but only to stack (=local) locations AAMemoryLocation will derive
readnone.

Reviewed By: uenoku

Differential Revision: https://reviews.llvm.org/D73426
2020-02-14 19:05:51 -06:00
Johannes Doerfert
2f7f5ebd66 [Attributor] Use fine-grained liveness in all helpers
We used coarse-grained liveness before, thus we looked if the
instruction was executed, but we did not use fine-grained liveness,
hence if the instruction was needed or could be deleted even if the
surrounding ones are live. This patches introduces this level of
liveness checks together with other liveness queries, e.g., for uses.

For more control we enforce that all liveness queries go through the
Attributor.

Test have been adjusted to reflect the changes or augmented to prevent
deletion of the parts we want to check.

Reviewed By: sstefan1

Differential Revision: https://reviews.llvm.org/D73313
2020-02-12 17:36:38 -06:00
Johannes Doerfert
7349dc5e86 [Attributor][FIX] Do not derive nonnull and dereferenceable w/o access
An inbounds GEP results in poison if the value is not "inbounds", not in
UB. We accidentally derived nonnull and dereferenceable from these
inbounds GEPs even in the absence of accesses that would make the poison
to UB.
2020-01-03 10:43:40 -06:00
Hideto Ueno
e4b20675f9 [Attributor] Copy or port test cases related to Attributor to Attributor test folder
Summary:
This patch moves the test cases related to Attributor to `Transforms/Attributor` folder.
We have used `Transforms/FunctionAttrs` as the primary folder for Attributor test but we need to change testing way now.

For the test cases which I think functionattrs doesn't infer anything something like (willreturn, nosync, value-simplify, h2s ..etc), I moved them with the command `git mv`.

For the test cases in which functoinattrs and attributor are tested, I copied the test to the folder and remove the check only used by functoinattrs.

Reviewers: jdoerfert, sstefan1

Reviewed By: jdoerfert

Subscribers: jfb, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D70843
2019-12-02 15:36:29 +00:00