1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00
Commit Graph

9275 Commits

Author SHA1 Message Date
Dorit Nuzman
826d80e700 [InstSimplify] fix bug in matching or-with-not op (PR46083) 2020-06-03 13:44:29 -04:00
Vitaly Buka
9c9a3b8828 [NFC,StackSafety] Fix template arg name 2020-06-03 02:39:21 -07:00
Jay Foad
14dd772f1b [AMDGPU] Fold llvm.amdgcn.cos and llvm.amdgcn.sin intrinsics (fix)
Try to fix Windows buildbots.
2020-06-03 09:44:33 +01:00
Vitaly Buka
f99a2b16cb [StackSafety,NFC] Convert to template internal stuff
It's going to be usefull for ThinLTO.
2020-06-03 01:36:20 -07:00
Vitaly Buka
299555c7e7 [StackSafety,NFC] Rename internal class 2020-06-03 01:36:20 -07:00
Jay Foad
4a4ccbfa8d [AMDGPU] Fold llvm.amdgcn.cos and llvm.amdgcn.sin intrinsics
Differential Revision: https://reviews.llvm.org/D80702
2020-06-03 09:34:22 +01:00
Vitaly Buka
5b5814a4b5 [StackSafety] Skip non-pointer parameters
Summary: Depends on D80908.

Reviewers: eugenis, pcc

Reviewed By: eugenis

Subscribers: hiraditya, steven_wu, dexonsmith, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80956
2020-06-03 01:16:39 -07:00
Vitaly Buka
9a416f28c3 [NFC, StackSafety] Change type of internal container
Summary: Depends on D80771.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: mehdi_amini, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80847
2020-06-03 01:05:10 -07:00
Mehdi Amini
356c1d11d8 Revert "[NFC, StackSafety] Change type of internal container"
This reverts commit f62813e7eae148a6175de28bfa384524a9f2bf94.
GCC 5.3 build is broken.
2020-06-03 03:02:28 +00:00
Vitaly Buka
78160ddec5 [NFC, StackSafety] Change type of internal container
Summary: Depends on D80771.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80847
2020-06-02 18:27:22 -07:00
Vitaly Buka
69b767eb38 [MTE] Convert StackSafety into analysis
This lets us to remove !stack-safe metadata and
better controll when to perform StackSafety
analysis.

Reviewers: eugenis

Subscribers: hiraditya, steven_wu, dexonsmith, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D80771
2020-06-02 16:08:14 -07:00
Yevgeny Rouban
f732af67dd [BrachProbablityInfo] Proportional distribution of reachable probabilities
When fixing probability of unreachable edges in
BranchProbabilityInfo::calcMetadataWeights() proportionally distribute
remainder probability over the reachable edges. The old implementation
distributes the remainder probability evenly.
See examples in the fixed tests.

Reviewers: yamauchi, ebrevnov
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80611
2020-06-02 12:06:52 +07:00
Yevgeny Rouban
129b7e4405 [BrachProbablityInfo] Rename loop variables. NFC 2020-06-02 10:55:27 +07:00
Mircea Trofin
368ac03869 [llvm][NFC] Cache FAM in InlineAdvisor
Summary:
This simplifies the interface by storing the function analysis manager
with the InlineAdvisor, and, thus, not requiring it be passed each time
we inquire for an advice.

Reviewers: davidxl, asbirlea

Subscribers: eraman, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80405
2020-06-01 13:02:34 -07:00
Hiroshi Yamauchi
c65f25e192 [PGO] Improve the working set size heuristics under the partial sample PGO.
Summary:
The working set size heuristics (ProfileSummaryInfo::hasHugeWorkingSetSize)
under the partial sample PGO may not be accurate because the profile is partial
and the number of hot profile counters in the ProfileSummary may not reflect the
actual working set size of the program being compiled.

To improve this, the (approximated) ratio of the the number of profile counters
of the program being compiled to the number of profile counters in the partial
sample profile is computed (which is called the partial profile ratio) and the
working set size of the profile is scaled by this ratio to reflect the working
set size of the program being compiled and used for the working set size
heuristics.

The partial profile ratio is approximated based on the number of the basic
blocks in the program and the NumCounts field in the ProfileSummary and computed
through the thin LTO indexing. This means that there is the limitation that the
scaled working set size is available to the thin LTO post link passes only.

Reviewers: davidxl

Subscribers: mgorny, eraman, hiraditya, steven_wu, dexonsmith, arphaman, dang, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79831
2020-06-01 10:29:23 -07:00
Florian Hahn
1cc7eb0b48 [BasicAA] Use known lower bounds for index values for size based check.
Currently, BasicAA does not exploit information about value ranges of
indexes. For example, consider the 2 pointers %a = %base and
%b = %base + %stride below, assuming they are used to access 4 elements.

If we know that %stride >= 4, we know the accesses do not alias. If
%stride is a constant, BasicAA currently gets that. But if the >= 4
constraint is encoded using an assume, it misses the NoAlias.

This patch extends DecomposedGEP to include an additional MinOtherOffset
field, which tracks the constant offset similar to the existing
OtherOffset, which the difference that it also includes non-negative
lower bounds on the range of the index value. When checking if the
distance between 2 accesses exceeds the access size, we can use this
improved bound.

For now this is limited to using non-negative lower bounds for indices,
as this conveniently skips cases where we do not have a useful lower
bound (because it is not constrained). We potential miss out in cases
where the lower bound is constrained but negative, but that can be
exploited in the future.

Reviewers: sanjoy, hfinkel, reames, asbirlea

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D76194
2020-05-30 16:20:42 +01:00
David Green
fb0b1c4e48 [ConstantFolding] Constant folding for integer vector reduce intrinsics
This add constant folding for all the integer vector reduce intrinsics,
providing that the argument is a constant vector. zeroinitializer always
produces 0 for all intrinsics, and other values can be handled with
APInt operators.

Differential Revision: https://reviews.llvm.org/D80516
2020-05-29 17:58:42 +01:00
Sjoerd Meijer
1a234ab7bd [TTI] New target hook emitGetActiveLaneMask
This is split off from D79100 and adds a new target hook emitGetActiveLaneMask
that can be queried to check if the intrinsic @llvm.get.active.lane.mask() is
supported by the backend and if it should be emitted for a given loop.

See also commit rG7fb8a40e5220 and its commit message for more details/context
on this new intrinsic.

Differential Revision: https://reviews.llvm.org/D80597
2020-05-29 09:10:58 +01:00
Vitaly Buka
c5f99431ce [NFC,StackSafety] Add test flag 2020-05-28 15:38:12 -07:00
Vitaly Buka
d16ff8bbdf [NFC,StackSafety] clang-tidy warning fixes 2020-05-28 14:29:55 -07:00
Christopher Tetreault
21cc182b13 [SVE] Eliminate calls to default-false VectorType::get() from Analysis
Reviewers: efriedma, fpetrogalli, kmclaughlin, sunfish

Reviewed By: fpetrogalli

Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80324
2020-05-28 14:21:32 -07:00
Vitaly Buka
507fec3651 [StackSafety] Lazy calculations
We are going to convert this into pure analysis, so
processing will be delayed up to the first safety request.
2020-05-28 13:32:57 -07:00
Vitaly Buka
56ccc916eb [NFC,StackSafety] Move internal offset calculation 2020-05-28 13:32:57 -07:00
Vitaly Buka
1f0315fe17 [StackSafety] Don't run datafow on allocas
We need to process only parameters. Allocas access can be calculated
afterwards.
Also don't create fake function for aliases and just resolve them on
initialization.
2020-05-28 13:32:57 -07:00
Vitaly Buka
2d46ef17e1 [StackSafety] Remove SetMetadata parameter 2020-05-28 13:32:57 -07:00
Hiroshi Yamauchi
9896d761e8 [ThinLTO] Compute the basic block count across modules.
Summary:
Count the per-module number of basic blocks when the module summary is computed
and sum them up during Thin LTO indexing.

This is used to estimate the working set size under the partial sample PGO.

This is split off of D79831.

Reviewers: davidxl, espindola

Subscribers: emaste, inglorion, hiraditya, MaskRay, steven_wu, dexonsmith, arphaman, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80403
2020-05-28 10:33:05 -07:00
Matt Arsenault
f681d242fd InferAddressSpaces: Handle ptrmask intrinsic
This one is slightly odd since it counts as an address expression,
which previously could never fail. Allow the existing TTI hook to
return the value to use, and re-use it for handling how to handle
ptrmask.

Handles the no-op addrspacecasts for AMDGPU. We could probably do
something better based on analysis of the mask value based on the
address space, but leave that for now.
2020-05-28 10:04:02 -04:00
Vitaly Buka
a5c0d86ca2 [NFC,StackSafety] Add StackSafetyGlobalInfo class 2020-05-27 20:07:12 -07:00
Vitaly Buka
e9294ed2fc [NFC,StackSafety] Cleanup alloca size calculation 2020-05-27 17:47:02 -07:00
Mircea Trofin
e93714327a [llvm][NFC] ProfileSummaryInfo - const-ify APIs
Follow-up from https://reviews.llvm.org/D79920
2020-05-27 17:14:41 -07:00
Fangrui Song
98520ee82b [CMake] Revert cf86a234ba86acf0bb875e21d27833be36e08be4
It is unnecessary after 993bbaf6a35baed4ad3d8422a76c4311140641a8
2020-05-27 15:29:22 -07:00
Fangrui Song
b8a37222a3 [MLPolicies] Fix dependency and -DBUILD_SHARED_LIBS=on builds after D80579 2020-05-27 15:26:13 -07:00
Mircea Trofin
9b740880ee Fix shared libs build break introduced in rG98ef93eabd76 2020-05-27 15:12:16 -07:00
Mircea Trofin
bd7106c9d8 [llvm] Add function feature extraction analysis
Summary:
This patch introduces an analysis pass to extract function features,
which will be needed by the ML InlineAdvisor.

RFC: http://lists.llvm.org/pipermail/llvm-dev/2020-April/140763.html

Reviewers: davidxl, dblaikie, jdoerfert

Subscribers: mgorny, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80579
2020-05-27 13:38:50 -07:00
Vitaly Buka
f4b28bd51d [NFC,StackSafety] Rename some variables 2020-05-27 13:33:28 -07:00
Vitaly Buka
f8ee9aa0ba [StackSafety] Bailout more aggressively
Many edge cases, e.g. wrapped ranges, can be processed
precisely without bailout. However it's very unlikely that
memory access with min/max integer offsets will be
classified as safe anyway.
Early bailout may help with ThinLTO where we can
drop unsafe parameters from summaries.
2020-05-27 13:33:28 -07:00
Mircea Trofin
1e018e0462 [llvm]NFC] Simplify ProfileSummaryInfo state transitions
ProfileSummaryInfo is updated seldom, as result of very specific
triggers. This patch clearly demarcates state updates from read-only uses.
This, arguably, improves readability and maintainability.
2020-05-27 11:58:37 -07:00
Rithik Sharma
6a4980e5c7 [CodeMoverUtils] Use dominator tree level to decide the direction of
code motion

Summary: Currently isSafeToMoveBefore uses DFS numbering for determining
the relative position of instruction and insert point which is not
always correct. This PR proposes the use of Dominator Tree depth for the
same. If a node is at a higher level than the insert point then it is
safe to say that we want to move in the forward direction.
Authored By: RithikSharma
Reviewer: Whitney, nikic, bmahjour, etiotto, fhahn
Reviewed By: Whitney
Subscribers: fhahn, hiraditya, llvm-commits
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D80084
2020-05-27 18:02:06 +00:00
Paul Walker
c2c5d749a2 [VFABI] Fix parsing of uniform parameters that shouldn't expect step or positional data.
Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80575
2020-05-27 16:07:45 +00:00
Florian Hahn
682cc17686 [LAA] We only need pointer checks if there are non-zero checks (NFC).
If it turns out that we can do runtime checks, but there are no
runtime-checks to generate, set RtCheck.Need to false.

This can happen if we can prove statically that the pointers passed in
to canCheckPtrAtRT do not alias. This should not change any results, but
allows us to skip some work and assert that runtime checks are
generated, if LAA indicates that runtime checks are required.

Reviewers: anemet, Ayal

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D79969

Note: This is a recommit of 259abfc7cbc11cd98c05b1eb8e4b3fb6a9664bc0,
with some suggested renaming.
2020-05-27 12:47:36 +01:00
Florian Hahn
4da66aadc3 Revert "[LAA] We only need pointer checks if there are non-zero checks (NFC)."
This reverts commit 259abfc7cbc11cd98c05b1eb8e4b3fb6a9664bc0.

Reverting this, as I missed a case where we return without setting
RtCheck.Need.
2020-05-27 12:39:45 +01:00
Florian Hahn
ff54e7f7fe [LAA] We only need pointer checks if there are non-zero checks (NFC).
If it turns out that we can do runtime checks, but there are no
runtime-checks to generate, set RtCheck.Need to false.

This can happen if we can prove statically that the pointers passed in
to canCheckPtrAtRT do not alias. This should not change any results, but
allows us to skip some work and assert that runtime checks are
generated, if LAA indicates that runtime checks are required.

Reviewers: anemet, Ayal

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D79969
2020-05-27 12:37:20 +01:00
Vitaly Buka
5d22929616 [StackSafety] Bailout on some function calls
Don't miss values used in calls outside regular argument list.
2020-05-27 02:48:42 -07:00
Vitaly Buka
9d3b95dd3a [StackSafety] Ignore some use of values
We should ignore value used in MemTransferInst
as other then src/dst argument.
2020-05-27 02:48:41 -07:00
Vitaly Buka
15ceac0c76 [StackSafety] Use SCEV to find mem operation length 2020-05-26 23:22:37 -07:00
Vitaly Buka
ed06a17209 [StackSafety] Use getSignedRange for offsets 2020-05-26 23:22:36 -07:00
Vitaly Buka
23018c295b [StackSafety] Simplify SCEVRewriteVisitor
Probably NFC.
2020-05-26 18:09:43 -07:00
Vitaly Buka
c6f45da340 [NFC, StackSafety] Add some missing includes 2020-05-26 18:09:43 -07:00
Vitaly Buka
f4d67a5d63 [NFC, StackSafety] Remove duplicate code 2020-05-26 18:09:43 -07:00
Vitaly Buka
59cf2c6064 [NFC, StackSafety] Better names for internal stuff
Remove const from some parameters as upcoming changes in ScalarEvolution
calls will need non const pointers.
2020-05-26 18:09:43 -07:00