Alexey Bataev [Fri, 1 Jan 2021 16:27:23 +0000 (08:27 -0800)]
[SLP]Add a test for correct use of the reordered loads, NFC.
Nikita Popov [Fri, 1 Jan 2021 16:00:02 +0000 (17:00 +0100)]
[InstSimplify] Add tests for gep p, -p without inbounds (NFC)
This is additional test coverage for D93820.
Nikita Popov [Fri, 1 Jan 2021 15:32:19 +0000 (16:32 +0100)]
[LVI] Handle unions of conditions
LVI previously handled "if (L && R)" conditions, but not
"if (L || R)" conditions. The latter case can still produce
useful information if L and R both constrain the same variable.
This adds support for handling the "if (L || R)" case as well.
The only difference is that we take the union instead of the
intersection of the lattice values.
Nikita Popov [Fri, 1 Jan 2021 15:12:44 +0000 (16:12 +0100)]
[CVP] Add tests for union of conditions (NFC)
We currently handle intersected conditions, but not unioned
conditions.
Paul C. Anagnostopoulos [Fri, 25 Dec 2020 00:02:52 +0000 (19:02 -0500)]
[TableGen] Continue cleaning up .td files
This pass includes LLVM and MLIR files.
Differential Revision: https://reviews.llvm.org/D93864
Florian Hahn [Fri, 1 Jan 2021 13:31:59 +0000 (13:31 +0000)]
[LoopDistribute] Add tests with uncomputable BTCs.
Florian Hahn [Fri, 1 Jan 2021 13:31:23 +0000 (13:31 +0000)]
[LoopLoadElim] Add tests with uncomputable BTCs.
Florian Hahn [Thu, 31 Dec 2020 12:40:48 +0000 (12:40 +0000)]
[LAA] Add tests with uncomputable BTCs.
Florian Hahn [Wed, 30 Dec 2020 16:14:40 +0000 (16:14 +0000)]
[LV] Fix crash when generating remarks with multi-exit loops.
If DoExtraAnalysis is true (e.g. because remarks are enabled), we
continue with the analysis rather than exiting. Update code to
conditionally check if the ExitBB has phis or not a single predecessor.
Otherwise a nullptr is dereferenced with DoExtraAnalysis.
Juneyoung Lee [Fri, 1 Jan 2021 13:35:57 +0000 (22:35 +0900)]
Precommit a test for D92015 (NFC)
Yang Fan [Fri, 1 Jan 2021 06:16:12 +0000 (14:16 +0800)]
[clang-tidy][NFC] Fix a build warning due to an extra semicolon
Differential Revision: https://reviews.llvm.org/D93961
Yang Fan [Fri, 1 Jan 2021 05:30:36 +0000 (13:30 +0800)]
[Sema] Fix deleted function problem in implicitly movable test
In implicitly movable test, a two-stage overload resolution is performed.
If the first overload resolution selects a deleted function, Clang directly
performs the second overload resolution, without checking whether the
deleted function matches the additional criteria.
This patch fixes the above problem.
Reviewed By: Quuxplusone
Differential Revision: https://reviews.llvm.org/D92936
Andrew Litteken [Tue, 8 Sep 2020 18:42:56 +0000 (13:42 -0500)]
[IRSim][IROutliner] Allowing call instructions to be outlined.
We add an extra check to make sure that we do not outline calls to
indirect functions, but outline whatever the IRSimilarityIdentifier
finds with respect to calls.
Tests:
Removing test/Transforms/IROutliner/illegal-calls.ll
Adding test/Transforms/IROutliner/outlining-calls.ll
Adding test/Transforms/IROutliner/illegal-indirect-calls.ll
Excluding DebugInfo this is the last patch for the initial
implementation of the IROutliner!
Reviewers: jroelofs, paquette
Differential Revision: https://reviews.llvm.org/D87314
Andrew Litteken [Wed, 16 Sep 2020 03:25:05 +0000 (22:25 -0500)]
[IRSim] Letting call instructions be legal for similarity identification.
Here we let non-intrinsic calls be considered legal and valid for
similarity only if the call is not indirect, and has a name.
For two calls to be considered similar, they must have the same name,
the same function types, and the same set of parameters, including tail
calls and calling conventions.
Tests are found in unittests/Analysis/IRSimilarityIdentifierTest.cpp.
Reviewers: jroelofs, paquette
Differential Revision: https://reviews.llvm.org/D87312
Roman Lebedev [Fri, 1 Jan 2021 00:19:17 +0000 (03:19 +0300)]
[SimplifyCFG] SUCCESS! Teach createUnreachableSwitchDefault() to preserve DomTree
This pretty much concludes patch series for updating SimplifyCFG
to preserve DomTree. All 318 dedicated `-simplifycfg` tests now pass
with `-simplifycfg-require-and-preserve-domtree=1`.
There are a few leftovers that apparently don't have good test coverage.
I do not yet know what gaps in test coverage will the wider-scale testing
reveal, but the default flip might be close.
Roman Lebedev [Thu, 31 Dec 2020 23:44:17 +0000 (02:44 +0300)]
[SimplifyCFG] Teach tryToSimplifyUncondBranchWithICmpInIt() to preserve DomTree
Roman Lebedev [Thu, 31 Dec 2020 23:21:53 +0000 (02:21 +0300)]
[SimplifyCFG] Teach FoldValueComparisonIntoPredecessors() to preserve DomTree, part 2
Roman Lebedev [Thu, 31 Dec 2020 22:02:06 +0000 (01:02 +0300)]
[SimplifyCFG] Teach eliminateDeadSwitchCases() to preserve DomTree, part 1
Roman Lebedev [Thu, 31 Dec 2020 21:13:48 +0000 (00:13 +0300)]
[SimplifyCFG] Teach SimplifyEqualityComparisonWithOnlyPredecessor() to preserve DomTree, part 3
Roman Lebedev [Thu, 31 Dec 2020 19:46:42 +0000 (22:46 +0300)]
[SimplifyCFG] Teach simplifyIndirectBr() to preserve DomTree
Roman Lebedev [Thu, 31 Dec 2020 19:23:23 +0000 (22:23 +0300)]
[SimplifyCFG] Teach FoldBranchToCommonDest() to preserve DomTree, part 2
Roman Lebedev [Thu, 31 Dec 2020 17:13:30 +0000 (20:13 +0300)]
[SimplifyCFG] Teach FoldValueComparisonIntoPredecessors() to preserve DomTree, part 1
Andrew Litteken [Tue, 8 Sep 2020 01:19:54 +0000 (20:19 -0500)]
[IRSim][IROutliner] Allowing GEP instructions to be outlined.
We outline what the IRSimilarityIdentifier deems GEP Instructions to be
similar. In this case, the types must be the same, and the operand
values after the first indexing operand must be the exact same.
Tests:
Removing test/Transforms/IROutliner/illegal-gep.ll
Adding test/Transforms/IROutliner/outlining-gep.ll
Reviewers: jroelofs, paquette
Differential Revision: https://reviews.llvm.org/D87317
Jacques Pienaar [Thu, 31 Dec 2020 22:46:08 +0000 (14:46 -0800)]
[mlir][shape] Add shape.lib attribute
Enable querying shape function library ops from the module. Currently
supports singular or array of them (as long as array has all unique ops
in mappings). The preferred canonical form would have one library, but
given the invariant on the mapping, this can easily be achieved by a
simple merging pass.
Preferred the attribute approach vs naming convention as these could be
added in multiple different ways.
Sanjay Patel [Thu, 31 Dec 2020 21:45:33 +0000 (16:45 -0500)]
[Analysis] reduce code for matching min/max; NFC
This might also make it easier to adapt if we want
to match min/max intrinsics rather than cmp+sel idioms.
The 'const' part is to potentially avoid confusion
in calling code. There's some surprising and possibly
wrong behavior related to matching min/max reductions
differently than other reductions.
Fangrui Song [Thu, 31 Dec 2020 21:59:45 +0000 (13:59 -0800)]
Refactor how -fno-semantic-interposition sets dso_local on default visibility external linkage definitions
The idea is that the CC1 default for ELF should set dso_local on default
visibility external linkage definitions in the default -mrelocation-model pic
mode (-fpic/-fPIC) to match COFF/Mach-O and make output IR similar.
The refactoring is made available by
2820a2ca3a0e69c3f301845420e0067ffff2251b.
Currently only x86 supports local aliases. We move the decision to the driver.
There are three CC1 states:
* -fsemantic-interposition: make some linkages interposable and make default visibility external linkage definitions dso_preemptable.
* (default): selected if the target supports .Lfoo$local: make default visibility external linkage definitions dso_local
* -fhalf-no-semantic-interposition: if neither option is set or the target does not support .Lfoo$local: like -fno-semantic-interposition but local aliases are not used. So references can be interposed if not optimized out.
Add -fhalf-no-semantic-interposition to a few tests using the half-based semantic interposition behavior.
Fangrui Song [Thu, 31 Dec 2020 21:37:35 +0000 (13:37 -0800)]
[test] Make ELF tests immune to dso_local/dso_preemptable/(none) differences
ELF -cc1 -mrelocation-model pic will default to no semantic interposition plus
setting dso_local on default visibility external linkage definitions, so that
COFF, Mach-O and ELF output will be similar.
This patch makes tests immune to the differences.
Andrew Litteken [Thu, 31 Dec 2020 21:13:46 +0000 (15:13 -0600)]
Revert "remove pessimizing moves (reported by gcc 10)"
Causing multiple different buildbots to fail with similar errors to:
http://lab.llvm.org:8011/#/builders/84/builds/3719/
http://lab.llvm.org:8011/#/builders/21/builds/5863/
This reverts commit
a2513cb8655e0aea4baffb4391e946ad3e56d883.
Juneyoung Lee [Thu, 31 Dec 2020 20:59:26 +0000 (05:59 +0900)]
Add tests for D93943 (NFC)
Andrew Litteken [Tue, 8 Sep 2020 01:12:52 +0000 (20:12 -0500)]
[IRSim] Letting gep instructions be legal for similarity identification.
GetElementPtr instructions require the extra check that all operands
after the first must only be constants and be exactly the same to be
considered similar.
Tests are found in unittests/Analysis/IRSimilarityIdentifierTest.cpp.
Nuno Lopes [Thu, 31 Dec 2020 20:35:56 +0000 (20:35 +0000)]
remove pessimizing moves (reported by gcc 10)
Juneyoung Lee [Thu, 31 Dec 2020 19:46:10 +0000 (04:46 +0900)]
[CodeGen] recognize select form of and/ors when splitting branch conditions
Recently a few patches are made to move towards using select i1 instead of and/or i1 to represent "a && b"/"a || b" in C/C++.
"a && b" in C/C++ does not evaluate b if a is false whereas 'and a, b' in IR evaluates b and uses its result regardless of the result of a.
This is problematic because it can cause miscompilation if b was an erroneous operation (https://llvm.org/pr48353).
In C/C++, the result is simply false because b is not evaluated, but in IR the result is poison.
The discussion at D93065 has more context about this.
This patch makes two branch-splitting optimizations (one in SelectionDAGBuilder, one in CodeGenPrepare) recognize
select form of and/or as well using m_LogicalAnd/Or.
Since it is CodeGen, I think this is semantically ok (at least as safe as what codegen already did).
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D93853
Juneyoung Lee [Thu, 31 Dec 2020 19:33:18 +0000 (04:33 +0900)]
[SCEV] recognize logical and/or pattern
This patch makes SCEV recognize 'select A, B, false' and 'select A, true, B'.
This is a performance improvement that will be helpful after unsound select -> and/or transformation is removed, as discussed in D93065.
SCEV's answers for the select form should be a bit more conservative than the equivalent `and A, B` / `or A, B`.
Take this example: https://alive2.llvm.org/ce/z/NsP9ue .
To check whether it is valid for SCEV's computeExitLimit to return min(n, m) as ExactNotTaken value, I put llvm.assume at tgt.
It fails because the exit limit becomes poison if n is zero and m is poison. This is problematic if e.g. the exit value of i is replaced with min(n, m).
If either n or m is constant, we can revive the analysis again. I added relevant tests and put alive2 links there.
If and is used instead, this is okay: https://alive2.llvm.org/ce/z/K9rbJk . Hence the existing analysis is sound.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D93882
Atmn [Thu, 31 Dec 2020 17:50:17 +0000 (12:50 -0500)]
[Clang][Misc] Change run line in fragile test
This test has %clang in the run line when it should have %clang_cc1.
This should prevent future release test failures.
Differential Revision: https://reviews.llvm.org/D93952
Andrew Litteken [Mon, 24 Aug 2020 08:24:59 +0000 (03:24 -0500)]
[IROutliner] Adding consistent function attribute merging
When combining extracted functions, they may have different function
attributes. We want to make sure that we do not make any assumptions,
or lose any information. This attempts to make sure that we consolidate
function attributes to their most general case.
Tests:
llvm/test/Transforms/IROutliner/outlining-compatible-and-attribute-transfer.ll
llvm/test/Transforms/IROutliner/outlining-compatible-or-attribute-transfer.ll
Reviewers: jdoefert, paquette
Differential Revision: https://reviews.llvm.org/D87301
Fangrui Song [Thu, 31 Dec 2020 18:04:21 +0000 (10:04 -0800)]
[ThinLTO] Default -enable-import-metadata to false
The default value is dependent on `-DLLVM_ENABLE_ASSERTIONS={off,on}` (D22167), which is
error-prone. The few tests checking `!thinlto_src_module` can specify -enable-import-metadata explicitly.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D93959
Kazu Hirata [Thu, 31 Dec 2020 17:39:12 +0000 (09:39 -0800)]
[MemorySSA, BPF] Use isa instead of dyn_cast (NFC)
Kazu Hirata [Thu, 31 Dec 2020 17:39:11 +0000 (09:39 -0800)]
[CodeGen] Construct SmallVector with iterator ranges (NFC)
Kazu Hirata [Thu, 31 Dec 2020 17:39:09 +0000 (09:39 -0800)]
[llvm-objcopy] Use llvm::erase_if (NFC)
Fangrui Song [Thu, 31 Dec 2020 17:31:53 +0000 (09:31 -0800)]
[ThinLTO][test] Specify -enable-import-metadata to make !thinlto_src_module available in -DLLVM_ENABLE_ASSERTIONS=off mode
Fangrui Song [Thu, 31 Dec 2020 17:16:35 +0000 (09:16 -0800)]
[ThinLTO][test] Add visibility related tests
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D92899
Dávid Bolvanský [Thu, 31 Dec 2020 14:04:32 +0000 (15:04 +0100)]
[InstCombine] Transform (A + B) - (A & B) to A | B (PR48604)
define i32 @src(i32 %x, i32 %y) {
%0:
%a = add i32 %x, %y
%o = and i32 %x, %y
%r = sub i32 %a, %o
ret i32 %r
}
=>
define i32 @tgt(i32 %x, i32 %y) {
%0:
%b = or i32 %x, %y
ret i32 %b
}
Transformation seems to be correct!
https://alive2.llvm.org/ce/z/2fhW6r
Dávid Bolvanský [Thu, 31 Dec 2020 13:59:15 +0000 (14:59 +0100)]
[NFC] Added/adjusted tests for PR48604; second pattern
Dávid Bolvanský [Thu, 31 Dec 2020 13:02:44 +0000 (14:02 +0100)]
[InstCombine] Transform (A + B) - (A | B) to A & B (PR48604)
define i32 @src(i32 %x, i32 %y) {
%0:
%a = add i32 %x, %y
%o = or i32 %x, %y
%r = sub i32 %a, %o
ret i32 %r
}
=>
define i32 @tgt(i32 %x, i32 %y) {
%0:
%b = and i32 %x, %y
ret i32 %b
}
Transformation seems to be correct!
https://alive2.llvm.org/ce/z/aQRh2j
Dávid Bolvanský [Thu, 31 Dec 2020 12:57:20 +0000 (13:57 +0100)]
[NFC] Added tests for PR48604
Bogdan Graur [Thu, 31 Dec 2020 11:47:30 +0000 (11:47 +0000)]
Revert "[LoopDeletion] Allows deletion of possibly infinite side-effect free loops"
Test clang/test/Misc/loop-opt-setup.c fails when executed in Release.
This reverts commit
6f1503d59854b331f1f970d39839619b0a26bbc7.
Reviewed By: SureYeaah
Differential Revision: https://reviews.llvm.org/D93956
Bogdan Graur [Thu, 31 Dec 2020 11:41:03 +0000 (11:41 +0000)]
Revert "[ThinLTO][test] Add visibility related tests"
Both newly added tests fail in Release.
This reverts commit
52aa4e210744361a5ed6dc50fef78ed91706e508.
Reviewed By: SureYeaah
Differential Revision: https://reviews.llvm.org/D93957
Nuno Lopes [Thu, 31 Dec 2020 11:13:25 +0000 (11:13 +0000)]
LangRef: fix significand bits of fp128
Fangrui Song [Thu, 31 Dec 2020 08:55:57 +0000 (00:55 -0800)]
[sanitizer] Include fstab.h on glibc/FreeBSD/NetBSD/macOS
Fangrui Song [Thu, 31 Dec 2020 08:44:25 +0000 (00:44 -0800)]
[sanitizer] Define SANITIZER_GLIBC to refine SANITIZER_LINUX feature detection and support musl
Several `#if SANITIZER_LINUX && !SANITIZER_ANDROID` guards are replaced
with the more appropriate `#if SANITIZER_GLIBC` (the headers are glibc
extensions, not specific to Linux (i.e. if we ever support GNU/kFreeBSD
or Hurd, the guards may automatically work)).
Several `#if SANITIZER_LINUX && !SANITIZER_ANDROID` guards are refined
with `#if SANITIZER_GLIBC` (the definitions are available on Linux glibc,
but may not be available on other libc (e.g. musl) implementations).
This patch makes `ninja asan cfi msan stats tsan ubsan xray` build on a musl based Linux distribution (apk install musl-libintl)
Notes about disabled interceptors for musl:
* `SANITIZER_INTERCEPT_GLOB`: musl does not implement `GLOB_ALTDIRFUNC` (GNU extension)
* Some ioctl structs and functions operating on them.
* `SANITIZER_INTERCEPT___PRINTF_CHK`: `_FORTIFY_SOURCE` functions are GNU extension
* `SANITIZER_INTERCEPT___STRNDUP`: `dlsym(RTLD_NEXT, "__strndup")` errors so a diagnostic is formed. The diagnostic uses `write` which hasn't been intercepted => SIGSEGV
* `SANITIZER_INTERCEPT_*64`: the `_LARGEFILE64_SOURCE` functions are glibc specific. musl does something like `#define pread64 pread`
* Disabled `msg_iovlen msg_controllen cmsg_len` checks: musl is conforming while many implementations (Linux/FreeBSD/NetBSD/Solaris) are non-conforming. Since we pick the glibc definition, exclude the checks for musl (incompatible sizes but compatible offsets)
Pass through LIBCXX_HAS_MUSL_LIBC to make check-msan/check-tsan able to build libc++ (https://bugs.llvm.org/show_bug.cgi?id=48618).
Many sanitizer features are available now.
```
% ninja check-asan
(known issues:
* ASAN_OPTIONS=fast_unwind_on_malloc=0 odr-violations hangs
)
...
Testing Time: 53.69s
Unsupported : 185
Passed : 512
Expectedly Failed: 1
Failed : 12
% ninja check-ubsan check-ubsan-minimal check-memprof # all passed
% ninja check-cfi
( all cross-dso/)
...
Testing Time: 8.68s
Unsupported : 264
Passed : 80
Expectedly Failed: 8
Failed : 32
% ninja check-msan
(Many are due to functions not marked unsupported.)
Testing Time: 23.09s
Unsupported : 6
Passed : 764
Expectedly Failed: 2
Failed : 58
% ninja check-tsan
Testing Time: 23.21s
Unsupported : 86
Passed : 295
Expectedly Failed: 1
Failed : 25
```
Used `ASAN_OPTIONS=verbosity=2` to verify no unneeded interceptors.
Partly based on Jari Ronkainen's https://reviews.llvm.org/D63785#1921014
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D93848
Fangrui Song [Thu, 31 Dec 2020 08:27:11 +0000 (00:27 -0800)]
[test] Add {{.*}} to make ELF tests immune to dso_local/dso_preemptable/(none) differences
For a default visibility external linkage definition, dso_local is set for ELF
-fno-pic/-fpie and COFF and Mach-O. Since default clang -cc1 for ELF is similar
to -fpic ("PIC Level" is not set), this nuance causes unneeded binary format differences.
To make emitted IR similar, ELF -cc1 -fpic will default to -fno-semantic-interposition,
which sets dso_local for default visibility external linkage definitions.
To make this flip smooth and enable future (dso_local as definition default),
this patch replaces (function) `define ` with `define{{.*}} `,
(variable/constant/alias) `= ` with `={{.*}} `, or inserts appropriate `{{.*}} `.
Fangrui Song [Thu, 31 Dec 2020 08:13:34 +0000 (00:13 -0800)]
[test] Fix -triple and delete UNSUPPORTED: system-windows
Juneyoung Lee [Thu, 31 Dec 2020 08:11:31 +0000 (17:11 +0900)]
Update inselt tests at llvm/test/Analysis to have poison as shufflevector's placeholder (NFC)
File listed by:
grep -R -E "^[^;]*shufflevector <.*> .*, <.*> undef" . | grep inseltpoison
Updated with:
sed -i -E 's/shufflevector <(.*)> (.*), <(.*)> undef/shufflevector <\1> \2, <\3> poison/g' $1
Stella Laurenzo [Thu, 31 Dec 2020 08:11:39 +0000 (00:11 -0800)]
[mlir][python] Fix python extension building on windows.
Stella Laurenzo [Wed, 30 Dec 2020 07:34:58 +0000 (23:34 -0800)]
[mlir][python] Tweaks to make python extensions packagable/distributable.
* Works in tandem with prototype packaging scripts here: https://github.com/stellaraccident/mlir-py-release
* The `mlir` top-level now differentiates between in-tree builds where all packages are co-located and distribution mode where all native components are under a top-level `_mlir_libs` package.
* Also fixes the generated dialect python installation again. Hopefully the last tweak.
* With this, I am able to install and generate archives with the above setup script on Linux. Archive size=31M with just host codegen and headers/shared-libraries. Will need more linker tweaks when wiring up the next dependent project.
Differential Revision: https://reviews.llvm.org/D93936
Thorsten Schütt [Thu, 31 Dec 2020 07:23:29 +0000 (08:23 +0100)]
[lld/mac] fix typo
Luo, Yuanke [Tue, 8 Dec 2020 12:47:48 +0000 (20:47 +0800)]
Support tilezero intrinsic and c interface for AMX.
Differential Revision: https://reviews.llvm.org/D92837
Fangrui Song [Thu, 31 Dec 2020 04:52:01 +0000 (20:52 -0800)]
[CodeGenModule] Set dso_local for Mach-O GlobalValue
* static relocation model: always
* other relocation models: if isStrongDefinitionForLinker
This will make LLVM IR emitted for COFF/Mach-O and executable ELF similar.
Fangrui Song [Thu, 31 Dec 2020 04:45:56 +0000 (20:45 -0800)]
[test] Add {{.*}} to make tests immune to dso_local/dso_preemptable/(none) differences
For a definition (of most linkage types), dso_local is set for ELF -fno-pic/-fpie
and COFF, but not for Mach-O. This nuance causes unneeded binary format differences.
This patch replaces (function) `define ` with `define{{.*}} `,
(variable/constant/alias) `= ` with `={{.*}} `, or inserts appropriate `{{.*}} `
if there is an explicit linkage.
* Clang will set dso_local for Mach-O, which is currently implied by TargetMachine.cpp. This will make COFF/Mach-O and executable ELF similar.
* Eventually I hope we can make dso_local the textual LLVM IR default (write explicit "dso_preemptable" when applicable) and -fpic ELF will be similar to everything else. This patch helps move toward that goal.
Monk Chiang [Thu, 31 Dec 2020 03:37:13 +0000 (11:37 +0800)]
[RISCV] Define vector single-width type-convert intrinsic.
Define intrinsics:
1. vfcvt.xu.f.v/vfcvt.x.f.v
2. vfcvt.rtz.xu.f.v/vfcvt.rtz.x.f.v
3. vfcvt.f.xu.v/vfcvt.f.x.v
We work with @rogfer01 from BSC to come out this patch.
Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Monk Chiang <monk.chiang@sifive.com>
Differential Revision: https://reviews.llvm.org/D93933
Monk Chiang [Thu, 31 Dec 2020 03:35:37 +0000 (11:35 +0800)]
[RISCV] Define vector narrowing type-convert intrinsic.
Define intrinsics:
1. vfncvt.xu.f.w/vfncvt.x.f.w
2. vfncvt.rtz.xu.f.w/vfncvt.rtz.x.f.w
3. vfncvt.f.xu.w/vfncvt.f.x.w
4. vfncvt.f.f.w/vfncvt.rod.f.f.w
We work with @rogfer01 from BSC to come out this patch.
Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Monk Chiang <monk.chiang@sifive.com>
Differential Revision: https://reviews.llvm.org/D93932
Monk Chiang [Thu, 31 Dec 2020 03:31:46 +0000 (11:31 +0800)]
[RISCV] Define vector widening type-convert intrinsic.
Define intrinsics:
1. vfwcvt.xu.f.v/vfwcvt.x.f.v
2. vfwcvt.rtz.xu.f.v/vfwcvt.rtz.x.f.v
3. vfwcvt.f.xu.v/vfwcvt.f.x.v
4. vfwcvt.f.f.v
We work with @rogfer01 from BSC to come out this patch.
Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Monk Chiang <monk.chiang@sifive.com>
Differential Revision: https://reviews.llvm.org/D93855
Monk Chiang [Thu, 31 Dec 2020 03:12:40 +0000 (11:12 +0800)]
Add intrinsic testcase for some missing widening reduction.
Add vfredosum/vfredsum/vwredsum/vwredsumu testcase.
Differential Revision: https://reviews.llvm.org/D93887
Vitaly Buka [Tue, 29 Dec 2020 03:19:38 +0000 (19:19 -0800)]
[lsan] Ignore inderect leaks referenced by suppressed blocks
This makes suppression list to work similar to __lsan_ignore_object.
Existing behavior was inconsistent and very inconvenient for complex
data structures.
Example:
struct B;
struct A { B* ptr; };
A* t = makeA();
t->ptr = makeB();
Before the patch: if makeA suppressed by suppression file, lsan will
still report the makeB() leak, so we need two suppressions.
After the patch: a single makeA suppression is enough (the same as a
single __lsan_ignore_object(t)).
Differential Revision: https://reviews.llvm.org/D93884
Fangrui Song [Thu, 31 Dec 2020 02:47:26 +0000 (18:47 -0800)]
[X86] Don't fold negative offset into 32-bit absolute address (e.g. movl $foo-1, %eax)
When building abseil-cpp `bin/absl_hash_test` with Clang in -fno-pic
mode, an instruction like `movl $foo-
2147483648, $eax` may be produced
(subtracting a number from the address of a static variable). If foo's
address is smaller than
2147483648, GNU ld/gold/LLD will error because
R_X86_64_32 cannot represent a negative value.
```
using absl::Hash;
struct NoOp {
template < typename HashCode >
friend HashCode AbslHashValue(HashCode , NoOp );
};
template <typename> class HashIntTest : public testing::Test {};
TYPED_TEST_SUITE_P(HashIntTest);
TYPED_TEST_P(HashIntTest, BasicUsage) {
if (std::numeric_limits< TypeParam >::min )
EXPECT_NE(Hash< NoOp >()({}),
Hash< TypeParam >()(std::numeric_limits< TypeParam >::min()));
}
REGISTER_TYPED_TEST_CASE_P(HashIntTest, BasicUsage);
using IntTypes = testing::Types< int32_t>;
INSTANTIATE_TYPED_TEST_CASE_P(My, HashIntTest, IntTypes);
ld: error: hash_test.cc:(function (anonymous namespace)::gtest_suite_HashIntTest_::BasicUsage<int>::TestBody(): .text+0x4E472): relocation R_X86_64_32 out of range:
18446744071564237392 is not in [0,
4294967295]; references absl::hash_internal::HashState::kSeed
```
Actually any negative offset is not allowed because the symbol address
can be zero (e.g. set by `-Wl,--defsym=foo=0`). So disallow such folding.
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D93931
Atmn Patel [Wed, 23 Dec 2020 02:54:21 +0000 (21:54 -0500)]
[LoopDeletion] Allows deletion of possibly infinite side-effect free loops
From C11 and C++11 onwards, a forward-progress requirement has been
introduced for both languages. In the case of C, loops with non-constant
conditionals that do not have any observable side-effects (as defined by
6.8.5p6) can be assumed by the implementation to terminate, and in the
case of C++, this assumption extends to all functions. The clang
frontend will emit the `mustprogress` function attribute for C++
functions (D86233, D85393, D86841) and emit the loop metadata
`llvm.loop.mustprogress` for every loop in C11 or later that has a
non-constant conditional.
This patch modifies LoopDeletion so that only loops with
the `llvm.loop.mustprogress` metadata or loops contained in functions
that are required to make progress (`mustprogress` or `willreturn`) are
checked for observable side-effects. If these loops do not have an
observable side-effect, then we delete them.
Loops without observable side-effects that do not satisfy the above
conditions will not be deleted.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D86844
Nico Weber [Thu, 31 Dec 2020 01:56:19 +0000 (20:56 -0500)]
[lld/mac] Add -adhoc_codesign / -no_adhoc_codesign flags
These are new in Xcode 12's ld64. lld never codesigns at the moment, so
-no_adhoc_codesign doesn't even have to warn that it's not implemented.
Kazu Hirata [Thu, 31 Dec 2020 01:45:39 +0000 (17:45 -0800)]
[Analysis] Remove unused code recursivelySimplifyInstruction (NFC)
The last use of the function, located in RemovePredecessorAndSimplify,
was removed on Dec 25, 2020 in commit
46bea9b29714ba77010612b04ba13aff56d62e7b.
The last use of RemovePredecessorAndSimplify was removed on Sep 29,
2010 in commit
99c985c37dd45dd0fbd03863037d8e93153783e6.
Kazu Hirata [Thu, 31 Dec 2020 01:45:37 +0000 (17:45 -0800)]
[PGO] Use isa instead of dyn_cast (NFC)
Kazu Hirata [Thu, 31 Dec 2020 01:45:36 +0000 (17:45 -0800)]
[ARM] Declare Op within an if statement (NFC)
Fangrui Song [Thu, 31 Dec 2020 00:58:20 +0000 (16:58 -0800)]
[ThinLTO][test] Add visibility related tests
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D92899
Fangrui Song [Thu, 31 Dec 2020 00:57:50 +0000 (16:57 -0800)]
[TargetMachine] Drop implied dso_local for definitions in ELF static relocation model/PIE
TargetMachine::shouldAssumeDSOLocal currently implies dso_local for such definitions.
Since clang -fno-pic add the dso_local specifier, we don't need to special case.
Fangrui Song [Thu, 31 Dec 2020 00:52:23 +0000 (16:52 -0800)]
[test] Add explicit dso_local to definitions in ELF static relocation model tests
Fangrui Song [Thu, 31 Dec 2020 00:11:31 +0000 (16:11 -0800)]
[LowerEmuTls] Copy dso_local from <var> to __emutls_v.<var>
This effect is not testable until we drop the implied dso_local for ELF
static/PIE defined symbols from TargetMachine::shouldAssumeDSOLocal.
Fangrui Song [Wed, 30 Dec 2020 23:47:16 +0000 (15:47 -0800)]
[test] Add explicit dso_local to definitions in ELF static relocation model tests
Lang Hames [Wed, 30 Dec 2020 04:34:44 +0000 (15:34 +1100)]
[ORC] Remove some stale debugging output.
Fangrui Song [Wed, 30 Dec 2020 23:28:10 +0000 (15:28 -0800)]
[RISCV][test] Add explicit dso_local to definitions in ELF static relocation model tests
Fangrui Song [Wed, 30 Dec 2020 23:26:09 +0000 (15:26 -0800)]
[SystemZ][test] Add explicit dso_local to definitions in ELF static relocation model tests
Fangrui Song [Wed, 30 Dec 2020 23:23:20 +0000 (15:23 -0800)]
[ARM][test] Add explicit dso_local to definitions in ELF static relocation model tests
TargetMachine::shouldAssumeDSOLocal currently implies dso_local for such definitions.
Adding explicit dso_local makes these tests align with the clang -fno-pic behavior
and allow the removal of the TargetMachine::shouldAssumeDSOLocal special case.
Fangrui Song [Wed, 30 Dec 2020 23:03:06 +0000 (15:03 -0800)]
[AArch64][test] Add explicit dso_local to definitions in ELF static relocation model tests
TargetMachine::shouldAssumeDSOLocal currently implies dso_local for such definitions.
Adding explicit dso_local makes these tests align with the clang -fno-pic behavior
and allow the removal of the TargetMachine::shouldAssumeDSOLocal special case.
Split tiny_model.ll to tiny-model-{static,pic}.ll
Fangrui Song [Wed, 30 Dec 2020 22:44:43 +0000 (14:44 -0800)]
[test] Fix linux-preemption.ll
Fangrui Song [Wed, 30 Dec 2020 22:40:50 +0000 (14:40 -0800)]
[X86][test] Add explicit dso_local to definitions in ELF static relocation model tests
TargetMachine::shouldAssumeDSOLocal currently implies dso_local for such definitions.
Adding explicit dso_local makes these tests align with the clang -fno-pic behavior
and allow the removal of the TargetMachine::shouldAssumeDSOLocal special case.
Jacques Pienaar [Wed, 30 Dec 2020 22:16:13 +0000 (14:16 -0800)]
Avoid using /dev/null in test
Windows build bot was not happy with this
(http://lab.llvm.org:8011/#/builders/13/builds/3327/steps/7/logs/FAIL__MLIR__run-reproducer_mlir)
Terry Wilmarth [Wed, 30 Dec 2020 21:39:48 +0000 (00:39 +0300)]
[OpenMP] libomp: Handle implicit conversion warnings
This patch partially prepares the runtime source code to be built with
-Wconversion, which should trigger warnings if any implicit conversions
can possibly change a value. For builds done with icc or gcc, all such
warnings are handled in this patch. clang gives a much longer list of
warnings, particularly for sign conversions, which the other compilers
don't report. The -Wconversion flag is commented into cmake files, but
I'm not going to turn it on. If someone thinks it is important, and wants
to fix all the clang warnings, they are welcome to.
Types of changes made here involve either improving the consistency of types
used so that no conversion is needed, or else performing careful explicit
conversions, when we're sure a problem won't arise.
Patch is a combination of changes by Terry Wilmarth and Johnny Peyton.
Differential Revision: https://reviews.llvm.org/D92942
Brandon Bergren [Wed, 30 Dec 2020 21:22:26 +0000 (15:22 -0600)]
[PowerPC] Add addtional test that retroactively catches PR47259
Due to the unfortunate way the bug could only be triggered when reading SPRG[0-3] into a register lower than %r4 with the "mfsprg %rX, 0" syntax, the tests did not detect it.
(It could not be triggered for "mfsprg0, %r2" because that pattern was already in the table, so the earlier "correct" match took effect)
As a canary, add an intentionally ambiguous "mfsprg 2, 2" and "mtsprg 2, 2" check that would have caught the problem.
Reviewed By: ZhangKang
Differential Revision: https://reviews.llvm.org/D86489
Siva Chandra Reddy [Wed, 30 Dec 2020 20:38:23 +0000 (12:38 -0800)]
[libc][NFC] Use ASSERT_FP_EQ to compare nan values in tests.
This change "fixes" one of the uses that was missed in
0524da67b448dcce6569fae0f54c10f208c2dc56.
Roman Lebedev [Wed, 30 Dec 2020 20:53:23 +0000 (23:53 +0300)]
[LoopIdiom] 'left-shift until bittest': don't forget to check that PHI node is in loop header
Fixes an issue reported by Peter Collingbourne in
https://reviews.llvm.org/D91726#2475301
Roman Lebedev [Wed, 30 Dec 2020 20:33:55 +0000 (23:33 +0300)]
[SimplifyCFG] Teach SwitchToLookupTable() to preserve DomTree
Roman Lebedev [Wed, 30 Dec 2020 20:11:06 +0000 (23:11 +0300)]
[SimplifyCFG] Teach switchToSelect() to preserve DomTree
Roman Lebedev [Wed, 30 Dec 2020 17:48:40 +0000 (20:48 +0300)]
[SimplifyCFG] Teach SimplifyBranchOnICmpChain() to preserve DomTree
Craig Topper [Wed, 30 Dec 2020 18:41:41 +0000 (10:41 -0800)]
[RISCV] Cleanup some V intrinsic names used in tests to match the type overloads used. Add some missing double tests on rv32. NFC
The matching for intrinsic names is forgiving about types in the
name being absent or wrong. Once the intrinsic is parsed its
name will remangled to include the real types.
This commit fixes the names to have at least enough correct types
so that the name used in the test is a prefix of the canonical name.
The big missing part is the type for the VL parameter which changes
size between rv32 and rv64.
While I was in here I noticed that we were missing some tests for
double on rv32 so I fixed that by copying from rv64 and fixing up
the VL argument type.
Fangrui Song [Wed, 30 Dec 2020 20:32:46 +0000 (12:32 -0800)]
[update_llc_test_checks] Support Windows .seh_proc for x86
Sanjay Patel [Wed, 30 Dec 2020 20:22:26 +0000 (15:22 -0500)]
[LoopUtils] reduce FMF and min/max complexity when forming reductions
I don't know if there's some way this changes what the vectorizers
may produce for reductions, but I have added test coverage with
3567908 and 5ced712 to show that both passes already have bugs in
this area. Hopefully this does not make things worse before we can
really fix it.
Sanjay Patel [Wed, 30 Dec 2020 19:25:51 +0000 (14:25 -0500)]
[LoopVectorizer] add test to show wrong FMF propagation; NFC
Fangrui Song [Wed, 30 Dec 2020 19:59:36 +0000 (11:59 -0800)]
[update_llc_test_checks] Support .Lfunc$local for x86 -relocation-model=pic dsolocal tests
Nico Weber [Wed, 30 Dec 2020 18:57:42 +0000 (13:57 -0500)]
[gn build] Switch copy_bundle_data from pax to cpio
This will hopefully fix the build not becoming clean when using Ninja
1.9+. Ninja 1.9 enabled high-resolution time stamps, but pax doesn't
correctly set high-resolution timestamps on its output.
See https://github.com/nico/hack/blob/master/notes/copydir.md for a
detailed writeup of problem and alternatives.
Yuanfang Chen [Wed, 30 Dec 2020 07:15:03 +0000 (23:15 -0800)]
Fix `LLVM_ENABLE_MODULES=On` build
for commit
480936e741d588d53b9e2d9c5935b5daa0fdee25.
Jacques Pienaar [Wed, 30 Dec 2020 18:46:01 +0000 (10:46 -0800)]
[mlir] Add option to read reproducer options from file
Add command line option to read the configuration dumped by the MLIR crash
reproducer and adds those to the other command line options parsed by mlir-opt.
Simple convenience that enables `mlir-opt --run-reproducer /tmp/repro.mlir`
instead of needing to copy&paste the configuration.
Differential Revision: https://reviews.llvm.org/D93924
Fangrui Song [Wed, 30 Dec 2020 18:32:34 +0000 (10:32 -0800)]
[PowerPC][test] Add explicit dso_local to definitions in ELF static relocation model tests
TargetMachine::shouldAssumeDSOLocal currently implies dso_local for such definitions.
Adding explicit dso_local makes these tests align with the clang -fpic behavior
and allow the removal of the TargetMachine::shouldAssumeDSOLocal special case.
Rewrite preemption.ll to dsolocal-static.ll and dsolocal-pic.ll, and add
"PIC Level" metadata.
Max Moroz [Wed, 30 Dec 2020 18:10:23 +0000 (10:10 -0800)]
[compiler-rt] FuzzedDataProvider: Add PickValueInArray for std::array
This makes `PickValueInArray` work for `std::array<T, s>` (C++11). I've also tested the C++17 `std::array` (with compiler-deduced template parameters)
```
Author:
MarcoFalke <falke.marco@gmail.com>
```
Reviewed By: Dor1s
Differential Revision: https://reviews.llvm.org/D93412