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

177758 Commits

Author SHA1 Message Date
Eric Christopher
d4ad193fba Remove the run-slp-after-loop-vectorization option.
It's been on by default for 4 years and cleans up the pass
hierarchy.

llvm-svn: 358548
2019-04-17 02:26:27 +00:00
Eric Christopher
71d1cca7ef Temporarily Revert "Add basic loop fusion pass."
As it's causing some bot failures (and per request from kbarton).

This reverts commit r358543/ab70da07286e618016e78247e4a24fcb84077fda.

llvm-svn: 358546
2019-04-17 02:12:23 +00:00
Kit Barton
0a28605e0a Add basic loop fusion pass.
This patch adds a basic loop fusion pass. It will fuse loops that conform to the
following 4 conditions:
  1. Adjacent (no code between them)
  2. Control flow equivalent (if one loop executes, the other loop executes)
  3. Identical bounds (both loops iterate the same number of iterations)
  4. No negative distance dependencies between the loop bodies.

The pass does not make any changes to the IR to create opportunities for fusion.
Instead, it checks if the necessary conditions are met and if so it fuses two
loops together.

The pass has not been added to the pass pipeline yet, and thus is not enabled by
default. It can be run stand alone using the -loop-fusion option.

Phabricator: https://reviews.llvm.org/D55851
llvm-svn: 358543
2019-04-17 01:37:00 +00:00
Sam McCall
c06d4974d8 [ADT] llvm::bsearch, binary search for mere mortals
Summary:
Add to STLExtras a binary search function with a simple mental model:
You provide a range and a predicate which is true above a certain point.
bsearch() tells you that point.
Overloads are provided for integers, iterators, and containers.

This is more suitable than std:: alternatives in many cases:
 - std::binary_search only indicates presence/absence
 - upper_bound/lower_bound give you the opportunity to pick the wrong one
 - all of the options have confusing names and definitions when your predicate
   doesn't have simple "less than" semantics
 - all of the options require iterators
 - we plumb around a useless `value` parameter that should be a lambda capture

The API is inspired by Go's standard library, but we add an extra parameter as
well as some overloads and templates to show how clever C++ is.

Reviewers: ilya-biryukov, gribozavr

Subscribers: dexonsmith, kristina, llvm-commits

Tags: #llvm

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

llvm-svn: 358540
2019-04-16 23:53:28 +00:00
Sanjay Patel
79f3c08f10 [x86] adjust LEA tests for better coverage; NFC
The scale can 1, 2, or 3.

llvm-svn: 358539
2019-04-16 23:10:41 +00:00
Robert Widmann
9410ec3ab6 [LLVM-C] Add Accessors For Global Variable Metadata Properties
Summary: Metadata for a global variable is really a  (GlobalVariable, Expression) tuple.  Allow access to these, then allow retrieving the file, scope, and line for a DIVariable, whether global or local.  This should be the last of the accessors required for uniform access to location and file information metadata.

Reviewers: jberdine, whitequark, deadalnix

Reviewed By: jberdine, whitequark

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 358532
2019-04-16 21:39:48 +00:00
Ali Tamur
4c6f620d80 Fix a typo in comments. [NFC]
llvm-svn: 358531
2019-04-16 21:37:43 +00:00
Nick Desaulniers
25afb52e80 [NVPTXAsmPrinter] clean up dead code. NFC
Summary:
The printOperand function takes a default parameter, for which there are
zero call sites that explicitly pass such a parameter.  As such, there
is no case to support. This means that the method
printVecModifiedImmediate is purly dead code, and can be removed.

The eventual goal for some of these AsmPrinter refactoring is to have
printOperand be a virtual method; making it easier to print operands
from the base class for more generic Asm printing. It will help if all
printOperand methods have the same function signature (ie. no Modifier
argument when not needed).

Reviewers: echristo, tra

Reviewed By: echristo

Subscribers: jholewinski, hiraditya, llvm-commits, craig.topper, srhines

Tags: #llvm

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

llvm-svn: 358527
2019-04-16 21:04:34 +00:00
Simon Pilgrim
1af5220084 [TargetLowering] Rename preferShiftsToClearExtremeBits and shouldFoldShiftPairToMask (PR41359)
As discussed on PR41359, this patch renames the pair of shift-mask target feature functions to make their purposes more obvious.

shouldFoldShiftPairToMask -> shouldFoldConstantShiftPairToMask

preferShiftsToClearExtremeBits -> shouldFoldMaskToVariableShiftPair

llvm-svn: 358526
2019-04-16 20:57:28 +00:00
Sanjay Patel
e864e39ef0 [EarlyCSE] detect equivalence of selects with inverse conditions and commuted operands (PR41101)
This is 1 of the problems discussed in the post-commit thread for:
rL355741 / http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20190311/635516.html
and filed as:
https://bugs.llvm.org/show_bug.cgi?id=41101

Instcombine tries to canonicalize some of these cases (and there's room for improvement
there independently of this patch), but it can't always do that because of extra uses.
So we need to recognize these commuted operand patterns here in EarlyCSE. This is similar
to how we detect commuted compares and commuted min/max/abs.

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

llvm-svn: 358523
2019-04-16 20:41:20 +00:00
Anton Afanasyev
e4728be4df Time profiler: optimize json output time
Summary:
Use llvm::json::Array.reserve() to optimize json output time. Here is motivation:
https://reviews.llvm.org/D60609#1468941. In short: for the json array
with ~32K entries, pushing back each entry takes ~4% of whole time compared
to the method of preliminary memory reservation: (3995-3845)/3995 = 3.75%.

Reviewers: lebedev.ri

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 358522
2019-04-16 20:36:56 +00:00
Nikita Popov
c583b97e3c [CVP] Simplify umulo and smulo that cannot overflow
If a umul.with.overflow or smul.with.overflow operation cannot
overflow, simplify it to a simple mul nuw / mul nsw. After the
refactoring in D60668 this is just a matter of removing an
explicit check against multiplications.

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

llvm-svn: 358521
2019-04-16 20:31:41 +00:00
Anton Afanasyev
796e7c596b [Support][JSON] Add reserve() to json Array
Summary:
Space reservation increases json lib performance for the arrays with large number of entries.
Here is the example and discussion: https://reviews.llvm.org/D60609#1468941

Reviewers: lebedev.ri, sammccall

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 358520
2019-04-16 19:43:18 +00:00
Simon Pilgrim
ee2f2526f5 [SLP] Refactoring of the operand reordering code.
This is a refactoring patch which should have all the functionality of the current code. Its goal is twofold:
i. Cleanup and simplify the reordering code, and
ii. Generalize reordering so that it will work for an arbitrary number of operands, not just 2.

This is the second patch in a series of patches that will enable operand reordering across chains of operations. An example of this was presented in EuroLLVM'18 https://www.youtube.com/watch?v=gIEn34LvyNo .

Committed on behalf of @vporpo (Vasileios Porpodas)

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

llvm-svn: 358519
2019-04-16 19:27:00 +00:00
Nikita Popov
9fb37457cc [CVP] Add tests for non-overflowing mulo; NFC
Should be simplified to simple mul.

llvm-svn: 358517
2019-04-16 19:25:35 +00:00
Simon Pilgrim
91efd693c2 [X86][AVX] X86ISD::PERMV/PERMV3 node types can never fold index ops
Improves codegen demonstrated by D60512 - instructions represented by X86ISD::PERMV/PERMV3 can never memory fold the operand used for their index register.

This patch updates the 'isUseOfShuffle' helper into the more capable 'isFoldableUseOfShuffle' that recognises that the op is used for a X86ISD::PERMV/PERMV3 index mask and can't be folded - allowing us to use broadcast/subvector-broadcast ops to reduce the size of the mask constant pool data.

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

llvm-svn: 358516
2019-04-16 19:18:53 +00:00
Nikita Popov
56867ebef1 [InstCombine] Prune fshl/fshr with masked operands
If a constant shift amount is used, then only some of the LHS/RHS
operand bits are demanded and we may be able to simplify based on
that. InstCombineSimplifyDemanded already had the necessary support
for that, we just weren't calling it with fshl/fshr as root.

In particular, this allows us to relax some masked funnel shifts
into simple shifts, as shown in the tests.

Patch by Shawn Landden.

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

llvm-svn: 358515
2019-04-16 19:05:49 +00:00
Nikita Popov
ee66ef3306 [InstCombine] Add tests for fshl/fshr with masked operands; NFC
Baseline tests for D60660.

Patch by Shawn Landden.

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

llvm-svn: 358514
2019-04-16 19:05:40 +00:00
Sanjay Patel
e8c7b43285 [x86] add more tests for LEA formation; NFC
Promoting the shift to the wider type should allow LEA.

llvm-svn: 358513
2019-04-16 18:58:03 +00:00
Nikita Popov
32304a1b52 [IR] Add WithOverflowInst class
This adds a WithOverflowInst class with a few helper methods to get
the underlying binop, signedness and nowrap type and makes use of it
where sensible. There will be two more uses in D60650/D60656.

The refactorings are all NFC, though I left some TODOs where things
could be improved. In particular we have two places where add/sub are
handled but mul isn't.

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

llvm-svn: 358512
2019-04-16 18:55:16 +00:00
Philip Reames
0687a4b90a [Tests] Add branch_weights to latches so that test is not effected by future profitability patch to LoopPredication
llvm-svn: 358506
2019-04-16 16:32:59 +00:00
Krzysztof Parzyszek
111036dff8 [Hexagon] Remove indeterministic traversal order
Patch by Sergei Larin.

llvm-svn: 358505
2019-04-16 16:05:07 +00:00
Fangrui Song
cf36d99522 [llvm-objdump] Test tabs in disassemble-align.s with a more visible character
Summary: Apply rupprecht's suggestion in D60376

Reviewers: rupprecht

Reviewed By: rupprecht

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 358504
2019-04-16 15:58:42 +00:00
Luis Marques
1e0408f264 [DAGCombiner] Add missing flag to addressing mode check
The checks in `canFoldInAddressingMode` tested for addressing modes that have a
base register but didn't set the `HasBaseReg` flag to true (it's false by
default). This patch fixes that. Although the omission of the flag was
technically incorrect it had no known observable impact, so no tests were
changed by this patch.

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

llvm-svn: 358502
2019-04-16 15:09:18 +00:00
whitequark
03800fc31b [OCaml] Update api to account for FNeg and CallBr instructions
Summary:
This diff adds minimal support for the recent FNeg and CallBr
instructions to the OCaml bindings.

Reviewers: whitequark

Reviewed By: whitequark

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 358501
2019-04-16 15:00:19 +00:00
Luis Marques
0f18bb9cf3 [RISCV] Custom lower SHL_PARTS, SRA_PARTS, SRL_PARTS
When not optimizing for minimum size (-Oz) we custom lower wide shifts
(SHL_PARTS, SRA_PARTS, SRL_PARTS) instead of expanding to a libcall.

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

llvm-svn: 358498
2019-04-16 14:38:32 +00:00
Ulrich Weigand
67e383c845 [SystemZ] Add missing intrinsics to intrinsics-immarg.ll
As of r356091, support for the ImmArg intrinsics was added,
including a SystemZ test case.  However, that test case doesn't
actually verify all SystemZ intrinsics with immediate arguments,
only a subset.  The rest of them actually works correctly, there's
just no test for them.  This patch add all missing intrinsics.

llvm-svn: 358495
2019-04-16 14:35:18 +00:00
Kadir Cetinkaya
8fb38bd91e [llvm][Support] Provide interface to set thread priorities
Summary:
We have a multi-platform thread priority setting function(last piece
landed with D58683), I wanted to make this available to all llvm community,
there seem to be other users of such functionality with portability fixmes:
lib/Support/CrashRecoveryContext.cpp
tools/clang/tools/libclang/CIndex.cpp

Reviewers: gribozavr, ioeric

Subscribers: krytarowski, jfb, kristina, llvm-commits

Tags: #llvm

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

llvm-svn: 358494
2019-04-16 14:32:43 +00:00
Nico Weber
40e1e33fd5 llvm-undname: Consistently use "return nullptr" in functions returning pointers
llvm-svn: 358492
2019-04-16 14:24:42 +00:00
Nico Weber
f78649c093 llvm-undname: Fix nullptr deref on invalid structor names in template args
Similar to r358421: A StructorIndentifierNode has a Class field which
is read when printing it, but if the StructorIndentifierNode appears in
a template argument then demangleFullyQualifiedSymbolName() which sets
Class isn't called. Since StructorIndentifierNodes are always leaf
names, we can just reject them as well.

Found by oss-fuzz.

llvm-svn: 358491
2019-04-16 14:10:34 +00:00
Nico Weber
943bf0836e llvm-undname: Tweak arena allocator
- Make `allocUnalignedBuffer` look more like `allocArray` and `alloc`.
  No behavior change.
- Change `Head->Used < Head->Capacity` to `Head->Used <= Head->Capacity`
  in `allocArray` and `alloc`. No intended behavior change, might be a
  minuscule memory usage improvement. Noticed this since it was the logic
  used in `allocUnalignedBuffer`.
- Don't let `allocArray` alloc too small buffers for names that have
  more than 512 levels of nesting (in 64-bit builds). Fixes a heap
  buffer overflow found by oss-fuzz.

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

llvm-svn: 358489
2019-04-16 13:52:30 +00:00
Nico Weber
bb64eba0be llvm-undname: add a missing CHECK: to a passing test
llvm-svn: 358488
2019-04-16 13:30:50 +00:00
Nico Weber
8330bb9fc5 Fix llvm-undname tests after r358485
llvm-svn: 358487
2019-04-16 13:18:51 +00:00
Nico Weber
64c1542260 gn build: Merge r358422
llvm-svn: 358486
2019-04-16 12:54:43 +00:00
Nico Weber
6d297160ec llvm-undname: Add a -raw-file flag to pass a raw buffer to microsoftDemangle
The default handling splits input into lines. Since
llvm-microsoft-demangle-fuzzer doesn't do this, oss-fuzz produces inputs
that only trigger crashes if the input isn't split into lines. This adds
a hidden flag -raw-file which passes file contents to microsoftDemangle() in
the same way the fuzzer does, for reproducing oss-fuzz reports.

Also change llvm-undname to have a non-0 exit code for invalid symbols.

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

llvm-svn: 358485
2019-04-16 12:51:40 +00:00
Hans Wennborg
45e3eb1feb Re-commit r357452: SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function calls without used results (PR41259)
The original commit caused false positives from AddressSanitizer's
use-after-scope checks, which have now been fixed in r358478.

> The code was previously checking that candidates for sinking had exactly
> one use or were a store instruction (which can't have uses). This meant
> we could sink call instructions only if they had a use.
>
> That limitation seemed a bit arbitrary, so this patch changes it to
> "instruction has zero or one use" which seems more natural and removes
> the need to special-case stores.
>
> Differential revision: https://reviews.llvm.org/D59936

llvm-svn: 358483
2019-04-16 12:13:25 +00:00
Dmitri Gribenko
bf11a7cc89 Removed CMake cache upgrade code from 2011
Summary:
This code was added in r141266 to make a breaking change to CMake, but
still be compatible with existing cache files.  The cache files from
2011 are irrelevant today in 2019.

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 358482
2019-04-16 09:46:02 +00:00
Hans Wennborg
db19639e06 Asan use-after-scope: don't poison allocas if there were untraced lifetime intrinsics in the function (PR41481)
If there are any intrinsics that cannot be traced back to an alloca, we
might have missed the start of a variable's scope, leading to false
error reports if the variable is poisoned at function entry. Instead, if
there are some intrinsics that can't be traced, fail safe and don't
poison the variables in that function.

Differential revision: https://reviews.llvm.org/D60686

llvm-svn: 358478
2019-04-16 07:54:20 +00:00
Anton Afanasyev
70677850d7 Use native llvm JSON library for time profiler output
Summary: Replace plain json text output with llvm JSON library wrapper using.

Reviewers: takuto.ikuta, lebedev.ri

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 358476
2019-04-16 06:35:07 +00:00
Fangrui Song
361854e59a [llvm-objdump] Align instructions to a tab stop in disassembly output
This relands D60376/rL358405, with the difference: sed 'y/\t/ /' -> tr '\t' ' '
BSD sed doesn't support escape characters for the 'y' command.
I didn't use it in rL358405 because it was not listed at
https://llvm.org/docs/GettingStarted.html#software but it
should be available.

Original description:

In GNU objdump, -w/--wide aligns instructions in the disassembly output.
This patch does the same to llvm-objdump. However, we always use the
wide format (-w/--wide is ignored), because the narrow format
(instructions are misaligned) is probably not very useful.

In llvm-readobj, we made a similar decision: always use the wide format,
accept but ignore -W/--wide.

To save some columns, we change the tab before hex bytes (controlled by
--[no-]show-raw-insn) to a space.

llvm-svn: 358474
2019-04-16 03:56:55 +00:00
Fangrui Song
261a4024d0 [llvm-objdump] Simplify PrintHelpMessage() logic
This relands rL358418. It missed one test that should also use -macho
Note, all the other -private-header -exports-trie tests are used
together with -macho.

llvm-svn: 358472
2019-04-16 02:37:29 +00:00
Quentin Colombet
e7b5dee27a [CodeExtractor] Add a few debug lines to understand why a region is not extracted
The CodeExtractor is not smart enough to compute which basic block is
the entry of a region. Instead it relies on the order of the list
of basic blocks that is handed to it and assumes that the entry
is the first block in the list.

Without the additional debug information, it is hard to understand
why a valid region does not get extracted, because we would miss
that the order of in the list just doesn't match what the CodeExtractor
wants.

NFC

llvm-svn: 358471
2019-04-16 02:12:05 +00:00
Eric Christopher
fb1a60fef4 Remove some more unused headers from MachineFunction.h and friends.
Most of these headers are still included via transitive includes and
so won't likely show any problems or improvements in incremental
rebuild time.

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

llvm-svn: 358468
2019-04-16 01:06:03 +00:00
Shoaib Meenai
47a2c82b3d Reapply [Support] Fix recursive response file expansion guard
The test in the dependent revision has been fixed for Windows.

Original commit message:

Response file expansion limits the amount of expansion to prevent
potential infinite recursion. However, the current logic assumes that
any argument beginning with @ is a response file, which is not true for
e.g. `-Xlinker -rpath -Xlinker @executable_path/../lib` on Darwin.
Having too many of these non-response file arguments beginning with @
prevents actual response files from being expanded. Instead, limit based
on the number of successful response file expansions, which should still
prevent infinite recursion but also avoid false positives.

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

> llvm-svn: 358452

llvm-svn: 358466
2019-04-16 00:18:50 +00:00
Shoaib Meenai
4c565ac782 Reapply [Support] Add a test for recursive response file expansion
Use the appropriate tokenizer to fix the test on Windows.

Original commit message:

I'm going to be modifying the logic to avoid infinitely recursing on
self-referential response files, so add a unit test to verify the
expected behavior.

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

> llvm-svn: 358451

llvm-svn: 358465
2019-04-16 00:18:47 +00:00
Shoaib Meenai
9d5c37158a Revert [Support] Add a test for recursive response file expansion
This reverts r358451 (git commit c8497467edc5766ae81ffbde58159f8c6af50803)

The test breaks a Windows buildbot:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/17016/steps/test-check-all/logs/stdio

llvm-svn: 358461
2019-04-15 22:51:54 +00:00
Shoaib Meenai
564f413de0 Revert [Support] Fix recursive response file expansion guard
This reverts r358452 (git commit c8df4fb9c3865eac52a99602c26bbc070098c3d4)

A dependent commit breaks the Windows buildbots.

llvm-svn: 358460
2019-04-15 22:51:53 +00:00
Alex Lorenz
88c5877782 Revert r358405: "[llvm-objdump] Align instructions to a tab stop in disassembly output"
The test fails on darwin due to a sed error:

sed: 1: "y/\t/ /": transform strings are not the same length
llvm-svn: 358459
2019-04-15 22:36:12 +00:00
Amara Emerson
6aca298582 [AArch64][GlobalISel] Don't do extending loads combine for non-pow-2 types.
Since non-pow-2 types are going to get split up into multiple loads anyway,
don't do the [SZ]EXTLOAD combine for those and save us trouble later in
legalization.

llvm-svn: 358458
2019-04-15 22:34:08 +00:00
Quentin Colombet
9629208747 [LSR] Rewrite misses some fixup locations if it splits critical edge
If LSR split critical edge during rewriting phi operands and
phi node has other pending fixup operands, we need to
update those pending fixups. Otherwise formulae will not be
implemented completely and some instructions will not be eliminated.

llvm.org/PR41445

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

Patch by: Denis Bakhvalov <denis.bakhvalov@intel.com>

llvm-svn: 358457
2019-04-15 22:23:46 +00:00