Louis Dionne [Wed, 9 Feb 2022 13:38:06 +0000 (08:38 -0500)]
[libc++] Avoid -Wmacro-redefined in libc++ headers in the legacy test config
serge-sans-paille [Wed, 9 Feb 2022 13:26:30 +0000 (08:26 -0500)]
Add missing MC includes in bolt/
Changes needed after
ef736a1c39f27ef4 that removes some implicit
dependencies from MrCV headers.
Nikita Popov [Wed, 9 Feb 2022 13:19:24 +0000 (14:19 +0100)]
[Bitcode] Fix size check for DIImportedEntity record
This was using && instead of ||.
Nikita Popov [Wed, 9 Feb 2022 13:14:04 +0000 (14:14 +0100)]
[Bitcode] Check minimum size of constant GEP record
Checking this early, because we may end up reading up to two
records before the operands.
Muhammad Omair Javaid [Wed, 9 Feb 2022 12:35:33 +0000 (17:35 +0500)]
[LLDB] Port toolchain-msvc.test for Arm/AArch4 Windows
This patch updates toolchain-msvc.test to cater for Arm64 windows platform.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D117676
Tong Zhang [Wed, 9 Feb 2022 11:51:57 +0000 (19:51 +0800)]
[X86] TCRETURNmi fix for 32bit platform
This fix is similar to
3cf3ffce240e("Fix the TCRETURNmi64 bug differently.")
after allocating register for index+base, we will only have one register left
This bug affects linux kernel compilation for x86 target. Error happens when compiling kmod_si476x_core.
clang complains:
error: ran out of registers during register allocation
The full command is:
clang -Wp,-MMD,drivers/mfd/.si476x-cmd.o.d -nostdinc -isystem /opt/toolchain/main/lib/clang/14.0.0/include -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -Qunused-arguments -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -no-integrated-as --prefix=/usr/bin/ -Werror=unknown-warning-option -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m32 -msoft-float -mregparm=3 -freg-struct-return -fno-pic -mstack-alignment=4 -march=atom -mtune=atom -mtune=generic -Wa,-mtune=generic32 -ffreestanding -Wno-sign-compare -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-address-of-packed-member -O2 -Wframe-larger-than=1024 -fno-stack-protector -Wno-format-invalid-specifier -Wno-gnu -mno-global-merge -Wno-unused-but-set-variable -Wno-unused-const-variable -fomit-frame-pointer -ftrivial-auto-var-init=pattern -fno-stack-clash-protection -falign-functions=32 -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-array-bounds -fno-strict-overflow -fno-stack-check -Werror=date-time -Werror=incompatible-pointer-types -Wno-initializer-overrides -Wno-format -Wno-sign-compare -Wno-format-zero-length -Wno-pointer-to-enum-cast -Wno-tautological-constant-out-of-range-compare -DKBUILD_MODFILE='"drivers/mfd/si476x-core"' -DKBUILD_BASENAME='"si476x_cmd"' -DKBUILD_MODNAME='"si476x_core"' -D__KBUILD_MODNAME=kmod_si476x_core -c -o drivers/mfd/si476x-cmd.o drivers/mfd/si476x-cmd.c
-------------
LLVM cannot compile the following code for x86 32bit target, the reason is tail call(TCRETURNmi) is using 2 registers for index+base and we want to use more than one registers for passing function args and that is impossible.
This fix is similar to
3cf3ffce240e("Fix the TCRETURNmi64 bug differently.").
We will only use tail call when it is using <=1 registers for passing args.
```
struct BIG_PARM {
int ver;
};
static struct {
int (*foo) (struct BIG_PARM* a, void *b);
int (*bar) (struct BIG_PARM* a);
int (*zoo0) (void);
int (*zoo1) (void);
int (*zoo2) (void);
int (*zoo3) (void);
int (*zoo4) (void);
} vtable[] = {
[0] = {
.foo = (int (*)(struct BIG_PARM* a, void *b))0xdeadbeef,
},
};
int something(struct BIG_PARM *a, void* b) {
return vtable[a->ver].foo(a,b);
}
```
```
$ clang -std=gnu89 -m32 -mregparm=3 -mtune=generic -fno-strict-overflow -O2 -c t0.c -o t0.c.o
error: ran out of registers during register allocation
1 error generated.
```
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D118312
Tim Northover [Wed, 9 Feb 2022 12:33:17 +0000 (12:33 +0000)]
Revert "X86: gate all vmovsh instructions on FP16 support."
This reverts commit
3fc40b6e6628cd3206d5aaf2bfb864add7d74fe1.
It was pushed unintentionally.
Tim Northover [Wed, 9 Feb 2022 11:42:36 +0000 (11:42 +0000)]
AArch64: do not use xzr for ldxp -> stxp dataflow.
If the result of a cmpxchg is unused, regalloc chooses `xzr` for the defs of
CMP_SWAP_128*. However, on the failure path this gets expanded to a LDXP ->
STXP to store the original value (to ensure no tearing occurred). This
unintentionally nulls out half of the value.
So instead use GPR64common for these defs, so regalloc has to choose a real
one.
Tim Northover [Mon, 7 Feb 2022 11:19:59 +0000 (11:19 +0000)]
X86: gate all vmovsh instructions on FP16 support.
Previously the `let Predicates = ...` line only applied to the rr version, and
so VMOVSH was being emitted whenever HasAVX512 (the default) applied. This is
not right.
Jay Foad [Wed, 9 Feb 2022 12:02:06 +0000 (12:02 +0000)]
[AMDGPU] Remove irrelevant comments on V_BFE_I32 instructions
These comments explain the encoding of the immediate operand of S_BFE_*
which is not relevant for V_BFE_I32.
Matthias Springer [Wed, 9 Feb 2022 11:55:25 +0000 (20:55 +0900)]
[mlir][bufferize] OpOperands can have multiple aliasing OpResults
This makes getAliasingOpResult symmetric to getAliasingOpOperand. The previous implementation was confusing for users and implemented in such a way only because there are currently no bufferizable ops that have multiple aliasing OpResults.
Differential Revision: https://reviews.llvm.org/D119259
Matthias Springer [Wed, 9 Feb 2022 11:44:02 +0000 (20:44 +0900)]
[mlir][linalg][bufferize] Print results of FuncOp read/write analysis
Print more information with test-analysis-only.
Differential Revision: https://reviews.llvm.org/D119118
OCHyams [Wed, 9 Feb 2022 11:32:29 +0000 (11:32 +0000)]
[cross-project-tests] Make GDB version string parsing more robust
Follow up to D118468 (
5257efdc5b30212b62a9d68857dc8e66d0e1a863).
When built from source, gdb's version string looks like this:
GNU gdb (GDB) 9.2
...
But for installed versions it looks different. E.g.
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
...
Use a regex rather than str.parition in the version string parsing in order to
handle this case too.
Pavel Labath [Wed, 9 Feb 2022 11:30:57 +0000 (12:30 +0100)]
[lldb] Restore original meaning to test_qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt
D119167 changed the meaning of that test by removing the use of the
interrupt packet. I did not notice this because the interrupting
happened in a shared utility function.
This patch restores the original meaning of the test, but (almost)
avoids sleeps by using process stdout to synchronize. Sadly, this means
the test stays disabled on windows, as it does not implement output
forwarding.
Simon Pilgrim [Wed, 9 Feb 2022 11:31:24 +0000 (11:31 +0000)]
[clang] Fix sphinx "start-string without end-string" warning
This looks to introduced in D110869
Simon Pilgrim [Wed, 9 Feb 2022 11:21:16 +0000 (11:21 +0000)]
[clang] Remove duplicate doc index for ClangLinkerWrapper
This looks to be a merge error from D118815
Lian Wang [Wed, 9 Feb 2022 11:16:35 +0000 (19:16 +0800)]
[RISCV][NFC] Remove useless code
Reviewed By: craig.topper, asb
Differential Revision: https://reviews.llvm.org/D119317
Florian Hahn [Wed, 9 Feb 2022 11:12:44 +0000 (11:12 +0000)]
[LV] Pass step to emitTransformedIndex (NFC).
Move out the induction step creation from emitTransformedIndex to the
callers. In some places (e.g. widenIntOrFpInduction) the step is already
created. Passing the step in ensures the steps are kept in sync.
Pavel Labath [Wed, 9 Feb 2022 11:01:30 +0000 (12:01 +0100)]
[lldb] Adjust windows xfails for D119167
A couple of additional tests pass with that patch. One new test fails
(because it's not testing a slightly different thing). I'll update it
later to restore the original meaning (I don't want to revert as the net
effect is still very positive), but for now this gets the bot green.
OCHyams [Wed, 9 Feb 2022 10:47:07 +0000 (10:47 +0000)]
[cross-project-tests] XFAIL llgdb-tests when gdb can't read clang's DWARF
Tests in the `cross-project-tests/debuginfo-tests/llgdb-tests` directory run
gdb on non-darwin platforms. gdb versions less than 10.1 cannot parse the DWARF
v5 emitted by clang, and DWARF v5 is now the default, so these tests fail on
Linux with gdb versions less than 10.1. This patch lets us XFAIL the tests
under these conditions.
Add `gdb-clang-incompatibility` to the `available_features` in
`cross-project-tests/lit.cfg.py` when clang's default DWARF version is 5 or
greater and the gdb (if found) version is less than 10.1.
Discourse discussion:
https://llvm.discourse.group/t/gdb-10-1-cant-read-clangs-dwarf-v5/6035
Reviewed By: jmorse
Differential Revision: https://reviews.llvm.org/D118468
Kirill Bobyrev [Wed, 9 Feb 2022 10:52:03 +0000 (11:52 +0100)]
[clang] Fix the tooling build after D119130
New StandardLibrary.cpp depends on Clang AST, add the dependency to
CMakeLists.txt
Broken builbot: https://lab.llvm.org/buildbot/#/builders/57/builds/14892
Sven van Haastregt [Wed, 9 Feb 2022 10:47:45 +0000 (10:47 +0000)]
[OpenCL] Fix atomic_fetch_add/sub with half type
An error in the tablegen description affects the declarations
provided by `-fdeclare-opencl-builtins` for `atomic_fetch_add` and
`atomic_fetch_sub`.
The atomic argument should be an atomic_half, not an atomic_float.
Benjamin Kramer [Wed, 9 Feb 2022 10:27:48 +0000 (11:27 +0100)]
[bazel] Sync llvm-config.h.cmake after
a1862d78eb45
Benjamin Kramer [Wed, 9 Feb 2022 10:25:33 +0000 (11:25 +0100)]
[bazel] Port 46a6f5a
Valentin Clement [Wed, 9 Feb 2022 10:21:27 +0000 (02:21 -0800)]
[flang][NFC] Reorder conversions
During upstreaming the alphabetical order was not respected.
Sheng [Wed, 9 Feb 2022 10:22:01 +0000 (18:22 +0800)]
[NFC] test commit
Empty test commit, check commit access
Haojian Wu [Mon, 7 Feb 2022 14:21:45 +0000 (15:21 +0100)]
[pseudo] Implement LRGraph
LRGraph is the key component of the clang pseudo parser, it is a
deterministic handle-finding finite-state machine, which is used to
generated the LR parsing table.
Separate from https://reviews.llvm.org/D118196.
Differential Revision: https://reviews.llvm.org/D119172
Matthias Springer [Wed, 9 Feb 2022 10:14:42 +0000 (19:14 +0900)]
[mlir][linalg][bufferize][NFC] Allow passing custom BufferizationOptions to pass
Differential Revision: https://reviews.llvm.org/D118891
serge-sans-paille [Tue, 8 Feb 2022 14:32:21 +0000 (15:32 +0100)]
Cleanup LLVMMC headers
There's a few relevant forward declarations in there that may require downstream
adding explicit includes:
llvm/MC/MCContext.h no longer includes llvm/BinaryFormat/ELF.h, llvm/MC/MCSubtargetInfo.h, llvm/MC/MCTargetOptions.h
llvm/MC/MCObjectStreamer.h no longer include llvm/MC/MCAssembler.h
llvm/MC/MCAssembler.h no longer includes llvm/MC/MCFixup.h, llvm/MC/MCFragment.h
Counting preprocessed lines required to rebuild llvm-project on my setup:
before:
1052436830
after:
1049293745
Which is significant and backs up the change in addition to the usual benefits of
decreasing coupling between headers and compilation units.
Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D119244
serge-sans-paille [Wed, 9 Feb 2022 08:53:00 +0000 (09:53 +0100)]
Prepare for LLVMMC headers cleanup
Be more explicit about which headers should be included in MC files generated by
tblgen.
See also: https://reviews.llvm.org/D119244
Bill Wendling [Wed, 9 Feb 2022 10:05:13 +0000 (02:05 -0800)]
[X86] Specify Undef for the registers we xor
Fixes expensive check failures from D110869.
Kirill Bobyrev [Wed, 9 Feb 2022 10:05:58 +0000 (11:05 +0100)]
[llvm] Add IWYU pragmas to GTest
This will allow using tools like Include-What-You-Use and clangd
IncludeCleaner. The tools will correctly identify the public headers
responsible for importing symbols in the testing code.
This is a backport of https://github.com/google/googletest/commit/
100f6fbf5f81a82d163c1e29735e8a2936eacd4f
The only untouched file from that patch is
googletest/include/gtest/gtest_prod.h because the change is unrelated.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D119320
Kirill Bobyrev [Wed, 9 Feb 2022 10:04:58 +0000 (11:04 +0100)]
[clangd] NFC: Move stdlib headers handling to Clang
This will allow moving the IncludeCleaner library essentials to Clang
and decoupling them from the majority of clangd.
The patch itself just moves the code, it doesn't change existing
functionality.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D119130
Pavel Labath [Mon, 7 Feb 2022 19:04:42 +0000 (20:04 +0100)]
[lldb/test] Remove sleeps from some lldb-server tests
Instead of using sleeps, have the inferior notify us (via a trap opcode) that
the requested number of threads have been created.
This allows us to get rid of some fairly dodgy test utility code --
wait_for_thread_count seemed like it was waiting for the threads to
appear, but it never actually let the inferior run, so it only succeeded
if the threads were already started when the function was called. Since
the function was called after a fairly small delay (1s, usually), this
is probably the reason why the tests were failing on some bots.
Differential Revision: https://reviews.llvm.org/D119167
Matthias Springer [Wed, 9 Feb 2022 09:55:28 +0000 (18:55 +0900)]
[mlir][bufferize][NFC] Make PostAnalysisSteps a function
They used to be classes with a virtual `run` function. This was inconvenient because post analysis steps are stored in BufferizationOptions. Because of this design choice, BufferizationOptions were not copyable.
Differential Revision: https://reviews.llvm.org/D119258
Diana Picus [Wed, 26 Jan 2022 09:08:49 +0000 (09:08 +0000)]
[flang] Add runtime interface for GET_COMMAND
Use a single entry point with several optional parameters.
Differential Revision: https://reviews.llvm.org/D118776
Kiran Chandramohan [Tue, 8 Feb 2022 23:01:39 +0000 (23:01 +0000)]
[Flang] Add support for lowering the goto statement
This patch adds support for lowering the Fortran goto statement from
parse-tree to MLIR. The goto statement in Fortran is a form of
unstructured control flow. The statement transfers control to the
code starting at the label specified in the statement. This can be
faithfully represented in MLIR by a branch instruction.
To assist the lowering of code with unstructured control flow, blocks
are created in advance and associated with the relevant pre-fir tree
evaluations.
This is part of the upstreaming effort from the fir-dev branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project
Reviewed By: clementval, vdonaldson, schweitz, awarzynski
Differential Revision: https://reviews.llvm.org/D118983
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Muhammad Omair Javaid [Wed, 9 Feb 2022 09:26:15 +0000 (14:26 +0500)]
Set LLVM_FORCE_USE_OLD_TOOLCHAIN to disable VS2019 checks
VS2019 version 1920 in now the default and get tested in
llvm/include/llvm/Support/Compiler.h. This patch propagates
LLVM_FORCE_USE_OLD_TOOLCHAIN macro to disable testing for VS2019.
Differential Revision: https://reviews.llvm.org/D114639
Roman Lebedev [Wed, 9 Feb 2022 09:27:01 +0000 (12:27 +0300)]
ProfileDataTests: fix BUILD_SHARED_LIBS build
Balazs Benics [Wed, 9 Feb 2022 09:22:28 +0000 (10:22 +0100)]
[analyzer][docs][NFC] Fix some broken links and some cosmetic changes
- We should report bugs to the GitHub Issues
- We should advocate using Discourse instead of the superseded cfe-dev
mailing list.
There are a couple of other cosmetic changes such as preferring `using`
instead of `typedef` and quoting the `-analyze-function` parameter's
payload for escaping the braces.
Thanks @loic-joly-sonarsource for reporting this on Discord!
Reviewed By: NoQ, Szelethus
Differential Revision: https://reviews.llvm.org/D119245
Nikita Popov [Wed, 2 Feb 2022 14:06:01 +0000 (15:06 +0100)]
Reapply [sanitizers] Avoid macro clash in SignalContext::WriteFlag (NFC)
D116208 may cause a macro clash on older versions of linux, where
fs.h defines a READ macro. This is resolved by switching to a more
typical casing style for non-macro symbols.
Reapplying with changes to the symbol names in various platform
specific code, which I missed previously.
Differential Revision: https://reviews.llvm.org/D118783
Nikolas Klauser [Tue, 8 Feb 2022 23:07:14 +0000 (00:07 +0100)]
[libc++] Add papers from February 2022 plenary meeting
Reviewed By: ldionne, Quuxplusone, #libc
Spies: arichardson, libcxx-commits
Differential Revision: https://reviews.llvm.org/D119189
Valentin Clement [Wed, 9 Feb 2022 09:07:21 +0000 (10:07 +0100)]
[flang] Add missing CFI case for REAL and COMPLEX
ISO_Fortran_binding.h was updated with missing entries for CFI
types for REAL and COMPLEX kinds 2,3,10,16. This patch updates TypeCode.h
to use these new types.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D119283
Nikita Popov [Wed, 9 Feb 2022 09:06:56 +0000 (10:06 +0100)]
Revert "[sanitizers] Avoid macro clash in SignalContext::WriteFlag (NFC)"
This reverts commit
fda29264f360820859587acdfb0ad9392c944bd6.
This breaks the sanitizer build on windows, will reapply with
additional changes.
Qiu Chaofan [Wed, 9 Feb 2022 08:46:51 +0000 (16:46 +0800)]
[NFC] Fix SSE3 intrinsics test for PowerPC
Previous test in ppc-pmmintrin.c did not check IR of intrinsic function
definition. Add them and simplify.
These tests shouldn't be auto-generated, because we don't want to check
wrapper functions.
Muhammad Omair Javaid [Tue, 8 Feb 2022 15:25:41 +0000 (20:25 +0500)]
[clang-cl] Bump default -fms-compatibility-version to 19.14
clang-cl MSVC required version is 19.20 now. Update the default
-fms-compatibility-version to 19.14.
Differential Revision: https://reviews.llvm.org/D114639
RVP [Tue, 8 Feb 2022 15:06:53 +0000 (16:06 +0100)]
[Support] Fix for two issues with clearing of the internal storage for cl::bits
This patch fixes two issues with clearing of the internal storage for cl::bits
1. The internal bits storage for cl::bits is uninitialized. This is a problem if a cl::bits option is not defined with static lifetime.
2. ResetAllOptionOccurrences does not reset cl::bits options.
The latter is also discussed in:
https://lists.llvm.org/pipermail/llvm-dev/2021-February/148299.html
Differential Revision: https://reviews.llvm.org/D119066
Nikita Popov [Wed, 2 Feb 2022 14:06:01 +0000 (15:06 +0100)]
[sanitizers] Avoid macro clash in SignalContext::WriteFlag (NFC)
D116208 may cause a macro clash on older versions of linux, where
fs.h defines a READ macro. This is resolved by switching to a more
typical casing style for non-macro symbols.
Differential Revision: https://reviews.llvm.org/D118783
Nikita Popov [Tue, 8 Feb 2022 11:20:08 +0000 (12:20 +0100)]
[NVPTX] Remove image/sampler special case in call lowering
I suspect that this is dead code. There is no test coverage for
this special case, and the struct type names this checks against
don't seem to match what OpenCL actually generates (which would be
%opencl.sampler_t rather than %struct._sampler_t for example).
Motivation for this change is that this code is incompatible with
opaque pointers -- simply deleting it is the simplest way of
making it compatible :)
Differential Revision: https://reviews.llvm.org/D119229
Andrzej Warzynski [Thu, 3 Feb 2022 17:00:27 +0000 (17:00 +0000)]
[flang][driver] Add support for `-emit-mlir`
This patch adds support for generating MLIR files in Flang's frontend
driver (i.e. `flang-new -fc1`). `-emit-fir` is added as an alias for
`-emit-mlir`. We may want to decide to split the two in the future.
A new parent class for code-gen frontend actions is introduced:
`CodeGenAction`. We will be using this class to encapsulate logic shared
between all code-generation actions, but not required otherwise. For
now, it will:
* run prescanning, parsing and semantic checks,
* lower the input to MLIR.
`EmitObjAction` is updated to inherit from this class. This means that
the behaviour of `flang-new -fc1 -emit-obj` is also updated (previously,
it would just exit immediately). This change required
`flang/test/Driver/syntax-only.f90` to be updated.
For `-emit-fir`, a specialisation of `CodeGenAction` is introduced:
`EmitMLIRAction`. The key logic for this class is implemented in
`EmitMLIRAction::ExecuteAction`.
Differential Revision: https://reviews.llvm.org/D118985
Nikita Popov [Fri, 28 Jan 2022 16:22:58 +0000 (17:22 +0100)]
[ArgPromotion] Make implementation offset based
This rewrites ArgPromotion to be based on offsets rather than GEP
structure. We inspect all loads at constant offsets and remember
which types are loaded at which offsets. Then we promote based on
those types.
This generalizes ArgPromotion to work with bitcasted loads, and
is compatible with opaque pointers.
This patch also fixes incorrect handling of alignment during
argument promotion. Previously, the implementation only checked
that the pointer is dereferenceable, but was happy to speculate
overaligned loads. (I would have fixed this separately in advance,
but I found this hard to do with the previous implementation
approach).
Differential Revision: https://reviews.llvm.org/D118685
Jean Perier [Wed, 9 Feb 2022 08:28:27 +0000 (09:28 +0100)]
[flang] catch implicit interface incompatibility with global scope symbol
Previously, when calling a procedure implicitly for which a global scope
procedure symbol with the same name existed, semantics resolved the
procedure name in the call to the global symbol without checking that
the symbol interface was compatible with the implicit interface of the
call.
This could cause expression rewrite and lowering to later badly process
the implicit call assuming a different result type or an explicit
interface. This could lead to lowering crash in case the actual argument
were incompatible with the dummies from the explicit interface.
Emit errors in the following problematic cases:
- If the result type from the symbol did not match the one from the
implicit interface.
- If the symbol requires an explicit interface.
This patch still allows calling an F77 like procedure with different
actual argument types than the one it was defined with because it is
correctly supported in lowering and is a feature in some program
(it is a pointer cast). The two cases that won't be accepted have
little chance to make much sense. Results returning ABIs may differ
depending on the return types, and function that requires explicit
interface usually requires descriptors or specific processing that
is incompatible with implicit interfaces.
Note that this patch is not making a deep analysis, and it will only
catch mistakes if a global symbol and an implicit interface are
involved. Cases where the user provided a conflicting explicit
interface would still require a pass after name resolution to study
conflicts more deeply. But these cases will not crash lowering or
trigger expression rewrite to do weird things.
Differential Revision: https://reviews.llvm.org/D119274
Rainer Orth [Wed, 9 Feb 2022 08:20:21 +0000 (09:20 +0100)]
[Sanitizers][test] XFAIL long double tests on Solaris/sparc
As reported in Issue #41838, `clang` doesn't correctly implement `long
double` on 32-bit Solaris/SPARC: the psABI requires this to be an 128-bit
type. Four sanitizer tests currently `FAIL` for this reason.
While there is a WIP patch to fix `clang` (D89130
<https://reviews.llvm.org/D89130>), it isn't complete yet and I've hit so
many brick walls while trying to finish it that I'm unsure if I ever will.
This patch therefore `XFAIL`s those tests in the meantime.
Tested on `sparcv9-sun-solaris2.11`.
Differential Revision: https://reviews.llvm.org/D119016
Haojian Wu [Fri, 4 Feb 2022 12:54:55 +0000 (13:54 +0100)]
[pseudo] Add first and follow set computation in Grammar.
These will be used when building parsing table for LR parsers.
Separate from https://reviews.llvm.org/D118196.
Differential Revision: https://reviews.llvm.org/D118990
Rainer Orth [Wed, 9 Feb 2022 08:15:41 +0000 (09:15 +0100)]
[sanitizer_common] Don't try to unmap unaligned memory
Enabling `sanitizer_common` tests on Solaris (D91606
<https://reviews.llvm.org/D91606>) and SPARC (D91608
<https://reviews.llvm.org/D91608>) uncovered a sparcv9 failure
SanitizerCommon-Unit :: ./Sanitizer-sparcv9-Test/CompactRingBuffer.int64
like this:
[ RUN ] CompactRingBuffer.int64
==24576==ERROR: SanitizerTool failed to deallocate 0x2000 (8192) bytes at address 0xffffffff7f59b000
==24576==Sanitizer CHECK failed: /vol/llvm/src/llvm-project/local/compiler-rt/lib/sanitizer_common/sanitizer_posix.cpp:61 (("unable to unmap" && 0)) != (0) (0, 0)
The problem is that the original allocation via
`MmapAlignedOrDieOnFatalError` is for 4 kB, but the Solaris/sparcv9
pagesize is 8 kB. So the initial allocation is for 12 kB, rounded to a
multiple of the pagesize. Afterwards, the unneeded rest is unmapped again,
but this fails since the address is not pagesize-aligned.
This patch avoids this by aligning the end of the mapping to the pagesize.
With D91827 <https://reviews.llvm.org/D91827> added, the test `PASS`es on
`sparcv9-sun-solaris2.11`.
Differential Revision: https://reviews.llvm.org/D91615
Rainer Orth [Wed, 9 Feb 2022 08:12:02 +0000 (09:12 +0100)]
[sanitizer_common] Fix DenseMapCustomTest.DefaultMinReservedSizeTest on SPARC
As described in Issue #53523, the
`DenseMapCustomTest.DefaultMinReservedSizeTest` test FAILs on Solaris/SPARC
(both 32 and 64-bit):
/vol/llvm/src/llvm-project/local/compiler-rt/lib/sanitizer_common/tests/sanitizer_dense_map_test.cpp:399:
Failure
Expected: (MemorySize) != (Map.getMemorySize()), actual: 8192 vs 8192
This happens because SPARC, unlike many other CPUs, uses an 8 kB pagesize.
Fixed by incorporating the pagesize into the calculations of
`ExpectedInitialBucketCount` and derived values.
Tested on `sparcv9-sun-solaris2.11`, `amd64-pc-solaris2.11`, and
`x86_64-pc-linux-gnu`.
Differential Revision: https://reviews.llvm.org/D118771
Tobias Hieta [Tue, 8 Feb 2022 08:26:09 +0000 (09:26 +0100)]
[llvm-rc]: Find <target>-clang over just clang
This patch makes llvm-rc/windres prefer <target>-clang over
clang when doing it's preprocessing. This is so that we can
have a .cfg file for <target> and configure sysroot and other
important flags.
Config files not picked up with clang --target=<target>
automatically.
We only look for <target>-clang in the same dir as llvm-windres
and not for all PATHs to minimize the change.
Reviewed By: mstorsjo
Differential Revision: https://reviews.llvm.org/D119219
Fraser Cormack [Tue, 1 Feb 2022 14:22:33 +0000 (14:22 +0000)]
[RISCV] Select unmasked RVV pseudos in a DAG post-process
This patch drops TableGen patterns matching all-ones masked RVV pseudos
in the case where there are fallback patterns matching the generic
masked forms to "_MASK" pseudos. This optimization is now performed with
a SelectionDAG post-processing step which peephole-optimizes these same
pseudos with all-ones masks and swaps them out to their unmasked
pseudos.
This cuts our generated ISel table down by around ~5% (~110kB) in lieu
of a far smaller auto-generated table to help with the peephole.
This only targets our custom RISCVISD::*_VL binary operator nodes, which
use the one form for both masked and unmasked variants. A similar
approach could be used for our intrinsics but we'd need to do some work,
e.g., to represent unmasked intrinsics as true-masked intrinsics at the
IR or ISel level. At a rough estimate, this could save us a further 9%
on the size of our ISel table for the binary intrinsic patterns alone.
There is no observable impact on our tests.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D118810
Saiyedul Islam [Tue, 8 Feb 2022 16:30:09 +0000 (16:30 +0000)]
[OpenMP][Clang] Move partial support of reverse offload to a future version
OpenMP Spec 5.2 requires unimplemented requires clauses to produce
compile time error termination. Moving current partial support of
reverse_offload to a distant future version 9.9 so that existing
code can be tested and maintained until a complete implementation
is available.
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D119256
Fangrui Song [Wed, 9 Feb 2022 05:45:55 +0000 (21:45 -0800)]
[ELF] --warn-backrefs: suppress warnings for backward references within the archive
Jonas Devlieghere [Tue, 8 Feb 2022 21:27:29 +0000 (13:27 -0800)]
[llvm] Recognize arm64 as target-aarch64 in lit
Recognize arm64 triples as AArch64 so we can XFAIL/skip tests using
target-aarch64.
Differential revision: https://reviews.llvm.org/D119169
Fangrui Song [Wed, 9 Feb 2022 04:54:52 +0000 (20:54 -0800)]
[docs] Re-generate ClangCommandLineReference.rst
Sameer Sahasrabuddhe [Wed, 9 Feb 2022 03:12:54 +0000 (22:12 -0500)]
[AMDGPU] [NFC] Fix incorrect use of bitwise operator.
Differential Revision: https://reviews.llvm.org/D119308
Yaxun (Sam) Liu [Fri, 4 Feb 2022 19:19:23 +0000 (14:19 -0500)]
[HIP] Emit amdgpu_code_object_version module flag
code object version determines ABI, therefore should not be mixed.
This patch emits amdgpu_code_object_version module flag in LLVM IR
based on code object version (default 4).
The amdgpu_code_object_version value is code object version times 100.
LLVM IR with different amdgpu_code_object_version module flag cannot
be linked.
The -cc1 option -mcode-object-version=none is for ROCm device library use
only, which supports multiple ABI.
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/D119026
Zakk Chen [Tue, 8 Feb 2022 15:42:48 +0000 (07:42 -0800)]
[RISCV][NFC] Refactor RISCVISAInfo.
1. Remove computeDefaultABIFromArch and add computeDefaultABI in
RISCVISAInfo.
2. Add parseFeatureBits which may used in D118333.
Differential Revision: https://reviews.llvm.org/D119250
jacquesguan [Tue, 18 Jan 2022 08:56:06 +0000 (16:56 +0800)]
[RISCV] Add patterns for vector widening floating-point fused multiply-add instructions
Add patterns for vector widening floating-point fused multiply-add instructions.
Differential Revision: https://reviews.llvm.org/D117546
Jon Roelofs [Wed, 9 Feb 2022 02:09:52 +0000 (18:09 -0800)]
[docs] Document -ffinite-math-only, -fhonor-{infinities,infinites,nans}
Bill Wendling [Wed, 9 Feb 2022 01:40:59 +0000 (17:40 -0800)]
[X86] Implement -fzero-call-used-regs option
The "-fzero-call-used-regs" option tells the compiler to zero out
certain registers before the function returns. It's also available as a
function attribute: zero_call_used_regs.
The two upper categories are:
- "used": Zero out used registers.
- "all": Zero out all registers, whether used or not.
The individual options are:
- "skip": Don't zero out any registers. This is the default.
- "used": Zero out all used registers.
- "used-arg": Zero out used registers that are used for arguments.
- "used-gpr": Zero out used registers that are GPRs.
- "used-gpr-arg": Zero out used GPRs that are used as arguments.
- "all": Zero out all registers.
- "all-arg": Zero out all registers used for arguments.
- "all-gpr": Zero out all GPRs.
- "all-gpr-arg": Zero out all GPRs used for arguments.
This is used to help mitigate Return-Oriented Programming exploits.
Reviewed By: nickdesaulniers
Differential Revision: https://reviews.llvm.org/D110869
Richard Smith [Wed, 9 Feb 2022 01:25:06 +0000 (17:25 -0800)]
[cxx_status] Add a couple of Feb 2022 library papers that need compiler support.
LLVM GN Syncbot [Wed, 9 Feb 2022 01:18:18 +0000 (01:18 +0000)]
[gn build] Port
216575e58102
Nico Weber [Wed, 9 Feb 2022 01:17:32 +0000 (20:17 -0500)]
[gn build] (manually) port
216575e5810
Nico Weber [Wed, 9 Feb 2022 01:16:19 +0000 (20:16 -0500)]
[gn build] (manually) port
4a6553f4c2be some more
Mircea Trofin [Wed, 9 Feb 2022 00:53:36 +0000 (16:53 -0800)]
[nfc][mlgo][regalloc] Add the url to a reference pre-trained model
Nico Weber [Wed, 9 Feb 2022 00:55:18 +0000 (19:55 -0500)]
[gn build] (manually) port
817d897b57c7 (LIBCXX_ABI_UNSTABLE)
Alexander Yermolovich [Tue, 8 Feb 2022 23:24:29 +0000 (15:24 -0800)]
[BOLT][DWARF] Remove caching of ranges/abbrevs
Removing caching of ranges/abbrevs to simplify the code.
Before we were doing it to get around a gdb limitation.
FBD34015613
Reviewed By: Amir, maksfb
Differential Revision: https://reviews.llvm.org/D119276
Matt Arsenault [Sat, 15 Aug 2020 16:07:29 +0000 (12:07 -0400)]
GlobalISel: Constant fold G_PTR_ADD
Some globals lower to literal addresses on AMDGPU.
This may be wrong for non-integral address spaces. I'm wondering if we
should just allow regular G_ADD to use pointer types, and reserve
G_PTR_ADD for non-integral address spaces.
Alexandre Ganea [Tue, 8 Feb 2022 22:39:13 +0000 (17:39 -0500)]
[LLD] Fix issue in HIP due to unspecified order of evaluation of the function object
This fixes the issue raised in https://reviews.llvm.org/D108850#3303452
Before C++17, the function object is evaluated in a unspecified order. In the following example: https://godbolt.org/z/8ao4vdsr7 the function object is either evaluated before or after the arguments, depending on the compiler. With MSVC and /std:c++14 the function object is evaluated after the arguments; with clang and gcc, it is evaluated before. With C++17, the function object is guaranteed to be evaluated before the arguments, see: https://riptutorial.com/cplusplus/example/19369/evaluation-order-of-function-arguments
In our case, the issue was that the `args` conversion to `ArrayRef` was evaluated before the lambda call `link`, which internally was calling `parseFlavor()`, which in turned modified `args`. We ended with an `ArrayRef` argument that reflected the previous contents of `args`.
Add coverage for `-flavor` which we didn't have before.
Differential Revision: https://reviews.llvm.org/D119278
Alexandre Ganea [Tue, 8 Feb 2022 22:36:14 +0000 (17:36 -0500)]
[MLIR] Temporary workaround for calling the LLD ELF driver as-a-lib
This fixes the situation described in https://github.com/llvm/llvm-project/issues/53475 with a repro exposed by https://github.com/ROCmSoftwarePlatform/D108850-lld-bug-reproduction
This is purposely just a workaround to unblock users. This could be transplanted to the release/14.x branch if need be. A proper fix will later be provided in https://reviews.llvm.org/D119049.
Differential Revision: https://reviews.llvm.org/D119277
tyb0807 [Wed, 9 Feb 2022 00:08:18 +0000 (00:08 +0000)]
Revert "[AArch64] ACLE feature macro for Armv8.8-A MOPS"
This reverts commit
d379ec99085e33ace51740f2b93bda5e5c72326f.
Joe Loser [Tue, 8 Feb 2022 00:53:45 +0000 (19:53 -0500)]
[libc++] Remove outdated synopsis parts in experimental/functional
Remove mentions of `experimental::function`, its operators, etc. They are no
longer in `experimental/functional`.
Differential Revision: https://reviews.llvm.org/D119204
Snehasish Kumar [Tue, 8 Feb 2022 23:45:34 +0000 (15:45 -0800)]
[memprof] Add LLVM_DEBUG for unused var in RawMemProfReader.cpp.
The ContainingSegment variable is only used to check whether we found
the address at this time. When building without Asserts this emits a
warning. So for now wrap this code in LLVM_DEBUG to avoid the warning.
Matt Arsenault [Sun, 21 Mar 2021 00:13:01 +0000 (20:13 -0400)]
GlobalISel: Constant fold FP bin ops in MIRBuilder
Might as well handle these if we're going to handle the integer ops
here.
Matt Arsenault [Sat, 20 Mar 2021 23:01:08 +0000 (19:01 -0400)]
GlobalISel: Constant fold integer min/max opcodes
Krzysztof Parzyszek [Tue, 8 Feb 2022 23:26:12 +0000 (15:26 -0800)]
[Hexagon] Fix operation actions for v128f16
There were more cases of operations that should have been "Custom" for
v128f16, but ended up "Legal" (e.g. load and store).
Mogball [Tue, 8 Feb 2022 23:03:23 +0000 (23:03 +0000)]
[mlir][ods] Attribute and type formats: support whitespaces
Supports whitespace elements: ` ` and `\\n` as well as the "empty" whitespace `` that removes an otherwise printed space.
Depends on D118208
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D118210
Matt Arsenault [Sat, 20 Mar 2021 15:25:49 +0000 (11:25 -0400)]
GlobalISel: Add FoldBinOpIntoSelect combine
This will do the combine in cases that should fold, but don't
now. e.g. we're relying on the CSEMIRBuilder's incomplete constant
folding. For instance it doesn't handle FP operations or vectors (and
we don't have separate constant folding combines either to catch
them).
Matt Arsenault [Sat, 20 Mar 2021 22:19:09 +0000 (18:19 -0400)]
AMDGPU/GlobalISel: Add baseline test for binop fold into select combine
Daniel Thornburgh [Fri, 21 Jan 2022 00:13:52 +0000 (00:13 +0000)]
[Symbolizer] Add Build ID flag to llvm-symbolizer.
This adds a --build-id=<hex build ID> flag to llvm-symbolizer. If --obj
is unspecified, this will attempt to look up the provided build ID using
whatever mechanisms are available to the Symbolizer (typically,
debuginfod). The semantics are then as if the found binary were given
using the --obj flag.
Reviewed By: jhenderson, phosek
Differential Revision: https://reviews.llvm.org/D118633
Jacques Pienaar [Tue, 8 Feb 2022 23:00:39 +0000 (15:00 -0800)]
[mlir][math] Expand coverage of atan2 expansion
Reuse the higher precision F32 approximation for the F16 one (by expanding and
truncating). This is partly RFC as I'm not sure what the expectations are here
(e.g., these are only for F32 and should not be expanded, that reusing
higher-precision ones for lower precision is undesirable due to increased
compute cost and only approximations per exact type is preferred, or this is
appropriate [at least as fallback] but we need to see how to make it more
generic across all the patterns here).
Differential Revision: https://reviews.llvm.org/D118968
Casey Carter [Thu, 30 Dec 2021 00:02:45 +0000 (16:02 -0800)]
[libcxx][test] Disable bad unique_ptr<T[]> to shared_ptr<U[]> conversion test cases
for non-libc++. I've reported allowance of these conversions as a bug at https://llvm.org/PR53368.
Differential Revision: https://reviews.llvm.org/D117996
Casey Carter [Sat, 22 Jan 2022 20:41:30 +0000 (12:41 -0800)]
[libcxx][test] tests for strengthened `noexcept` are non-portable
Differential Revision: https://reviews.llvm.org/D117966
Fangrui Song [Tue, 8 Feb 2022 22:48:34 +0000 (14:48 -0800)]
[sanitizer] Guard the whole ThreadDescriptorSize block with #if !SANITIZER_GO after D119007
The SANITIZER_GO code path reports an undefined symbol error for dlsym.
```
FAILED: projects/compiler-rt/lib/tsan/rtl/CMakeFiles/GotsanRuntimeCheck /tmp/RelA/projects/compiler-rt/lib/tsan/rtl/CMakeFiles/GotsanRuntimeCheck
```
Nikolas Klauser [Mon, 7 Feb 2022 20:54:49 +0000 (21:54 +0100)]
[libc++] Prepare string.{access, capacity, cons} tests for constexpr
Reviewed By: ldionne, #libc
Spies: libcxx-commits, arphaman
Differential Revision: https://reviews.llvm.org/D119123
Ahmed Bougacha [Tue, 8 Feb 2022 21:33:39 +0000 (13:33 -0800)]
[clang] Document objc_unsafeClaimAutoreleasedReturnValue.
This has been added a few years ago but wasn't listed here.
Ahmed Bougacha [Tue, 8 Feb 2022 21:29:49 +0000 (13:29 -0800)]
[clang][Driver] Use a VersionTuple for darwin linker version checks.
This unifies a couple spots that did it manually by checking the
flag directly.
It does mean that we're now dropping the 5th component, but that's
not used in any of these checks, and to my knowledge it's never been
used in ld64.
Benjamin Kramer [Tue, 8 Feb 2022 22:01:04 +0000 (23:01 +0100)]
[bazel] Port
216575e58102
Siva Chandra Reddy [Tue, 8 Feb 2022 17:09:12 +0000 (17:09 +0000)]
[libc][Obvious] Fix typo in mkdir and mkdirat implementations.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D119265
Sylvestre Ledru [Tue, 8 Feb 2022 20:54:32 +0000 (21:54 +0100)]
README: Point to the discourse & discord forums
Differential Revision: https://reviews.llvm.org/D119279
Snehasish Kumar [Fri, 4 Feb 2022 19:11:47 +0000 (11:11 -0800)]
Revert "Revert "[ProfileData] Read and symbolize raw memprof profiles.""
This reverts commit
dbf47d227d080e4eb7239b589660f51d7b08afa9.
Reapply https://reviews.llvm.org/D116784 now that
https://reviews.llvm.org/D118413 has landed with a couple of fixes:
* fix raw profile reader unaligned access identified by ubsan
* fix windows build by using MOCK_CONST_METHOD3 instead of MOCK_METHOD.
Arthur Eubanks [Thu, 3 Feb 2022 19:56:20 +0000 (11:56 -0800)]
[test] Remove -fno-experimental-new-pass-manager -O1 from sanitize-address-field-padding.cpp
-O1 doesn't seem necessary here.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D118936