Commit Graph

414292 Commits

Author SHA1 Message Date
Lian Wang af2cd94555 [RISCV][NFC] Remove useless code
Reviewed By: craig.topper, asb

Differential Revision: https://reviews.llvm.org/D119317
2022-02-09 19:17:25 +08:00
Florian Hahn 8aa122081f
[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.
2022-02-09 11:12:45 +00:00
Pavel Labath 9e6995957a [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.
2022-02-09 12:04:13 +01:00
OCHyams 5257efdc5b [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
2022-02-09 10:53:35 +00:00
Kirill Bobyrev e3ba831937
[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
2022-02-09 11:52:03 +01:00
Sven van Haastregt fe690587be [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.
2022-02-09 10:47:45 +00:00
Benjamin Kramer 356705f94f [bazel] Sync llvm-config.h.cmake after a1862d78eb 2022-02-09 11:28:25 +01:00
Benjamin Kramer 079d847a9a [bazel] Port 46a6f5a 2022-02-09 11:28:24 +01:00
Valentin Clement 0b626df1bc
[flang][NFC] Reorder conversions
During upstreaming the alphabetical order was not respected.
2022-02-09 11:27:23 +01:00
Sheng 01f19cd296 [NFC] test commit
Empty test commit, check commit access
2022-02-09 18:22:01 +08:00
Haojian Wu f1984b1433 [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
2022-02-09 11:20:07 +01:00
Matthias Springer f30ec8f627 [mlir][linalg][bufferize][NFC] Allow passing custom BufferizationOptions to pass
Differential Revision: https://reviews.llvm.org/D118891
2022-02-09 19:15:31 +09:00
serge-sans-paille ef736a1c39 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
2022-02-09 11:09:17 +01:00
serge-sans-paille 33986970a4 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
2022-02-09 11:09:16 +01:00
Bill Wendling d295a53a92 [X86] Specify Undef for the registers we xor
Fixes expensive check failures from D110869.
2022-02-09 02:06:12 -08:00
Kirill Bobyrev 76b855d845 [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 100f6fbf5f

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
2022-02-09 11:05:59 +01:00
Kirill Bobyrev 46a6f5ae14 [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
2022-02-09 11:05:39 +01:00
Pavel Labath 5a4fe166d1 [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
2022-02-09 11:05:02 +01:00
Matthias Springer cdb7675c26 [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
2022-02-09 18:56:06 +09:00
Diana Picus 50bccf2297 [flang] Add runtime interface for GET_COMMAND
Use a single entry point with several optional parameters.

Differential Revision: https://reviews.llvm.org/D118776
2022-02-09 09:49:03 +00:00
Kiran Chandramohan ae37bb9804 [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>
2022-02-09 09:48:13 +00:00
Muhammad Omair Javaid a1862d78eb 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
2022-02-09 14:31:37 +05:00
Roman Lebedev 3564551400
ProfileDataTests: fix BUILD_SHARED_LIBS build 2022-02-09 12:27:13 +03:00
Balazs Benics 5e0be95fce [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
2022-02-09 10:22:28 +01:00
Nikita Popov 36cae4299d 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
2022-02-09 10:22:05 +01:00
Nikolas Klauser a5b4479d3c [libc++] Add papers from February 2022 plenary meeting
Reviewed By: ldionne, Quuxplusone, #libc

Spies: arichardson, libcxx-commits

Differential Revision: https://reviews.llvm.org/D119189
2022-02-09 10:21:19 +01:00
Valentin Clement 903f6b7170
[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
2022-02-09 10:07:40 +01:00
Nikita Popov 34840c1a7d Revert "[sanitizers] Avoid macro clash in SignalContext::WriteFlag (NFC)"
This reverts commit fda29264f3.

This breaks the sanitizer build on windows, will reapply with
additional changes.
2022-02-09 10:07:23 +01:00
Qiu Chaofan c091792cd3 [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.
2022-02-09 17:00:34 +08:00
Muhammad Omair Javaid cd817231ec [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
2022-02-09 13:54:25 +05:00
RVP 62e4a77746 [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
2022-02-09 09:46:46 +01:00
Nikita Popov fda29264f3 [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
2022-02-09 09:43:28 +01:00
Nikita Popov ff0b391600 [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
2022-02-09 09:40:27 +01:00
Andrzej Warzynski 69c3309d45 [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
2022-02-09 08:35:48 +00:00
Nikita Popov 68c1eeb4ba [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
2022-02-09 09:35:01 +01:00
Jean Perier 47995a0ec9 [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
2022-02-09 09:30:32 +01:00
Rainer Orth b63ca0a068 [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
2022-02-09 09:20:21 +01:00
Haojian Wu fe932a88e9 [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
2022-02-09 09:16:27 +01:00
Rainer Orth 0e4b214b8c [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
2022-02-09 09:15:41 +01:00
Rainer Orth 0d4b6f1f4b [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
2022-02-09 09:12:02 +01:00
Tobias Hieta 7cca34acc4 [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
2022-02-09 09:04:53 +01:00
Fraser Cormack 6449bea508 [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
2022-02-09 07:50:15 +00:00
Saiyedul Islam 4db88a54b6
[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
2022-02-09 07:11:41 +00:00
Fangrui Song 99580e29d8 [ELF] --warn-backrefs: suppress warnings for backward references within the archive 2022-02-08 21:45:55 -08:00
Jonas Devlieghere 43d3d886a0 [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
2022-02-08 21:29:21 -08:00
Fangrui Song a163cdf6b5 [docs] Re-generate ClangCommandLineReference.rst 2022-02-08 20:54:52 -08:00
Sameer Sahasrabuddhe c6a6b57902 [AMDGPU] [NFC] Fix incorrect use of bitwise operator.
Differential Revision: https://reviews.llvm.org/D119308
2022-02-08 22:12:54 -05:00
Yaxun (Sam) Liu 1d97cb1f6e [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
2022-02-08 21:58:40 -05:00
Zakk Chen cfe7f69036 [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
2022-02-08 18:37:43 -08:00
jacquesguan 5e71bbfb6c [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
2022-02-09 10:34:39 +08:00