1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
Commit Graph

200357 Commits

Author SHA1 Message Date
Fangrui Song
512d666f40 [DebugInfo] Respect relocations when decoding DW_EH_PE_sdata4 & DW_EH_PE_sdata8 and support R_ARM_REL32
The addresses in llvm-dwarfdump --eh-frame output for object files are closer to readelf -wf output now.
2020-07-18 09:00:50 -07:00
Florian Hahn
85de6c0e87 [PredicateInfo] Fold PredicateWithCondition into PredicateBase (NFC).
Each concrete instance of a predicate has a condition (also noted in the
original PredicateBase comment) and to me it seems like there is no
clear benefit of having both PredicateBase and PredicateWithCondition
and they can be folded together.

Reviewers: nikic, efriedma

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D84089
2020-07-18 16:21:56 +01:00
Roman Lebedev
8e3d4ca0bb [CVP] Soften SDiv into a UDiv as long as we know domains of both of the operands.
Yes, if operands are non-positive this comes at the extra cost
of two extra negations. But  a. division is already just
ridiculously costly, two more subtractions can't hurt much :)
and  b. we have better/more analyzes/folds for an unsigned division,
we could end up narrowing it's bitwidth, converting it to lshr, etc.

This is essentially a take two on 0fdcca07ad2c0bdc2cdd40ba638109926f4f513b,
which didn't fix the potential regression i was seeing,
because ValueTracking's computeKnownBits() doesn't make use
of dominating conditions in it's analysis.
While i could teach it that, this seems like the more general fix.

This big hammer actually does catch said potential regression.

Over vanilla test-suite + RawSpeed + darktable
(10M IR instrs, 1M IR BB, 1M X86 ASM instrs), this fires/converts 5 more
(+2%) SDiv's, the total instruction count at the end of middle-end pipeline
is only +6, so out of +10 extra negations, ~half are folded away,
and asm instr count is only +1, so practically speaking all extra
negations are folded away and are therefore free.
Sadly, all these new UDiv's remained, none folded away.
But there are two less basic blocks.

https://rise4fun.com/Alive/VS6

Name: v0
Pre: C0 >= 0 && C1 >= 0
%r = sdiv i8 C0, C1
  =>
%r = udiv i8 C0, C1

Name: v1
Pre: C0 <= 0 && C1 >= 0
%r = sdiv i8 C0, C1
  =>
%t0 = udiv i8 -C0, C1
%r = sub i8 0, %t0

Name: v2
Pre: C0 >= 0 && C1 <= 0
%r = sdiv i8 C0, C1
  =>
%t0 = udiv i8 C0, -C1
%r = sub i8 0, %t0

Name: v3
Pre: C0 <= 0 && C1 <= 0
%r = sdiv i8 C0, C1
  =>
%r = udiv i8 -C0, -C1
2020-07-18 17:59:56 +03:00
Roman Lebedev
257b19d6f3 [NFC][CVP] Rename predicates - s/positive/non negative/ to better note that zero is ok 2020-07-18 17:59:32 +03:00
Roman Lebedev
19ed66a51a [NFC][CVP] Refactor isPositive() out of hasPositiveOperands() 2020-07-18 17:59:32 +03:00
Roman Lebedev
bdcd8156af [NFC][CVP] Add tests for possible sdiv->udiv where operands are not non-negative
Currently that fold requires both operands to be non-negative,
but the only real requirement for the fold is that we must know
the domains of the operands.
2020-07-18 17:59:31 +03:00
Matt Arsenault
565a992f20 AMDGPU/GlobalISel: Address some test fixmes that don't fail now 2020-07-18 10:54:39 -04:00
Matt Arsenault
54549f1953 AMDGPU/GlobalISel: Fix test copy paste error 2020-07-18 10:09:01 -04:00
David Green
7d43b96403 [LV] Add additional InLoop redution tests. NFC 2020-07-18 12:14:23 +01:00
Evgeny Leviant
3d264ff874 [CodeGen][TargetPassConfig] Add TargetTransformInfo pass correctly
Patch adds tti pass directly enforcing its execution with correctly set
TargetTransformInfo.

Differential revision: https://reviews.llvm.org/D84047
2020-07-18 14:11:40 +03:00
Fangrui Song
6d196aebc6 [RelocationResolver] Support R_AARCH64_PREL32
Code from D83800 by Yichao Yu
2020-07-17 23:49:15 -07:00
Fangrui Song
07079947f8 [RelocationResolver] Support R_PPC_REL32 & R_PPC64_REL{32,64}
This suppresses `failed to compute relocation: R_PPC_REL32, Invalid data was encountered while parsing the file`
and its 64-bit variants when running llvm-dwarfdump on a PowerPC object file with .eh_frame

Unfortunately it is difficult to test the computation:
DWARFDataExtractor::getEncodedPointer does not use the relocated value
and even if it does, we need to teach llvm-dwarfdump --eh-frame to do
some linker job to report a reasonable address.
2020-07-17 23:29:50 -07:00
Gui Andrade
1fa6761405 Revert "update libatomic instrumentation"
This was committed mistakenly.

This reverts commit 1f29171ae77f81cacea32808b67d7ae62da23e0c.
2020-07-18 03:53:00 +00:00
Gui Andrade
f68c59afc1 update libatomic instrumentation 2020-07-18 03:39:21 +00:00
Gui Andrade
6f82a1b548 [LLVM] Add libatomic load/store functions to TargetLibraryInfo
This allows treating these functions like libcalls.
This patch is a prerequisite to instrumenting them in MSAN: https://reviews.llvm.org/D83337

Differential Revision: https://reviews.llvm.org/D83361
2020-07-18 03:18:48 +00:00
Chen Zheng
25aa0c9508 [PowerPC]add testcase for adding store (load float*) pattern, nfc 2020-07-17 22:57:08 -04:00
Chen Zheng
ac8923acd0 [SCEV][IndVarSimplify] insert point should not be block front.
Recommit after removing the unused cast instructions.

Differential Revision:  https://reviews.llvm.org/D80975
2020-07-17 22:25:10 -04:00
Arthur Eubanks
92a77f4b5e [NewPM][ASan] Make ASan tests work under NPM
Under NPM, the asan-globals-md analysis is required but cannot be run
within the asan function pass due to module analyses not being able to
run from a function pass. So this pins all tests using "-asan" to the
legacy PM and adds a corresponding RUN line with
-passes='require<asan-globals-md>,function(asan)'.

Now all tests in Instrumentation/AddressSanitizer pass when
-enable-new-pm is by default on.

Tests were automatically converted using the following python script and
failures were manually fixed up.

import sys
for i in sys.argv:
    with open(i, 'r') as f:
        s = f.read()
    with open(i, 'w') as f:
        for l in s.splitlines():
            if "RUN:" in l and ' -asan -asan-module ' in l and '\\' not in l:
                f.write(l.replace(' -asan -asan-module ', ' -asan -asan-module -enable-new-pm=0 '))
                f.write('\n')
                f.write(l.replace(' -asan -asan-module ', " -passes='require<asan-globals-md>,function(asan),module(asan-module)' "))
                f.write('\n')
            elif "RUN:" in l and ' -asan ' in l and '\\' not in l:
                f.write(l.replace(' -asan ', ' -asan -enable-new-pm=0 '))
                f.write('\n')
                f.write(l.replace(' -asan ', " -passes='require<asan-globals-md>,function(asan)' "))
                f.write('\n')
            else:
                f.write(l)
                f.write('\n')

See https://bugs.llvm.org/show_bug.cgi?id=46611.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D83921
2020-07-17 18:01:25 -07:00
Lang Hames
29e51c11e5 [llvm-jitlink] Add suppport for testing GOT entries and stubs for ELF.
This enables regression testing of GOT and stub handling with
llvm-jitlink.
2020-07-17 17:55:30 -07:00
Kuba Mracek
84167f8973 [asan] Use dynamic shadow memory position on Apple Silicon macOS
This is needed because macOS on Apple Silicon has some reserved pages inside the "regular" shadow memory location, and mapping over that location fails.

Differential Revision: https://reviews.llvm.org/D82912
2020-07-17 17:40:21 -07:00
Logan Smith
435cea1283 [llvm][NFC] Add missing 'override's 2020-07-17 17:35:59 -07:00
Logan Smith
951866abd5 [llvm][NFC] Add missing 'override's in unittests/ 2020-07-17 17:35:59 -07:00
Arthur Eubanks
9627b7997d Revert "[PGO][PGSO] Add profile guided size optimization to loop vectorization legality."
This reverts commit 30c382a7c6607a7d898730f8d288768110cdf1d2.

See https://crbug.com/1106813.
2020-07-17 16:47:41 -07:00
Aditya Nandakumar
571c882dda [GISel: Add support for CSEing SrcOps which are immediates
https://reviews.llvm.org/D84072

Add G_EXTRACT to CSEConfigFull and add unit test as well.
2020-07-17 16:04:24 -07:00
Leonard Chan
d36e1c26ce Revert "[AddressSanitizer] Don't use weak linkage for __{start,stop}_asan_globals"
This reverts commit d76e62fdb7a93d9a33f642b6b528f2562cc3c3f4.

Reverting since this can lead to linker errors:

```
ld.lld: error: undefined hidden symbol: __start_asan_globals
```

when using --gc-sections. The linker can discard __start_asan_globals
once there are no more `asan_globals` sections left, which can lead to
this error if we have external linkages to them.
2020-07-17 15:29:50 -07:00
Michael Spencer
ea50f003c4 [clangd] Fix the build with clang <3.9.
In clang <3.9 the `unique_ptr` constructor that is supposed to allow
for Derived to Base conversion does not work. Remove this if we drop
support for such configurations.

This is the same fix as in fda901a987ddd, and it updates the comments
to better reflect the actual issue. The same thing reproduces with
libc++ with older clangs.
2020-07-17 16:12:31 -06:00
Eric Christopher
2666e23366 Temporarily Revert "[OpenMP] Add Additional Function Attribute Information to OMPKinds.def"
as it's causing a few unused variable warnings via the macro instantiation:

sources/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def:649:17: error: unused variable 'InaccessibleOnlyAttrs' [-Werror,-Wunused-variable]
__OMP_ATTRS_SET(InaccessibleOnlyAttrs,
                ^

This reverts commit 09fe0c5ab9ca5846d6cb625e9be47fdcfe49b93c.
2020-07-17 15:05:42 -07:00
Eric Christopher
96d20bc49f Temporarily Revert "[InlineAdvisor] New inliner advisor to replay inlining from optimization remarks"
as it is failing the inline-replay.ll test as well as sanitizers/Werror
from returning a stack local variable.

This reverts commit 029946b112684c27b27f7c2d7554f22b33ae1e0b.
2020-07-17 14:58:01 -07:00
Joseph Huber
9bc4c83868 [OpenMP] Add Additional Function Attribute Information to OMPKinds.def
Summary:
This patch adds more function attribute information to the runtime function definitions in OMPKinds.def. The goal is to provide sufficient information about OpenMP runtime functions to perform more optimizations on OpenMP code.

Reviewers: jdoerfert

Subscribers: aaron.ballman cfe-commits yaxunl guansong sstefan1 llvm-commits

Tags: #OpenMP #clang #llvm

Differential Revision: https://reviews.llvm.org/D81031
2020-07-17 17:54:01 -04:00
Wenlei He
cc5b62a633 [InlineAdvisor] New inliner advisor to replay inlining from optimization remarks
Summary:
This change added a new inline advisor that takes optimization remarks for previous inlining as input, and provide the decision as advice so current inlining can replay inline decision of a different compilation. Dwarf inline stack with line and discriminator is used as anchor for call sites. The change can be useful for Inliner tuning.
A switch -sample-profile-inline-replay=<inline_remarks_file> is added to hook up the new inliner advisor with SampleProfileLoader's inline decision for replay. The new inline advisor can also be used by regular CGSCC inliner later if needed.

Reviewers: davidxl, mtrofin, wmi, hoy

Subscribers: aprantl, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D83743
2020-07-17 13:30:47 -07:00
Xinan Jiang
7ef298aae5 [InstCombine] Fix typo in comment.
Reviewers: fhahn

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D83951
2020-07-17 20:57:45 +01:00
Roman Lebedev
d1696880fd [InstCombine] Fold X sdiv (-1 << C) -> -(X u>> Y) iff X is non-negative
This is the one i'm seeing as missed optimization,
although there are likely other possibilities, as usual.

There are 4 variants of a general sdiv->udiv fold:
https://rise4fun.com/Alive/VS6

Name: v0
Pre: C0 >= 0 && C1 >= 0
%r = sdiv i8 C0, C1
  =>
%r = udiv i8 C0, C1

Name: v1
Pre: C0 <= 0 && C1 >= 0
%r = sdiv i8 C0, C1
  =>
%t0 = udiv i8 -C0, C1
%r = sub i8 0, %t0

Name: v2
Pre: C0 >= 0 && C1 <= 0
%r = sdiv i8 C0, C1
  =>
%t0 = udiv i8 C0, -C1
%r = sub i8 0, %t0

Name: v3
Pre: C0 <= 0 && C1 <= 0
%r = sdiv i8 C0, C1
  =>
%r = udiv i8 -C0, -C1


If we really don't like sdiv (more than udiv that is),
and are okay with increasing instruction count (2 new negations),
and we ensure that we don't undo the fold,
then we could just implement these..
2020-07-17 22:50:09 +03:00
Roman Lebedev
f572d5a564 [NFC][InstCombine] Add some tests with sdiv-by-negative-power-of-two 2020-07-17 22:50:09 +03:00
Michael Spencer
91ecc54ba0 [Clang] Fix building with Clang < 3.9.
This is a workaround for a bug in older versions of Clang when. The
constructor that is supposed to allow for Derived to Base conversion
does not work. Remove this if we drop support for such configurations.
2020-07-17 13:33:15 -06:00
David Blaikie
8ab112dbf4 [llvm] Add contains(KeyType) -> bool methods to StringSet
Matches C++20 API addition.

Differential Revision: https://reviews.llvm.org/D83449
2020-07-17 11:26:27 -07:00
David Blaikie
479337797c [llvm] Add contains(KeyType) -> bool methods to SparseSet
Matches C++20 API addition.

Differential Revision: https://reviews.llvm.org/D83449
2020-07-17 11:26:27 -07:00
David Blaikie
294e3ec1ba [llvm] Add contains(KeyType) -> bool methods to SmallSet
Matches C++20 API addition.

Differential Revision: https://reviews.llvm.org/D83449
2020-07-17 11:26:27 -07:00
David Blaikie
fe6846924a [llvm] Add contains(KeyType) -> bool methods to SmallPtrSet
Matches C++20 API addition.

Differential Revision: https://reviews.llvm.org/D83449
2020-07-17 11:26:27 -07:00
David Blaikie
3cfbc95ca8 [llvm] Add contains(KeyType) -> bool methods to SetVector
Matches C++20 API addition.

Differential Revision: https://reviews.llvm.org/D83449
2020-07-17 11:26:27 -07:00
David Blaikie
f4752de569 [llvm] Add contains(KeyType) -> bool methods to DenseSet
Matches C++20 API addition.

Differential Revision: https://reviews.llvm.org/D83449
2020-07-17 11:26:26 -07:00
Stanislav Mekhanoshin
27cd2159b8 Fixed warning about signed/unsigned comparison
I've got the report clang11 issues signed/unsigned mismatch
warning here. For some reason only clang11 seems to issue
this warning.

Differential Revision: https://reviews.llvm.org/D83916
2020-07-17 11:03:42 -07:00
George Rokos
314bec7af9 Added missing API call to OpenMP test 2020-07-17 10:40:11 -07:00
Dmitry Preobrazhensky
baa6e7486c [AMDGPU] Removed s_mov_regrd and mov_fed opcodes
These opcodes are not intended for public use.

Reviewers: arsenm, rampitec

Differential Revision: https://reviews.llvm.org/D81659
2020-07-17 19:52:54 +03:00
Yonghong Song
51c6311d11 BPF: generate .rodata BTF datasec for certain initialized local var's
Currently, BTF datasec type for .rodata is generated only if there are
user-defined readonly global variables which have debuginfo generated.

Certain readonly global variables may be generated from initialized
local variables. For example,
  void foo(const void *);
  int test() {
    const struct {
      unsigned a[4];
      char b;
    } val = { .a = {2, 3, 4, 5}, .b = 6 };
    foo(&val);
    return 0;
  }

The clang will create a private linkage const global to store
the initialized value:
  @__const.test.val = private unnamed_addr constant %struct.anon
      { [4 x i32] [i32 2, i32 3, i32 4, i32 5], i8 6 }, align 4

This global variable eventually is put in .rodata ELF section.

If there is .rodata ELF section, libbpf expects a BTF .rodata
datasec as well even though it may be empty meaning there are no
global readonly variables with proper debuginfo. Martin reported
a bug where without this empty BTF .rodata datasec, the bpftool
gen will exit with an error.

This patch fixed the issue by generating .rodata BTF datasec
if there exists local var intial data which will result in
.rodata ELF section.

Differential Revision: https://reviews.llvm.org/D84002
2020-07-17 09:45:57 -07:00
Fangrui Song
3744006268 [OptTable] Support grouped short options
POSIX.1-2017 12.2 Utility Syntax Guidelines, Guideline 5 says:

> One or more options without option-arguments, followed by at most one option that takes an option-argument, should be accepted when grouped behind one '-' delimiter.

i.e. -abc represents -a -b -c. The grouped short options are very common.  Many
utilities extend the syntax by allowing (an option with an argument) following a
sequence of short options.

This patch adds the support to OptTable, similar to cl::Group for CommandLine
(D58711).  llvm-symbolizer will use the feature (D83530). CommandLine is exotic
in some aspects. OptTable is preferred if the user wants to get rid of the
behaviors.

* `cl::opt<bool> i(...)` can be disabled via -i=false or -i=0, which is
  different from conventional --no-i.
* Handling --foo & --no-foo requires a comparison of argument positions,
  which is a bit clumsy in user code.

OptTable::parseOneArg (non-const reference InputArgList) is added along with
ParseOneArg (const ArgList &). The duplicate does not look great at first
glance. However, The implementation can be simpler if ArgList is mutable.
(ParseOneArg is used by clang-cl (FlagsToInclude/FlagsToExclude) and lld COFF
(case-insensitive). Adding grouped short options can make the function even more
complex.)

The implementation allows a long option following a group of short options. We
probably should refine the code to disallow this in the future. Allowing this
seems benign for now.

Reviewed By: grimar, jhenderson

Differential Revision: https://reviews.llvm.org/D83639
2020-07-17 09:32:43 -07:00
Nico Weber
74cfe04a0f [gn build] Run git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format 2020-07-17 12:31:42 -04:00
Nikita Popov
9f13e86ec9 [IR] Fix MSVC warning (NFC)
As requested by Andrew Kaylor, rewrite this code in a way that does
not warn on old MSVC versions.

Avoid the buggy constexpr warning by just not using constexpr and
removing the static_assert that depends on it.
2020-07-17 18:27:39 +02:00
Nico Weber
598efdf414 [gn build] (manually) merge 6c43ed608 2020-07-17 12:27:21 -04:00
Nico Weber
1fb7448577 [gn build] Make sync_source_lists_from_cmake handle one-line sources lines
sync_source_lists_from_cmake now also looks for source files in
`sources += [ "foo.cc" ]` lines, which allows us to remove most
`# Make `gn format` not collapse this` comments.

(sync_source_lists_from_cmake doesn't look for `foo_headers += [...]`
still, so the comment is still needed in two places for that.)

No intentional behavior change.
2020-07-17 11:53:42 -04:00
Sanjay Patel
98ef1ef387 [InstSimplify] add tests for fcmp with infinity; NFC 2020-07-17 11:51:41 -04:00