Roman Lebedev [Wed, 7 Apr 2021 16:46:30 +0000 (19:46 +0300)]
[InstCombine] foldAddWithConstant(): don't deal with non-immediate constants
All of the code that handles general constant here (other than the more
restrictive APInt-dealing code) expects that it is an immediate,
because otherwise we won't actually fold the constants, and increase
instruction count. And it isn't obvious why we'd be okay with
increasing the number of constant expressions,
those still will have to be run..
But after
2829094a8e252d04f13aabdf6f416c42a06af695
this could also cause endless combine loops.
So actually properly restrict this code to immediates.
Mark de Wever [Wed, 24 Mar 2021 18:54:40 +0000 (19:54 +0100)]
[libc++] Update contributor documentation.
The document has the following updates:
- Rename 'feature test' to 'feature-test', the latter is the spelling
used in the Standard.
- Add information how an ABI list can be downloaded from Buildkite.
Differential Revision: https://reviews.llvm.org/D99290
Sanjay Patel [Wed, 7 Apr 2021 16:11:23 +0000 (12:11 -0400)]
[InstCombine] avoid infinite loop from partial undef vectors
This fixes the examples from
D99674 and
https://llvm.org/PR49878
The matchers succeed on partial undef/poison vector constants,
but the transform creates a full 'not' (-1) constant, so it
would undo a demanded vector elements change triggered by the
extractelement.
Differential Revision: https://reviews.llvm.org/D100044
Christopher Di Bella [Fri, 2 Apr 2021 18:07:31 +0000 (18:07 +0000)]
[libcxx] adds __cpp_lib_concepts feature-test macro
Also adjusts C++20 status paper to indicate full concepts support.
Depends on D96477, D99817.
Differential Revision: https://reviews.llvm.org/D99805
Christopher Di Bella [Wed, 31 Mar 2021 05:28:25 +0000 (05:28 +0000)]
[libcxx] adds remaining callable concepts
* `std::predicate`
* `std::relation`
* `std::equivalence_relation`
* `std::strict_weak_order`
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can
Differential Revision: https://reviews.llvm.org/D96477
Jez Ng [Wed, 7 Apr 2021 16:08:14 +0000 (12:08 -0400)]
[lld-macho] Sibling N_SO symbols must have the empty string
We had been giving them a string index of zero, which actually corresponds to a
string with a single space due to {D89639}.
This was far from obvious in the old test because llvm-nm doesn't quote the
symbol names, making the empty string look identical to a string of a single
space. `dsymutil -s` quotes its strings, so I've changed the test accordingly.
Fixes llvm.org/PR48714. Thanks @clayborg for the tips!
Reviewed By: clayborg
Differential Revision: https://reviews.llvm.org/D100003
Jez Ng [Wed, 7 Apr 2021 16:08:12 +0000 (12:08 -0400)]
[lld-macho][nfc] Add test for ARM64 stubs
Reviewed By: #lld-macho, gkm
Differential Revision: https://reviews.llvm.org/D99813
wlei [Wed, 7 Apr 2021 15:38:13 +0000 (08:38 -0700)]
[CSSPGO] Fix incorrect probe distribution factor computation in top-down inliner
We see a regression related to low probe factor(0.01) which prevents some callsites being promoted in ICPPass and later cause the missing inline in CGSCC inliner. The root cause is due to redundant(the second) multiplication of the probe factor and this change try to fix it.
`Sum` does multiply a factor right after findCallSamples but later when using as the parameter in setProbeDistributionFactor, it multiplies one again.
This change could get ~2% perf back on mcf benchmark. In mcf, previously the corresponding factor is 1 and it's the recent feature introducing the <1 factor then trigger this bug.
Reviewed By: hoy, wenlei
Differential Revision: https://reviews.llvm.org/D99787
Simon Pilgrim [Wed, 7 Apr 2021 15:43:36 +0000 (16:43 +0100)]
[X86][AVX] Add HADD lane crossing test
This used to work before rG77d625f8d8aa, but we now merge the shuffles across the fadd resulting in a hadd that requires a lane crossing post shuffle, which we don't permit on AVX1 targets
Nicolas Vasilache [Wed, 7 Apr 2021 15:21:40 +0000 (15:21 +0000)]
[mlir] Export python-related .cmake files
This allows downstream projects to build python extensions using the same macros as MLIR.
Differential Revision: https://reviews.llvm.org/D100040
Abhina Sreeskantharajan [Wed, 7 Apr 2021 15:21:33 +0000 (11:21 -0400)]
[SystemZ][z/OS][TableGen] TableGen files should be text
This patch sets tablegen files as text. It should have no effect on Windows after this patch landed https://reviews.llvm.org/rG82b3e28e836d2f5c8cfd6e1047b93c088522365a.
Reviewed By: anirudhp
Differential Revision: https://reviews.llvm.org/D100036
Jacques Pienaar [Wed, 7 Apr 2021 15:21:15 +0000 (08:21 -0700)]
[mlir,shape] Update min/max op description
Sander de Smalen [Wed, 17 Mar 2021 21:46:32 +0000 (21:46 +0000)]
[SVE] Remove checks for warnings in scalable-vector tests.
After D98856 these tests will by default break (fatal_error) if any of
the wrong interfaces are used, so there's no longer a need to have a
RUN line that checks for a warning message emitted by the compiler.
Sam Clegg [Tue, 6 Apr 2021 15:06:18 +0000 (08:06 -0700)]
[WebAssembly] Improve error messages regarding missing indirect function table. NFC
Use report_fatal_error here since this is an internal error, and not
something the user can/should be trying to fix.
Also distinguish between the symbol being missing and the symbol having
the wrong type.
We have a failure internally where the symbol is missing. Currently
trying to reduce the test case to something we can attach to an llvm
bug.
Differential Revision: https://reviews.llvm.org/D99960
Sebastian Neubauer [Thu, 1 Apr 2021 12:50:59 +0000 (14:50 +0200)]
[AMDGPU] Update SGPRSpillVGPRCSR name. NFC
The struct is used for both, callee and caller-save registers now.
The frame index is not set for entrypoints, as we do not need to save
the registers then.
Update the struct name to reflect that.
Differential Revision: https://reviews.llvm.org/D99722
Jingu Kang [Wed, 7 Apr 2021 13:22:32 +0000 (14:22 +0100)]
[NPM] Fix typo inisLTOPreLink for loop rotate
Differential Revision: https://reviews.llvm.org/D100033
Nico Weber [Wed, 7 Apr 2021 13:42:11 +0000 (09:42 -0400)]
Revert "[clang] Speedup line offset mapping computation"
This reverts commit
6951b72334bbe4c189c71751edc1e361d7b5632c.
Breaks several bots, see comments on https://reviews.llvm.org/D99409
Simon Pilgrim [Wed, 7 Apr 2021 13:07:35 +0000 (14:07 +0100)]
[X86] Improve optimizeCompareInstr for signed comparisons after AND/OR/XOR instructions
Extend D94856 to handle 'and', 'or' and 'xor' instructions as well
We still fail on many i8/i16 cases as the test and the logic-op are performed on different widths
Alexey Bataev [Tue, 6 Apr 2021 12:59:03 +0000 (05:59 -0700)]
[SLP]Avoid multiple attempts to vectorize CmpInsts.
No need to lookup through and/or try to vectorize operands of the
CmpInst instructions during attempts to find/vectorize min/max
reductions. Compiler implements postanalysis of the CmpInsts so we can
skip extra attempts in tryToVectorizeHorReductionOrInstOperands and save
compile time.
Differential Revision: https://reviews.llvm.org/D99950
Andrzej Warzynski [Wed, 7 Apr 2021 13:10:35 +0000 (13:10 +0000)]
[flang][driver] Fix `-fdebug-dump-provenance`
The -fdebug-dump-provenance flag is meant to be used with
needProvenanceRangeToCharBlockMappings set to true. This way, extra
mapping is generated that allows e.g. IDEs to retrieve symbol's scope
(offset into cooked character stream) based on symbol's source code
location. This patch makes sure that this option is set when using
-fdebug-dump-provenance.
With this patch, the implementation of -fdebug-dump-provenance in
`flang-new -fc1` becomes consistent with `f18`. The corresponding LIT
test is updated so that it can be shared with `f18`. I refined it a bit
so that:
* it becomes a frontend-only test
* it's stricter about the expected output
Differential Revision: https://reviews.llvm.org/D98847
Jay Foad [Wed, 7 Apr 2021 13:03:17 +0000 (14:03 +0100)]
[AMDGPU] SIFoldOperands: don't dump extra '\n' after MachineInstr. NFC.
Andrzej Warzynski [Wed, 7 Apr 2021 11:42:37 +0000 (11:42 +0000)]
[flang][driver] Add support for `-cpp/-nocpp`
This patch adds support for the `-cpp` and `-nocpp` flags. The
implemented semantics match f18 (i.e. the "throwaway" driver), but are
different to gfortran. In Flang the preprocessor is always run. Instead,
`-cpp/-nocpp` are used to control whether predefined and command-line
preprocessor macro definitions are enabled or not. In practice this is
sufficient to model gfortran`s `-cpp/-nocpp`.
In the absence of `-cpp/-nocpp`, the driver will use the extension of
the input file to decide whether to include the standard macro
predefinitions. gfortran's documentation [1] was used to decide which
file extension to use for this.
The logic mentioned above was added in FrontendAction::BeginSourceFile.
That's relatively late in the driver set-up, but this roughly where the
name of the input file becomes available. The logic for deciding between
fixed and free form works in a similar way and was also moved to
FrontendAction::BeginSourceFile for consistency (and to reduce
code-duplication).
The `-cpp/-nocpp` flags are respected also when the input is read from
stdin. This is different to:
* gfortran (behaves as if `-cpp` was used)
* f18 (behaves as if `-nocpp` was used)
Starting with this patch, file extensions are significant and some test
files had to be renamed to reflect that. Where possible, preprocessor
tests were updated so that they can be shared between `f18` and
`flang-new`. This was implemented on top of adding new test for
`-cpp/-nocpp`.
[1] https://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D99292
oToToT [Wed, 7 Apr 2021 12:58:48 +0000 (20:58 +0800)]
[clang] Check AuxTarget exists when creating target in CompilerInstance
D97493 separate target creation out to a single function
`CompilerInstance::createTarget`. However, it would overwrite AuxTarget
even if it has been set.
As @kadircet recommended in D98128, this patch check the existence of
AuxTarget and not overwrite it when it has been set.
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D100024
Sanjay Patel [Wed, 7 Apr 2021 12:12:38 +0000 (08:12 -0400)]
[InstCombine] move abs transform to helper function; NFC
The swap of the operands can affect later transforms that
are expecting a constant as operand 1. I don't think we
can trigger a bug with the current code, but I hit that
problem while drafting a new transform for min/max intrinsics.
Sanjay Patel [Tue, 6 Apr 2021 20:31:25 +0000 (16:31 -0400)]
[InstCombine] add tests for not-of-min/max; NFC
Matthias Springer [Wed, 7 Apr 2021 12:11:55 +0000 (21:11 +0900)]
[mlir] Add "mask" operand to vector.transfer_read/write.
Also factors out out-of-bounds mask generation from vector.transfer_read/write into a new MaterializeTransferMask pattern.
Differential Revision: https://reviews.llvm.org/D100001
Simon Pilgrim [Wed, 7 Apr 2021 12:27:41 +0000 (13:27 +0100)]
[X86] Add AND/OR/XOR signed-comparison overflow test cases for PR48768
D94856 covered the BMI cases where we had existing tests, this adds missing AND/OR/XOR test cases
Florian Hahn [Wed, 7 Apr 2021 12:01:17 +0000 (13:01 +0100)]
[Clang] Extend test coverage for -f[no-]finite-loops options.
Extend test coverage by checking various standard versions with
-f[no-]finite-loops. Suggested as part of D96418.
serge-sans-paille [Thu, 1 Apr 2021 20:18:55 +0000 (22:18 +0200)]
[clang] Speedup line offset mapping computation
Clang spends a decent amount of time in the LineOffsetMapping::get(...)
function. This function used to be vectorized (through SSE2) then the
optimization got dropped because the sequential version was on-par performance
wise.
This provides an optimization of the sequential version that works on a word at
a time, using (documented) bithacks to provide a portable vectorization.
When preprocessing the sqlite amalgamation, this yields a sweet 3% speedup.
Differential Revision: https://reviews.llvm.org/D99409
Balazs Benics [Wed, 7 Apr 2021 11:42:29 +0000 (13:42 +0200)]
[analyzer][NFC] Add tests for extents
If we allocate memory, the extent of the MemRegion will be the symbolic
value of the size parameter. This way, if that symbol gets constrained,
the extent will be also constrained.
This test demonstrates that the extent is indeed the same symbol.
Reviewed By: NoQ
Differential Revision: https://reviews.llvm.org/D99959
Simon Pilgrim [Wed, 7 Apr 2021 11:07:10 +0000 (12:07 +0100)]
[X86] Improve optimizeCompareInstr for signed comparisons after BZHI instructions
Extend D94856 to handle 'bzhi' instructions as well
Valeriy Savchenko [Tue, 30 Mar 2021 16:06:37 +0000 (19:06 +0300)]
[-Wcompletion-handler] Don't recognize init methods as conventional
rdar://
75704162
Differential Revision: https://reviews.llvm.org/D99601
Yevgeny Rouban [Wed, 7 Apr 2021 10:45:05 +0000 (17:45 +0700)]
[Statepoint Lowering] Allow other than N byte sized types in deopt bundle
I do not see any bit-width restriction from the point of the
LLVM Lang Ref - Operand Bundles on the types of the deopt bundle
operands. Statepoint Lowering seems to be able to work with any
types.
This patch relaxes the two related assertions and adds a new test
for this change.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D100006
Valeriy Savchenko [Tue, 23 Mar 2021 15:48:58 +0000 (18:48 +0300)]
[analyzer] Fix body farm for Obj-C++ properties
When property is declared in a superclass (or in a protocol),
it still can be of CXXRecord type and Sema could've already
generated a body for us. This patch joins two branches and
two ways of acquiring IVar in order to reuse the existing code.
And prevent us from generating l-value to r-value casts for
C++ types.
rdar://
67416721
Differential Revision: https://reviews.llvm.org/D99194
Simon Pilgrim [Wed, 7 Apr 2021 10:20:55 +0000 (11:20 +0100)]
[X86] Add BZHI test case for PR48768
D94856 covered the BMI cases where we had existing tests, this adds a missing BZHI test case
crr0004 [Wed, 7 Apr 2021 10:31:41 +0000 (12:31 +0200)]
Fix crash when an invalid URI is parsed and error handling is attempted
When you pass in a payload with an invalid URI in a build with assertions enabled, it will crash.
Consuming the error from the failed URI parse prevents the error.
The crash is caused by the [llvm::expected](https://llvm.org/doxygen/classllvm_1_1Expected.html) having protection around trying to deconstruct without consuming the error first.
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D99872
Kirill Bobyrev [Wed, 7 Apr 2021 09:23:10 +0000 (11:23 +0200)]
[CMake] try creating symlink first on windows
//-E create_symlink// is available on windows since CMake 3.13 (LLVM now uses 3.13.4)
It may needs administrator privileges or enabled developer mode (Windows 10)
See https://cmake.org/cmake/help/latest/release/3.13.html
Reviewed By: kbobyrev
Differential Revision: https://reviews.llvm.org/D99170
Utkarsh Saxena [Tue, 6 Apr 2021 09:55:55 +0000 (11:55 +0200)]
[clang][Syntax] Handle invalid source range in expandedTokens.
Differential Revision: https://reviews.llvm.org/D99934
Sven van Haastregt [Wed, 7 Apr 2021 09:16:41 +0000 (10:16 +0100)]
[OpenCL] Add as_size/ptrdiff/intptr/uintptr_t operators
size_t and friends are built-in scalar data types and s6.4.4.2 of the
OpenCL C Specification says the as_type() operator must be available
for these data types.
Differential Revision: https://reviews.llvm.org/D98959
Stefan Gränitz [Wed, 7 Apr 2021 09:11:27 +0000 (11:11 +0200)]
[Orc][examples] Add missing FileCheck for lit test and polish output
Roman Lebedev [Wed, 7 Apr 2021 08:04:57 +0000 (11:04 +0300)]
Reland [InstCombine] Fold `((X - Y) - Z)` to `X - (Y + Z)` (PR49858)
This reverts commit
a547b4e26b311e417cd51100e379693f51a3f448,
relanding commit
31d219d2997fed1b7dc97e0adf170d5aaf65883e,
which was reverted because there was a conflicting inverse transform,
which was causing an endless combine loop, which has now been adjusted.
Original commit message:
https://alive2.llvm.org/ce/z/67w-wQ
We prefer `add`s over `sub`, and this particular xform
allows further folds to happen:
Fixes https://bugs.llvm.org/show_bug.cgi?id=49858
Roman Lebedev [Wed, 7 Apr 2021 08:50:14 +0000 (11:50 +0300)]
[InstCombine] Restrict "C-(X+C2) --> (C-C2)-X" fold to immediate constants
I.e., if any/all of the consants is an expression, don't do it.
Since those constants won't reduce into an immediate,
but would be left as an constant expression, they could cause
endless combine loops after
31d219d2997fed1b7dc97e0adf170d5aaf65883e
added an inverse transformation.
Roman Lebedev [Wed, 7 Apr 2021 08:50:06 +0000 (11:50 +0300)]
[NFC][InstCombine] Add sub-of-sub tests with constant expressions
These would cause endless combine loop after
31d219d2997fed1b7dc97e0adf170d5aaf65883e.
Thomas Preud'homme [Mon, 5 Apr 2021 10:28:35 +0000 (11:28 +0100)]
[PowerPC, test] Fix use of undef FileCheck var
LLVM test CodeGen/PowerPC/ppc-disable-non-volatile-cr.ll tries to check
for the absence of a sequence of instructions with several CHECK-NOT
with one of those directives using a variable defined in another.
However CHECK-NOT are checked independently so that is using a variable
defined in a pattern that should not occur in the input.
This commit changes occurence of the variable for the regex used in its
definition, thereby making each CHECK-NOT independent.
Reviewed By: NeHuang, nemanjai
Differential Revision: https://reviews.llvm.org/D99880
Thomas Preud'homme [Sun, 28 Mar 2021 00:03:37 +0000 (00:03 +0000)]
[clang, test] Fix use of undef FileCheck var
Clang test CodeGen/libcalls.c contains CHECK-NOT directives using a
variable defined in a CHECK directive with a different prefix never
enabled together, therefore causing the variable to be undefined in that
CHECK-NOT.
The intent of the test is to check that some declaration do not have the
same attribute as when compiling the test without -fmath-errno. This
commits instead changes all CHECK-NOT to CHECK directive, checking that
they all use the same attribute. It also adds an extra CHECK for that
prefix to check the expected attributes these functions should have when
compiling with -fmath-errno.
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D99898
Thomas Preud'homme [Sun, 28 Mar 2021 00:03:37 +0000 (00:03 +0000)]
[Coroutines, test] Fix use of var defined in CHECK-NOT
LLVM test Transforms/Coroutine/coro-split-sink-lifetime-O2.ll tries to
check for the absence of a sequence of instructions with several
CHECK-NOT with one of those directives using a variable defined in
another. However CHECK-NOT are checked independently so that is using a
variable defined in a pattern that should not occur in the input.
This commit simplifies the CHECK-NOT block to only check for the
presence of any lifetime start marker since that is effectively what
the test was testing at the moment.
Reviewed By: junparser
Differential Revision: https://reviews.llvm.org/D99856
Roman Lebedev [Wed, 7 Apr 2021 07:29:18 +0000 (10:29 +0300)]
[CGCall] Annotate `this` argument with alignment
As it is being noted in D99249, lack of alignment information on `this`
has been preventing LICM from happening.
For some time now, lack of alignment attribute does *not* imply
natural alignment, but an alignment of `1`.
Also, we used to treat dereferenceable as implying alignment,
but we no longer do, so it's a bugfix.
Differential Revision: https://reviews.llvm.org/D99790
Qiu Chaofan [Wed, 7 Apr 2021 07:55:52 +0000 (15:55 +0800)]
[PowerPC] Fix use check of swap-reduction
This will fix swap-reduction in DAGISel for cases where COPY_TO_REGCLASS
has multiple uses.
Stefan Gränitz [Wed, 7 Apr 2021 07:44:18 +0000 (09:44 +0200)]
[Orc][examples] Add lit ToolSubst for LLJITWithRemoteDebugging example
The test case added in
258f055ed936 was lacking two important details for the test infrastructure.
ae217bf1f327 added the executable to LLVM_TEST_DEPENDS in CMake to make sure the exectubale gets built before we run the test suite. This patch adds a ToolSubst for the executable in LIT, which replaces the tool invokation in the RUN line with an absolute path. It makes sure we don't run accidentally run some other tool from the user's PATH. The test works without it in case LLVM's main binary directory happens to be the working directory (which is default apparently). Configurations that don't build the examples ignore failures for this ToolSubst (and won't run the test).
Reviewed By: echristo
Differential Revision: https://reviews.llvm.org/D99931
LemonBoy [Tue, 6 Apr 2021 18:40:15 +0000 (20:40 +0200)]
[X86] Initialize TargetOptions::StackProtectorGuardOffset member to its default value
D88631 introduced a set of knobs to tweak how the stack protector is codegen'd for x86 targets, including the offset from the base register where the stack cookie is located. The `StackProtectorGuardOffset` field in `TargetOptions` was left uninitialized instead of being reset to its neutral value -1, making it possible to emit nonsensical code if the frontend doesn't change the field value at all before feeding the `TargetOptions` to the target machine initializer.
Reviewed By: nickdesaulniers
Differential Revision: https://reviews.llvm.org/D99952
Max Kazantsev [Wed, 7 Apr 2021 06:14:53 +0000 (13:14 +0700)]
[SCEV] Fix false-positive recognition of simple recurrences. PR49856
A value from reachable block may come to a Phi node as its input from
unreachable block. This may confuse matchSimpleRecurrence which
has no access to DomTree and can falsely recognize something as a recurrency
because of this effect, as the attached test shows.
Patch `ae7b1e` deals with half of this problem, but it only accounts from
the case when an unreachable instruction comes to Phi as an input.
This patch provides a generalization by checking that no Phi block's
predecessor is unreachable (no matter what the input is).
Differential Revision: https://reviews.llvm.org/D99929
Reviewed By: reames
Petr Hosek [Wed, 7 Apr 2021 06:22:08 +0000 (23:22 -0700)]
Revert "[NFC][Clang] Speculative fix for builtins-ppc-quadword-noi128.c"
This reverts commit
849d3729433e05e6d89892c1814fa07ed3ec18e2 which
depends on
31d219d2997fed1b7dc97e0adf170d5aaf65883e that was reverted.
Christopher Di Bella [Fri, 2 Apr 2021 21:33:39 +0000 (21:33 +0000)]
[libcxx] fixes `common_reference` requirement for `swappable_with`
LWG3175 identifies that the `common_reference` requirement for
`swappable_with` is over-constraining and doesn't need to concern itself
with cv- or reference qualifiers.
Differential Revision: https://reviews.llvm.org/D99817
Petr Hosek [Wed, 7 Apr 2021 05:30:28 +0000 (22:30 -0700)]
Revert "[InstCombine] Fold `((X - Y) - Z)` to `X - (Y + Z)` (PR49858)"
This reverts commit
31d219d2997fed1b7dc97e0adf170d5aaf65883e which
causes an infinite loop when compiling the XRay runtime.
Jacques Pienaar [Wed, 7 Apr 2021 03:22:42 +0000 (20:22 -0700)]
[mlir,shape] Add max/min folder for simple case
When both arguments are the same for these ops, propagate this argument.
Jonas Devlieghere [Wed, 7 Apr 2021 03:15:40 +0000 (20:15 -0700)]
[dsymutil] Stop emulating dsymutil-classic CIE caching behavior
Stop emulating dsymutil-classic which only cached the last used CIE for
reuse.
Jonas Devlieghere [Wed, 7 Apr 2021 02:50:15 +0000 (19:50 -0700)]
[dsymutil] Don't keep old abbreviations
Don't keep the old abbreviations around. This code existed for
compatibility with dsymutil-classic.
Jonas Devlieghere [Wed, 7 Apr 2021 00:23:51 +0000 (17:23 -0700)]
[dsymutil] Don't emit .debug_pubnames and .debug_pubtypes
Consider the .debug_pubnames and .debug_pubtypes their own kind of
accelerator and stop emitting them together with the Apple-style
accelerator tables. The only reason we were still emitting both was for
(byte-for-byte) compatibility with dsymutil-classic.
- This patch adds a new accelerator table kind "Pub" which can be
specified with --accelerator=Pub.
- This patch removes the ability to emit both pubnames/types and apple
style accelerator tables. I don't think anyone is relying on that but
it's worth pointing out.
- This patch removes the --minimize option and makes this behavior the
default. Specifying the flag will result in a warning but won't abort
the program.
Differential revision: https://reviews.llvm.org/D99907
Alex Orlov [Wed, 7 Apr 2021 01:37:46 +0000 (05:37 +0400)]
Removed redundant code.
Yevgeny Rouban [Wed, 7 Apr 2021 01:34:30 +0000 (08:34 +0700)]
[NewPM] Set verify-cfg-preserved=1 by default for debug builds
Weverything [Wed, 7 Apr 2021 00:28:52 +0000 (17:28 -0700)]
Add missing CHECK lines in test
Jacques Pienaar [Wed, 7 Apr 2021 00:58:12 +0000 (17:58 -0700)]
[shape] Add min and max ops
These are element-wise operations that operates on shapes with equal ranks.
Also add missing printer/parser for join operator.
Differential Revision: https://reviews.llvm.org/D99986
Yaxun (Sam) Liu [Wed, 7 Apr 2021 00:32:16 +0000 (20:32 -0400)]
Minor fix for test hip-code-object-version.hip
Changed the order of checking of v2 and v3.
Change-Id: Ifea8197b398afdfb0aa1bd40140cda30f00f0c17
Yaxun (Sam) Liu [Tue, 27 Oct 2020 18:10:02 +0000 (14:10 -0400)]
[HIP] Change to code object v4
Change to code object v4 by default to match ROCm 4.1.
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/D99235
Craig Topper [Tue, 6 Apr 2021 23:48:07 +0000 (16:48 -0700)]
[RISCV] Add an assertion to the ReplaceNodeResults handling of bitcasts to make sure the VT is always a scalar integer.
Nicolás Alvarez [Tue, 6 Apr 2021 22:15:04 +0000 (00:15 +0200)]
[docs] Fix doxygen comments wrongly attached to the llvm namespace
Looking at the Doxygen-generated documentation for the llvm namespace
currently shows all sorts of random comments from different parts of the
codebase. These are mostly caused by:
- File doc comments that aren't marked with \file, so they're attached to
the next declaration, which is usually "namespace llvm {".
- Class doc comments placed before the namespace rather than before the
class.
- Code comments before the namespace that (in my opinion) shouldn't be
extracted by doxygen at all.
This commit fixes these comments. The generated doxygen documentation now
has proper docs for several classes and files, and the docs for the llvm
and llvm::detail namespaces are now empty.
Reviewed By: thakis, mizvekov
Differential Revision: https://reviews.llvm.org/D96736
Peter Steinfeld [Tue, 6 Apr 2021 16:25:35 +0000 (09:25 -0700)]
[flang] Improve constant folding for type parameter inquiries
We were not folding type parameter inquiries for the form 'var%typeParam'
where 'typeParam' was a KIND or LEN type parameter of a derived type and 'var'
was a designator of the derived type. I fixed this by adding code to the
function 'FoldOperation()' for 'TypeParamInquiry's to handle this case. I also
cleaned up the code for the case where there is no designator.
In order to make the error messages correctly refer to both the points of
declaration and instantiation, I needed to add an argument to the function
'InstantiateIntrinsicType()' for the location of the instantiation.
I also changed the formatting of 'TypeParamInquiry' to correctly format this
case. I also added tests for both KIND and LEN type parameter inquiries in
resolve104.f90.
Making these changes revealed an error in resolve89.f90 and caused one of the
error messages in assign04.f90 to be different.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D99892
Craig Topper [Tue, 6 Apr 2021 21:57:01 +0000 (14:57 -0700)]
[RISCV] Don't custom type legalize fixed vector to scalar integer bitcasts if the fixed vector type isn't legal.
We encountered a hang in our internal code base. I'm having trouble
creating a test case because the test that hit it was testing some
code that is not upstream.
Hansang Bae [Thu, 25 Mar 2021 00:12:00 +0000 (19:12 -0500)]
[OpenMP] Define omp_is_initial_device() variants in omp.h
omp_is_initial_device() is marked as a built-in function in the current
compiler, and user code guarded by this call may be optimized away,
resulting in undesired behavior in some cases. This patch provides a
possible fix for such cases by defining the routine as a variant
function and removing it from builtin list.
Differential Revision: https://reviews.llvm.org/D99447
Jez Ng [Tue, 6 Apr 2021 21:52:30 +0000 (17:52 -0400)]
[lld-macho] Symbol::value should always be uint64_t
D98837 migrated a bunch of `value`s to uint64_t, but missed these.
Craig Topper [Tue, 6 Apr 2021 19:43:14 +0000 (12:43 -0700)]
[MachineValueTypes] Add blank lines between floating point vectors with different element types. NFC
John Demme [Tue, 6 Apr 2021 21:15:22 +0000 (14:15 -0700)]
[MLIR] [Python] Add capsule methods for pybind11 to PyOperation
Add the `getCapsule()` and `createFromCapsule()` methods to the PyOperation class.
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D99927
Sidharth Baveja [Tue, 6 Apr 2021 21:24:40 +0000 (21:24 +0000)]
[SplitEdge] Update SplitCriticalEdge to return a nullptr only when the edge is not critical
Summary:
The function SplitCriticalEdge (called by SplitEdge) can return a nullptr in
cases where the edge is a critical. SplitEdge uses SplitCriticalEdge assuming it
can always split all critical edges, which is an incorrect assumption.
The three cases where the function SplitCriticalEdge will return a nullptr is:
1. DestBB is an exception block
2. Options.IgnoreUnreachableDests is set to true and
isa(DestBB->getFirstNonPHIOrDbgOrLifetime()) is not equal to a nullptr
3. LoopSimplify form must be preserved (Options.PreserveLoopSimplify is true)
and it cannot be maintained for a loop due to indirect branches
For each of these situations they are handled in the following way:
1. Modified the function ehAwareSplitEdge originally from
llvm/lib/Transforms/Coroutines/CoroFrame.cpp to handle the cases when the DestBB
is an exception block. This function is called directly in SplitEdge.
SplitEdge does not call SplitCriticalEdge in this case
2. Options.IgnoreUnreachableDests is set to false by default, so this situation
does not apply.
3. Return a nullptr in this situation since the SplitCriticalEdge also returned
nullptr. Nothing we can do in this case.
Reviewed By: asbirlea
Differential Revision:https://reviews.llvm.org/D94619
Vince Bridgers [Tue, 6 Apr 2021 20:47:36 +0000 (15:47 -0500)]
[docs] Update documentation for bugprone-misplaced-widening-cast
The default setting for CheckImplicitCasts was changed in
https://reviews.llvm.org/D32164 but the documentation was not updated.
This simple change just syncs the documentation with the behavior of
that checker.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D99991
Rob Suderman [Wed, 31 Mar 2021 18:18:27 +0000 (11:18 -0700)]
[mlir][tosa] Add tosa.table lowering to linalg.generic
Table op lowering to linalg.generic for both i8 (behaves like a gather) and a
pair of gathers with a quantized interpolation.
Differential Revision: https://reviews.llvm.org/D99756
Aaron Puchert [Tue, 6 Apr 2021 20:29:44 +0000 (22:29 +0200)]
Thread safety analysis: Don't warn about managed locks on join points
We already did so for scoped locks acquired in the constructor, this
change extends the treatment to deferred locks and scoped unlocking, so
locks acquired outside of the constructor. Obviously this makes things
more consistent.
Originally I thought this was a bad idea, because obviously it
introduces false negatives when it comes to double locking, but these
are typically easily found in tests, and the primary goal of the Thread
safety analysis is not to find double locks but race conditions.
Since the scoped lock will release the mutex anyway when the scope ends,
the inconsistent state is just temporary and probably fine.
Reviewed By: delesley
Differential Revision: https://reviews.llvm.org/D98747
Philip Reames [Tue, 6 Apr 2021 20:23:58 +0000 (13:23 -0700)]
Replace calls to IntrinsicInst::Create with CallInst::Create [nfc]
There is no IntrinsicInst::Create. These are binding to the method in the super type. Be explicitly about which method is being called.
Philip Reames [Tue, 6 Apr 2021 20:17:35 +0000 (13:17 -0700)]
Use AssumeInst in a few more places [nfc]
Follow up to
a6d2a8d6f5. These were found by simply grepping for "::assume", and are the subset of that result which looked cleaner to me using the isa/dyn_cast patterns.
Louis Dionne [Tue, 6 Apr 2021 20:15:18 +0000 (16:15 -0400)]
[libc++] NFCI: Fix test pinning down RTTI implementation on Apple platforms
The test didn't handle arm64 correctly.
Thomas Preud'homme [Sun, 28 Mar 2021 00:03:37 +0000 (00:03 +0000)]
[test, AArch64] Fix use of var defined in CHECK-NOT
LLVM test CodeGen/AArch64/speculation-hardening.ll tries to check for
the absence of a sequence of instructions with several CHECK-NOT with
one of those directives using a variable defined in another. However
CHECK-NOT are checked independently so that is using a variable defined
in a pattern that should not occur in the input.
This commit removes the dependency between those CHECK-NOT by replacing
single occurence of the undefined variable by a regex match, and
multiple occurences by a definition followed by a use.
Reviewed By: aemerson
Differential Revision: https://reviews.llvm.org/D99866
Artem Belevich [Thu, 1 Apr 2021 18:25:36 +0000 (11:25 -0700)]
[NVPTX] Handle bitcast and ASC(101) when trying to avoid argument copy.
This allows us to skip the copy in few more cases.
Differential Revision: https://reviews.llvm.org/D99979
Philip Reames [Tue, 6 Apr 2021 19:45:20 +0000 (12:45 -0700)]
Plumb AssumeInst through operand bundle apis [nfc]
Follow up to
a6d2a8d6f5. This covers all the public interfaces of the bundle related code. I tried to cleanup the internals where the changes were obvious, but there's definitely more room for improvement.
Jacques Pienaar [Tue, 6 Apr 2021 19:53:27 +0000 (12:53 -0700)]
[mlir] Hoist out getRequestedOpDefinitions helper
Enables performing the same filtering in the op doc definition as in the op definition generator.
Differential Revision: https://reviews.llvm.org/D99793
Luís Marques [Tue, 6 Apr 2021 19:48:00 +0000 (20:48 +0100)]
[lit testing] Fix xfail-cl.py test worker count
This would fail in test environments with < 3 hardware threads.
Differential Revision: https://reviews.llvm.org/D99858
Luís Marques [Tue, 6 Apr 2021 19:42:48 +0000 (20:42 +0100)]
[ASan][RISCV] Fix RISC-V memory mapping
Fixes the ASan RISC-V memory mapping (originally introduced by D87580 and
D87581). This should be an improvement both in terms of first principles
soundness and observed test failures --- test failures would occur
non-deterministically depending on the ASLR random offset.
On RISC-V Linux (64-bit), `TASK_UNMAPPED_BASE` is currently defined as
`PAGE_ALIGN(TASK_SIZE / 3)`. The non-power-of-two divisor makes the result
be the not very round number 0x1555556000. That address had to be further
rounded to ensure page alignment after the shadow scale shifting is applied.
Still, that value explains why the mapping table may look less regular than
expected.
Further cleanups:
- Moved the mapping table comment, to ensure that the two Linux/AArch64
tables stayed together;
- Removed mention of Sv48. Neither the original mapping nor this one are
compatible with an actual Linux Sv48 address space (mainline Linux still
operates Sv48 in Sv39 mode). A future patch can improve this;
- Removed the additional comments, for consistency.
Differential Revision: https://reviews.llvm.org/D97646
Yaxun (Sam) Liu [Wed, 20 May 2020 19:11:42 +0000 (15:11 -0400)]
Let clang atomic builtins fetch add/sub support floating point types
Recently atomicrmw started to support fadd/fsub:
https://reviews.llvm.org/D53965
However clang atomic builtins fetch add/sub still does not support
emitting atomicrmw fadd/fsub.
This patch adds that.
Reviewed by: John McCall, Artem Belevich, Matt Arsenault, JF Bastien,
James Y Knight, Louis Dionne, Olivier Giroux
Differential Revision: https://reviews.llvm.org/D71726
Felix Berger [Tue, 16 Mar 2021 19:55:44 +0000 (15:55 -0400)]
[clang-tidy] performance-* checks: Match AllowedTypes against qualified type names when they contain "::".
This allows users to be more precise and exclude a type in a specific namespace
from triggering the check instead of excluding all types with the same
unqualified name.
This change should not interfere with correctly configured clang-tidy setups
since an AllowedType with "::" would never match.
Differential Revision: https://reviews.llvm.org/D98738
Reviewed-by: ymandel, hokein
Alexandre Ganea [Tue, 6 Apr 2021 19:35:17 +0000 (15:35 -0400)]
[Windows] Add test coverage for line endings when rewriting includes
Validate that we're properly generating a single line ending on Windows when
using -frewrite-includes. Otherwise we're breaking split-line macros. The test
fails before
23929af383f27a6ddf23704192a25591481152b3.
See discussion in https://reviews.llvm.org/D96363#2650460 and D99426
Differential Revision: https://reviews.llvm.org/D99973
Arthur O'Dwyer [Wed, 24 Mar 2021 22:19:12 +0000 (18:19 -0400)]
[libc++] Header inclusion tests.
As mandated by the Standard's various synopses, e.g. [iterator.synopsis].
Searching the TeX source for '#include' is a good way to find all of these
mandates.
The new tests are all autogenerated by utils/generate_header_inclusion_tests.py.
I was SHOCKED by how many mandates there are, and how many of them
libc++ wasn't conforming with.
Differential Revision: https://reviews.llvm.org/D99309
Arthur O'Dwyer [Tue, 6 Apr 2021 18:11:09 +0000 (14:11 -0400)]
[libc++] Post-commit review on D99928.
The "user-defined conversion by implicit constructor" codepath is already
handled by `B(int)`; we don't need to test `A(const A&)` a second time
via `DA` (nor the isomorphic case with `DB`).
We don't need `&` anywhere in this test.
Generally, `operator()` should be const; this test needn't be special.
(No functional change in test coverage.)
Christian Sigg [Tue, 6 Apr 2021 13:43:49 +0000 (15:43 +0200)]
[mlir] Remove no-op array assignment in dictionaryAttrSort().
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D99954
Jez Ng [Tue, 6 Apr 2021 19:09:14 +0000 (15:09 -0400)]
[lld-macho] Fix & refactor symbol size calculations
I noticed two problems with the previous implementation:
* N_ALT_ENTRY symbols weren't being handled correctly -- they should
determine the size of the previous symbol, even though they don't
cause a new section to be created
* The last symbol in a section had its size calculated wrongly;
the first subsection's size was used instead of the last one
I decided to take the opportunity to refactor things as well, mainly to
realize my observation
[here](https://reviews.llvm.org/D98837#inline-931511) that we could
avoid doing a binary search to match symbols with subsections. I think
the resulting code is a bit simpler too.
N Min Max Median Avg Stddev
x 20 4.31 4.43 4.37 4.3775 0.
034162922
+ 20 4.32 4.43 4.38 4.3755 0.
02799906
No difference proven at 95.0% confidence
Reviewed By: #lld-macho, alexshap
Differential Revision: https://reviews.llvm.org/D99972
Jez Ng [Tue, 6 Apr 2021 19:09:12 +0000 (15:09 -0400)]
[lld-macho][nfc] Remove HelpHidden from aliases to implemented flags
This is a no-op. Just cleaning up Options.td...
Reviewed By: #lld-macho, oontvoo
Differential Revision: https://reviews.llvm.org/D99874
Jez Ng [Tue, 6 Apr 2021 19:09:09 +0000 (15:09 -0400)]
[lld-macho][nfc] Rename some tests
"stub" is a bit too overloaded... we were using it to refer to
TAPI files, but it's also the name for the PLT trampolines in Mach-O.
Going ahead, let's just use "TAPI" or ".tbd" to refer to TAPI stuff.
Reviewed By: #lld-macho, oontvoo
Differential Revision: https://reviews.llvm.org/D99807
Thomas Preud'homme [Sun, 28 Mar 2021 00:03:37 +0000 (00:03 +0000)]
[MLIR, test] Fix use of undef FileCheck var
MLIR test Dialect/Linalg/transform-patterns.mlir tries to check for the
absence of a sequence of instructions with several CHECK-NOT with one of
those directives using a variable defined in another. However CHECK-NOT
are checked independently so that is using a variable defined in a
pattern that should not occur in the input.
This commit removes the dependency between those CHECK-NOT by replacing
occurences of variables by the regex that were used to define them.
Note to reviewers: please pay attention to whether the remaining
reference to l0 is correct. There was a l0 defined in those CHECK-NOT
and one defined before. I'm not sure what was the intent there.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D99957
Amy Kwan [Tue, 6 Apr 2021 17:25:53 +0000 (12:25 -0500)]
[PowerPC] Materialize 34-bit constants with pli directly
Previously, 34-bit constants were materialized in selectI64Imm(), and we relied
on td pattern matching to instead produce a pli. This becomes problematic as
there is no guarantee that the 34-bit constant will reach the td pattern
selection for pli. It is also possible for other transformations (such as complex
bit permutations) to also produce and utilize the 34-bit constant materialized
through selectI64Imm().
This patch instead produces pli on Power10 directly whenever the constant fits
within 34-bits.
Differential Revision: https://reviews.llvm.org/D99906
Fangrui Song [Tue, 6 Apr 2021 18:30:19 +0000 (11:30 -0700)]
[NewPM] Fix -Wunused-lambda-capture in -DLLVM_ENABLE_ASSERTIONS=off builds after D91327
Philip Reames [Tue, 6 Apr 2021 18:27:28 +0000 (11:27 -0700)]
More precisely type code used for gc.relocate assertions [nfc]
Jez Ng [Tue, 6 Apr 2021 18:05:15 +0000 (14:05 -0400)]
[lld-macho] clang-format cleanup
find . -type f -name "*.cpp" -o -name "*.h" | xargs clang-format -i
Jez Ng [Tue, 6 Apr 2021 17:58:37 +0000 (13:58 -0400)]
[lld-macho] Rename SubsectionMapping to SubsectionMap
We bikeshedded about it here: https://reviews.llvm.org/D98837#inline-931557
I initially suggested SubsectionMapping, but I thought the discussion
landed on doing `std::vector<SubsectionEntry>`. @alexshap went and did
both, but on hindsight I regret adding 3 more characters to an already
long name, and I think SubsectionEntry is descriptive enough...
This diff also renames `subsectionMap` to `subsecMap` for consistency
with other variable names in the codebase.