Commit Graph

427604 Commits

Author SHA1 Message Date
Peixin Qiao f31ec689b2 [NFC][flang] Add the test case for D125371
This adds the test case with portability warning preparing for D125804,
which supports checking for portability warnings in test_errors.py.

Reviewed By: ekieri

Differential Revision: https://reviews.llvm.org/D127821
2022-06-22 23:53:38 +08:00
Martin Storsjö 0bc7105cd1 [lldb] Tentative attempt to fix command-target-create-resolve-exe.test on buildbot
This test does succeed in my local test environment though, but
fails on the buildbot.
2022-06-22 18:48:04 +03:00
Jonathan Peyton b7b4986576 [OpenMP][libomp] Hold old __kmp_threads arrays until library shutdown
When many nested teams are formed, __kmp_threads may be reallocated
to accommodate new threads. This reallocation causes a data
race when another existing team's thread simultaneously references
__kmp_threads. This patch keeps the old thread arrays around until library
shutdown so these lingering references can complete without issue and
access to __kmp_threads remains a simple array reference.

Fixes: https://github.com/llvm/llvm-project/issues/54708
Differential Revision: https://reviews.llvm.org/D125013
2022-06-22 10:30:35 -05:00
Nikita Popov 1061511008 [X86PreAMXConfig] Use IRBuilder to insert instructions (NFC)
Use an IRBuilder to insert instructions in preWriteTileCfg().
While here, also remove some unnecessary bool return values.

There are some test changes because the IRBuilder folds
"trunc i16 8 to i8" to "i8 8", and that has knock-on effects on
instruction naming.

I ran into this when converting tests to opaque pointers and
noticed that this pass introduces unnecessary "bitcast ptr to ptr"
instructions.
2022-06-22 17:28:48 +02:00
Mark de Wever 65f44c9218 [libc++] Fixes GCC-12 build. 2022-06-22 17:26:17 +02:00
Nikita Popov ff5301dde9 [X86] Regenerate test checks (NFC)
This runs the test through -instnamer and generates test checks
using update_test_checks.py. (The previous comment indicated that
update_llc_test_checks.py was used, but I rather doubt that.)

This relies on the non-determinism fix from
fbb72530fe,
the previous check lines have apparently been written to accomodate
that non-determinism.
2022-06-22 17:00:10 +02:00
Nikita Popov fbb72530fe [X86PreAMXConfig] Use MapVector to fix non-determinism
We generate code by iterating over this map, so make sure that the
order is deterministic.
2022-06-22 16:57:33 +02:00
Guillaume Chatelet 57ffff6db0 Revert "[NFC] Remove dead code"
This reverts commit 8ba2cbff70.
2022-06-22 14:55:47 +00:00
Nikita Popov 4c921aa3f5 [X86] Name instructions in test (NFC)
Run the test through -instnamer, to make it easier to modify.
2022-06-22 16:53:15 +02:00
Nico Weber 1af1e91bba [gn build] Port c3574ef739 slightly better
The name of the host binary changed from make_confusable_table to
make-confusable-table, so match that.
2022-06-22 10:44:09 -04:00
Nico Weber 721875db2b Reland "[gn build] (manually) port b94db7ed7e (Confusables.inc)"
b94db7ed7e relanded in c3574ef739.

This relands commit 180bae08a0, rebased across the new version of
commit c3574ef739, and rebased across 10f7255d32.
2022-06-22 10:38:14 -04:00
serge-sans-paille c3574ef739 [clang-tidy] Confusable identifiers detection
Detect identifiers that are confusable using a variant of Unicode definition

        http://www.unicode.org/reports/tr39/#Confusable_Detection

and have conflicting scopes.

This a recommit (with portability and feature fixes) of b94db7ed7e

Differential Revision: https://reviews.llvm.org/D112916
2022-06-22 16:17:20 +02:00
Alvin Wong 3c867898c7 [lldb] Add setting to override PE/COFF ABI by module name
The setting `plugin.object-file.pe-coff.module-abi` is a string-to-enum
map that allows specifying an ABI to a module name. For example:

    ucrtbase.dll=msvc
    libstdc++-6.dll=gnu

This allows for debugging a process which mixes both modules built using
the MSVC ABI and modules built using the MinGW ABI.

Depends on D127048

Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D127234
2022-06-22 17:16:06 +03:00
Alvin Wong 4d12378395 [lldb][windows] Fix crash on getting nested exception
LLDB tries to follow `EXCEPTION_RECORD::ExceptionRecord` to follow the
nested exception chain. In practice this code just causes Access
Violation whenever there is a nested exception. Since there does not
appear to be any code in LLDB that is actually using the nested
exceptions, this change just removes the crashing code and adds a
comment for future reference.

Fixes https://github.com/mstorsjo/llvm-mingw/issues/292

Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D128201
2022-06-22 17:16:06 +03:00
Alvin Wong 2bae956057 [lldb] Resolve exe location for `target create`
This fixes an issue that, when you start lldb or use `target create`
with a program name which is on $PATH, or not specify the .exe suffix of
a program in the working directory on Windows, you get a confusing
error, for example:

    (lldb) target create notepad
    error: 'C:\WINDOWS\SYSTEM32\notepad.exe' doesn't contain any 'host'
    platform architectures: i686, x86_64, i386, i386

Fixes https://github.com/mstorsjo/llvm-mingw/issues/265

Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D127436
2022-06-22 17:16:05 +03:00
Martin Storsjö 8a64dd5b06 [lldb] Fix reading i686-windows executables with GNU environment
25c8a061c5 / D127048 added an option
for setting the ABI to GNU.

When an object file is loaded, there's only minimal verification
done for the architecture spec set for it, if the object file only
provides one.

However, for i386 object files, the PECOFF object file plugin
provides two architectures, i386-pc-windows and i686-pc-windows.
This picks a totally different codepath in
TargetList::CreateTargetInternal, where it's treated as a fat
binary. This goes through more verifications to see if the
architectures provided by the object file matches what the
platform plugin supports.

The PlatformWindows() constructor explicitly adds the
"i386-pc-windows" and "i686-pc-windows" architectures (even when
running on other architectures), which allows this "fat binary
verification" to succeed for the i386 object files that provide
two architectures.

However, after that commit, if the object file is advertised with
the different environment (either when lldb is built in a mingw
environment, or if that setting is set), the fat binary validation
won't accept the file any longer.

Update ArchSpec::IsEqualTo with more logic for the Windows use
cases; mismatching vendors is not an issue (they don't have any
practical effect on Windows), and GNU and MSVC environments are
compatible to the point that PlatformWindows can handle object
files for both environments/ABIs.

As a separate path forward, one could also consider to stop returning
two architecture specs from ObjectFilePECOFF::GetModuleSpecifications
for i386 files.

Differential Revision: https://reviews.llvm.org/D128268
2022-06-22 17:16:05 +03:00
James Y Knight 17e2702528 Clang AttributeReference: emit entries for "Undocumented" attributes.
Almost all attributes currently marked `Undocumented` are user-facing
attributes which _ought_ to be documented, but nobody has written it
yet. This change ensures that we at least acknowledge that these
attributes exist in the documentation, even if we have no description
of their semantics.

A new category, `InternalOnly` has been added for those few attributes
which are not user-facing, and should remain omitted from the docs.
2022-06-22 09:55:05 -04:00
Guillaume Chatelet cef65864af [Alignment] Use Align for MaxKernArgAlign
Differential Revision: https://reviews.llvm.org/D128118
2022-06-22 13:40:37 +00:00
Joseph Huber a9fd8b9113 [LinkerWrapper] Fix calls to deleted Error constructor on older compilers
Summary:
A recent patch added some new code paths to the linker wrapper. Older
compilers seem to have problems with returning errors wrapped in
an Excepted type without explicitly moving them. This caused failures in
some of the buildbots. This patch fixes that.
2022-06-22 09:39:23 -04:00
Nikita Popov b980841652 [X86] Migrate more tests to opaque pointers (NFC)
Migrate some more tests that required manual fixups (e.g. due to
phi nodes), but have no codegen changes.

Also tweak some more tests that had leftover no-op constant
expressions.
2022-06-22 15:39:11 +02:00
Valentin Clement 1906188f07
[flang] Add FIR tests missing from fir-dev
This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier, PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D128331

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Kiran Chandramohan <kiran.chandramohan@arm.com>
2022-06-22 15:35:04 +02:00
Guillaume Chatelet 8ba2cbff70 [NFC] Remove dead code 2022-06-22 13:33:58 +00:00
Florian Hahn 098b0b18a7
[ConstraintElimination] Transfer info from SGE to unsigned system.
This patch adds a new transferToOtherSystem helper that tries to
transfer information from signed predicates to the unsigned system and
vice versa.

The initial version adds A >=u B for A >=s B && B >=s 0

https://alive2.llvm.org/ce/z/8b6F9i
2022-06-22 15:27:59 +02:00
Joseph Huber 21e29b6ce7 [Clang] Allow multiple comma separated arguments to `--offload-arch=`
This patch updates the `--[no-]offload-arch` command line arguments to
allow the user to pass in many architectures in a single argument rather
than specifying it multiple times. This means that the following command
line,
```
clang foo.cu --offload-arch=sm_70 --offload-arch=sm_80
```
can become:
```
clang foo.cu --offload-arch=sm_70,sm_80
```

Reviewed By: ye-luo

Differential Revision: https://reviews.llvm.org/D128206
2022-06-22 09:25:04 -04:00
Joseph Huber 958a885050 [LinkerWrapper] Rework the linker wrapper and use owning binaries
The linker wrapper currently eagerly extracts all identified offloading
binaries to a file. This isn't ideal because we will soon open these
files again to examine their symbols for LTO and other things.
Additionally, we may not use every extracted file in the case of static
libraries. This would be very noisy in the case of static libraries that
may contain code for several targets not participating in the current
link.

Recent changes allow us to treat an Offloading binary as a standard
binary class. So that allows us to use an OwningBinary to model the
file. Now we keep it in memory and only write it once we know which
files will be participating in the final link job. This also reworks a
lot of the structure around how we handle this by removing the old
DeviceFile class.

The main benefit from this is that the following doesn't output 32+ files and
instead will only output a single temp file for the linked module.
```
$ clang input.c -fopenmp --offload-arch=sm_70 -foffload-lto -save-temps
```

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D127246
2022-06-22 09:24:10 -04:00
Nikita Popov 7e6af44e3b [X86] Name instructions in test (NFC)
Run the test through -instnamer, which makes it simpler to modify
it.
2022-06-22 15:17:21 +02:00
Guillaume Chatelet 9803db8c18 [NFC] Remove dead code 2022-06-22 13:13:01 +00:00
Martin Storsjö 9846a1f2d4 [lldb] Remove an outdated comment. NFC.
This comment became outdated in 053eb35651
(but was moved along); that commit moved the code and the comment
to a separate function, with a separate local variable
`num_of_bytes_read`. On error, the possibly garbage value is never
copied back to the caller's reference, thus the comment is no longer
relevant (and slightly confusing as is).

Differential Revision: https://reviews.llvm.org/D128226
2022-06-22 16:11:59 +03:00
Aaron Ballman bb297024fa Don't treat invalid parameters as being unused
The misc-unused-parameters check would trigger false positive warnings
about the parameter being unused when the parameter declaration was
invalid. No longer issue the warning in that case on the assumption
that most parameters are used in practice, so the extra diagnostic is
most likely a false positive.

Fixes #56152
2022-06-22 08:56:38 -04:00
Igor Kudrin 8958e70ccb [NVPTX] Keep metadata attached to module-scope variables
This helps to preserve the debug information of global variables.

Differential Revision: https://reviews.llvm.org/D127510
2022-06-22 05:51:29 -07:00
Simon Pilgrim 2c3a4a9334 [DAG] SelectionDAG::GetDemandedBits - don't recurse back into GetDemandedBits
Another minor cleanup as we work toward removing GetDemandedBits entirely - call SimplifyMultipleUseDemandedBits directly.
2022-06-22 13:48:57 +01:00
Nikita Popov 2f448bf509 [X86] Migrate tests to use opaque pointers (NFC)
Test updates were performed using:
https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34

These are only the test updates where the test passed without
further modification (which is almost all of them, as the backend
is largely pointer-type agnostic).
2022-06-22 14:38:25 +02:00
Guillaume Chatelet aeccc16497 Re-land [libc] Apply no-builtin everywhere, remove unnecessary flags
This is a reland of D126773 / b2a9ea4420.

The removal of `-mllvm -combiner-global-alias-analysis` has landed separately
in D128051 / 7b73f53790.

And the removal of `-mllvm --tail-merge-threshold=0` is scheduled for
removal in a subsequent patch.
2022-06-22 12:30:20 +00:00
Nikita Popov 60a32157a5 [Tests] Remove unnecessary bitcasts from opaque pointer tests (NFC)
Previously left these behind due to the required instruction
renumbering, drop them now. This more accurately represents
opaque pointer input IR.

Also drop duplicate opaque pointer check lines in one SROA test.
2022-06-22 14:15:46 +02:00
Nikita Popov 615efc3ed5 [AlignmentFromAssumptions] Migrate tests to opaque pointers (NFC)
Tests were updated with (without manual fixup):
https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34
2022-06-22 13:57:47 +02:00
Guillaume Chatelet 67fe3bd33c [libc][mem*] Introduce Sized/Backends for new mem framework
This patch is a subpart of D125768 intented to make the review easier.

The `SizedOp` struct represents operations to be performed on a certain number of bytes.
It is responsible for breaking them down into platform types and forwarded to the `Backend`.

The `Backend` struct represents a lower level abstraction that works only on types (`uint8_t`, `__m128i`, ...).
It is similar to instruction selection.

Differential Revision: https://reviews.llvm.org/D126768
2022-06-22 11:21:06 +00:00
Nikita Popov fc655a9edf [AddDiscriminators] Migrate tests to opaque pointers (NFC)
Update performed using:
https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34

memcpy-discriminator.ll was fixed up to use named instructions
and drop the no longer needed bitcasts.
2022-06-22 12:47:12 +02:00
Nikita Popov 7c802f985f [AggressiveInstCombine] Update tests to use opaque pointers (NFC)
Update performed using (without manual fixup):
https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34
2022-06-22 12:33:06 +02:00
Nikita Popov 563cf93776 [ADCE] Update tests to use opaque pointers (NFC)
Update performed using:
https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34

This time without any manual fixup.
2022-06-22 12:26:12 +02:00
esmeyi d29e986ed5 [XCOFF] write the real source file name in C_FILE symbol.
The symbol table starts with all the C_FILE symbols.

Reviewed By: shchenz

Differential Revision: https://reviews.llvm.org/D126623
2022-06-22 06:23:36 -04:00
David Green 979400be78 [ARM] Fix MVE gather/scatter merged gep offsets
This fixes the combining of constant vector GEP operands in the
optimization of MVE gather/scatter addresses, when opaque pointers are
enabled. As opaque pointers reduce the number of bitcasts between geps,
more can be folded than before. This can cause problems if the index
types are now different between the two geps.

This fixes that by making sure each constant is scaled appropriately,
which has the effect of transforming the geps to have a scale of 1,
changing [r0, q0, uxtw #1] gathers to [r0, q0] with a larger q0. This
helps use a simpler instruction that doesn't need the extra uxtw.

Differential Revision: https://reviews.llvm.org/D127733
2022-06-22 11:04:22 +01:00
Nikita Popov f98697642c [X86] Don't run O2 pipeline in codegen test (NFC)
Regenerate the test with current O2 result and only run CGP.
2022-06-22 11:37:22 +02:00
David Sherwood aa0a413df8 [AArch64][SME] Add some SME PSTATE setting/query intrinsics
This patch adds support for:

* Querying the PSTATE.SM state with @llvm.aarch64.sme.get.pstatesm
* Reading/writing the TPIDR2 register with new
@llvm.aarch64.sme.get.tpidr2 and @llvm.aarch64.sme.set.tpidr2
intrinsics.

Tests added here:

  CodeGen/AArch64/sme-get-pstatesm.ll
  CodeGen/AArch64/sme-read-write-tpidr2.ll

Differential Revision: https://reviews.llvm.org/D127957
2022-06-22 10:26:45 +01:00
Hui Xie 20869c5ba0 [libc++] fix views::all hard error on lvalue move only views instead of SFINAE
For an lvalue reference to a move only view x, views::all(x) gives hard error because the expression inside noexcept is not well formed and it is not SFINAE friendly.

Given a move only view type `V`, and a concept

```
template <class R>
concept can_all = requires {
    std::views::all(std::declval<R>());
};
```

The expression `can_all<V&>` returns
libstdc++: false
msvc stl : false
libc++   : error: static_cast from 'V' to 'typename decay<decltype((std::forward<V &>(__t)))>::type' (aka 'V') uses deleted function
      noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t))))

The standard spec has its own problem, the spec says it is expression equivalent to `decay-copy(E)` but the spec of `decay-copy` does not have any constraint, which means the expression `decay-copy(declval<V&>())` is well-formed and the concept `can_all<V&>` should return true and should error when instantiating the function body of decay-copy. This is clearly wrong behaviour in the spec and we will probably create an LWG issue. But the libc++'s behaviour is clearly not correct. The `noexcept` is an "extension" in libc++ which is not in the spec, but the expression inside `noexpect` triggers hard error, which is not right.

Reviewed By: #libc, ldionne, var-const

Differential Revision: https://reviews.llvm.org/D128281
2022-06-22 09:50:16 +01:00
Nikita Popov 1f88d80408 [SCCP] Don't mark edges feasible when resolving undefs
As branch on undef is immediate undefined behavior, there is no need
to mark one of the edges as feasible. We can leave all the edges
non-feasible. In IPSCCP, we can replace the branch with an unreachable
terminator.

Differential Revision: https://reviews.llvm.org/D126962
2022-06-22 10:28:27 +02:00
Nicolas Vasilache 74f0660160 [mlir][Transform] NFC - Pass TransformState as an argument to applyToOne methods
This will allow implementing state-dependent behavior in the future.

Differential Revision: https://reviews.llvm.org/D128327
2022-06-22 01:19:13 -07:00
Serge Pavlov 706e89db97 Fix interaction of pragma FENV_ACCESS with other pragmas
Previously `#pragma STDC FENV_ACCESS ON` always set dynamic rounding
mode and strict exception handling. It is not correct in the presence
of other pragmas that also modify rounding mode and exception handling.
For example, the effect of previous pragma FENV_ROUND could be
cancelled, which is not conformant with the C standard. Also
`#pragma STDC FENV_ACCESS OFF` turned off only FEnvAccess flag, leaving
rounding mode and exception handling unchanged, which is incorrect in
general case.

Concrete rounding and exception mode depend on a combination of several
factors like various pragmas and command-line options. During the review
of this patch an idea was proposed that the semantic actions associated
with such pragmas should only set appropriate flags. Actual rounding
mode and exception handling should be calculated taking into account the
state of all relevant options. In such implementation the pragma
FENV_ACCESS should not override properties set by other pragmas but
should set them if such setting is absent.

To implement this approach the following main changes are made:

- Field `FPRoundingMode` is removed from `LangOptions`. Actually there
  are no options that set it to arbitrary rounding mode, the choice was
  only `dynamic` or `tonearest`. Instead, a new boolean flag
  `RoundingMath` is added, with the same meaning as the corresponding
  command-line option.

- Type `FPExceptionModeKind` now has possible value `FPE_Default`. It
  does not represent any particular exception mode but indicates that
  such mode was not set and default value should be used. It allows to
  distinguish the case:

    {
        #pragma STDC FENV_ACCESS ON
	...
    }

  where the pragma must set FPE_Strict, from the case:

    {
        #pragma clang fp exceptions(ignore)
        #pragma STDC FENV_ACCESS ON
        ...
    }

  where exception mode should remain `FPE_Ignore`.

  - Class `FPOptions` has now methods `getRoundingMode` and
  `getExceptionMode`, which calculates the respective properties from
  other specified FP properties.

  - Class `LangOptions` has now methods `getDefaultRoundingMode` and
  `getDefaultExceptionMode`, which calculates default modes from the
  specified options and should be used instead of `getRoundingMode` and
  `getFPExceptionMode` of the same class.

Differential Revision: https://reviews.llvm.org/D126364
2022-06-22 15:13:54 +07:00
Nikolas Klauser 681cde7dd8 [libc++] Complete the implementation of N4190
Fixes #37402

Reviewed By: ldionne

Spies: EricWF, avogelsgesang, libcxx-commits, arphaman

Differential Revision: https://reviews.llvm.org/D124346
2022-06-22 10:13:03 +02:00
Nikolas Klauser c475e31a18 [libc++] Remove std::function in C++03
`std::function` has been deprecated for a few releases now. Remove it with an option to opt-back-in with a note that this option will be removed in LLVM 16.

Reviewed By: ldionne, #libc

Spies: #libc_vendors, EricWF, jloser, libcxx-commits

Differential Revision: https://reviews.llvm.org/D127908
2022-06-22 10:02:30 +02:00
Valentin Clement b09426ff26
[flang] Cleanup code and add test from fir-dev
This patch clean up some code for upstreaming and add couple of
missing tests that were left in fir-dev.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier, PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D128258

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2022-06-22 09:39:11 +02:00