Commit graph

420146 commits

Author SHA1 Message Date
Simon Pilgrim 60c6e9649d [Hexagon] Fix out of range shift warning. NFC. 2022-04-05 13:45:17 +01:00
Biplob Mishra edb4520205 rev16 instruction is being generated for a half word byte swap on a 32-bit input as a bswap+rotr. This is not true for a 64-bit input.
This patch implements the rev16 instruction for a AArch64 backend for a half word byte swap on a 64-bit input.

Differential Revision: https://reviews.llvm.org/D122643
2022-04-05 13:43:11 +01:00
Benjamin Kramer fe11344257 [bazel] Try to fix the build after 4661a65f4b 2022-04-05 14:40:52 +02:00
Biplob Mishra f2b4b2ebe7 Reverting changes to correct the commit message 2022-04-05 13:38:14 +01:00
Jingu Kang 64b6192e81 [AArch64] Set maximum VF with shouldMaximizeVectorBandwidth
Set the maximum VF of AArch64 with 128 / the size of smallest type in loop.

Differential Revision: https://reviews.llvm.org/D118979
2022-04-05 13:16:52 +01:00
Zahira Ammarguellat 4d165ad7d9 In fast-math mode, when unsafe math optimizations are enabled, the
compiler is allowed to use optimizations that allow reassociation and
transformations that don’t guaranty accuracy.
For example (x+y)+z is transformed into x+(y+z) . Although
mathematically equivalent, these two expressions may not lead to the
same final result due to errors of summation.
Or x/x is transformed into 1.0 but x could be 0.0, INF or NaN. And so
this transformation also may not lead to the same final result.
Setting the eval method 'ffp-eval-method' or via '#pragma clang fp
eval_method' in this mode, doesn’t have any effect.
This patch adds code to warn the user of this.

Differential Revision: https://reviews.llvm.org/D122155
2022-04-05 04:58:19 -07:00
Biplob Mishra afca54f0cf [ARM][AArch64] Optimize pattern for converting a half word byte swap in a 64-bit input to a rev16 instruction. Differential Revision: https://reviews.llvm.org/D122643 2022-04-05 12:23:09 +01:00
Nikita Popov f348ca51c7 [Tests] Use %clang_cc1 instead of %clang -cc1 in codegen tests (NFC) 2022-04-05 13:21:44 +02:00
Nikita Popov b1f610fec5 [Test] Use cc1 interface in more tests (NFC)
There doesn't seem to be any particular reason why these tests use
the driver interface rather than the cc1 interface, which is
typically used in CodeGen tests.
2022-04-05 13:16:24 +02:00
Florian Hahn 1ff022e21b
[LV] Add vector.body block to parent loop during skeleton creation.
When creating induction resume values, SCEV queries may rely on
LoopInfo. Make sure vector.body gets added to the loop of the pre-header
during skeleton construction.

%vector.body will be moved to the vector preheader during VPlan
execution.

Fixes #54745.
2022-04-05 11:54:17 +01:00
Daniel Grumberg 8b63622b9f [clang][extract-api] Undefining macros should not result in a crash
This fixes the situation where a undefining a not previously defined
macro resulted in a crash. Before trying to remove a definition from
PendingMacros we first check to see if the macro did indeed have a
previous definition.

Differential Revision: https://reviews.llvm.org/D123056
2022-04-05 11:42:45 +01:00
Evgeniy Brevnov 4661a65f4b New regression test against expandMemCpyAsLoop utility
Unit test for functionality going to be added by D118441

Differential Revision: https://reviews.llvm.org/D118440
2022-04-05 17:37:34 +07:00
Simon Pilgrim cd47be0c3b [InstCombine] Add PR22303 test case 2022-04-05 11:12:23 +01:00
Nikita Popov d4d30d6bb1 [Docs] Update opaque pointers docs (NFC)
Point people to the cc1 instead of the mllvm flag, as the mllvm
flag will stop working for clang usage at some point.

Update transition state to mention that support in Clang/LLVM is
complete, and only the default switch is pending.
2022-04-05 12:10:36 +02:00
Simon Tatham 82bd0bd24f [AArch64] Make PMMIR_EL1 read-only.
The Arm architecture reference manual (ARM DDI 0487H.a section
D13.5.12) lists every field in the register as RO, and does not list
an MSR instruction that writes it. So we should be defining it as an
ROSysReg, not an RWSysReg.

Reviewed By: vhscampos

Differential Revision: https://reviews.llvm.org/D123111
2022-04-05 11:09:56 +01:00
Nikita Popov 4d8a74c460 [Test] Use cc1 instead of mllvm -opaque-pointers option (NFC) 2022-04-05 12:04:48 +02:00
Nikita Popov 46cfbe561b [LLVMContext] Replace enableOpaquePointers() with setOpaquePointers()
This allows both explicitly enabling and explicitly disabling
opaque pointers, in anticipation of the default switching at some
point.

This also slightly changes the rules by allowing calls if either
the opaque pointer mode has not yet been set (explicitly or
implicitly) or if the value remains unchanged.
2022-04-05 12:02:48 +02:00
Benjamin Kramer 302fe7b3c4 Remove libc++ test from clang lib.
This was added in 3ba8548c8e
2022-04-05 11:33:55 +02:00
Nikita Popov ff18b158ed [CodeGen] Avoid unnecessary ConstantExpr cast
With opaque pointers, this is not necessarily a ConstantExpr. And
we don't need one here either, just Constant is sufficient.
2022-04-05 11:28:40 +02:00
Alexander Belyaev 004d4f8980 [mlir] Update BUILD.bazel. 2022-04-05 11:25:40 +02:00
Pavel Labath dbb158ebf4 Remove top-level using directives from Transforms/IPO headers
These directives pollute the namespace of all files which include the
header.
2022-04-05 11:22:37 +02:00
Pavel Labath e67cee0949 [lldb] Avoid duplicate vdso modules when opening core files
When opening core files (and also in some other situations) we could end
up with two vdso modules. This could happen because the vdso module is
very special, and over the years, we have accumulated various ways to
load it.

In D10800, we added one mechanism for loading it, which took the form of
a generic load-from-memory capability. Unfortunately loading an elf file
from memory is not possible (because the loader never loads the entire
file), and our attempts to do so were causing crashes. So, in D34352, we
partially reverted D10800 and implemented a custom mechanism specific to
the vdso.

Unfortunately, enough of D10800 remained such that, under the right
circumstances, it could end up loading a second (non-functional) copy of
the vdso module. This happened when the process plugin did not support
the extended MemoryRegionInfo query (added in D22219, to workaround a
different bug), which meant that the loader plugin was not able to
recognise that the linux-vdso.so.1 module (this is how the loader calls
it) is in fact the same as the [vdso] module (the name used in
/proc/$PID/maps) we loaded before. This typically happened in a core
file, as they don't store this kind of information.

This patch fixes the issue by completing the revert of D10800 -- the
memory loading code is removed completely. It also reduces the scope of
the hackaround introduced in D22219 -- it isn't completely sound and is
only relevant for fairly old (but still supported) versions of android.

I added the memory loading logic to the wasm dynamic loader, which has
since appeared and is relying on this feature (it even has a test). As
far as I can tell loading wasm modules from memory is possible and
reliable. MachO memory loading is not affected by this patch, as it uses
a completely different code path.

Since the scenarios/patches I described came without test cases, I have
created two new gdb-client tests cases for them. They're not
particularly readable, but right now, this is the best way we can
simulate the behavior (bugs) of a particular dynamic linker.

Differential Revision: https://reviews.llvm.org/D122660
2022-04-05 11:22:37 +02:00
Pavel Labath 4384c96fe7 [lldb/linux] Handle main thread exits
This patch handles the situation where the main thread exits (through
the SYS_exit syscall). In this case, the process as a whole continues
running until all of the other threads exit, or one of them issues an
exit_group syscall.

The patch consists of two changes:
- a moderate redesign of the handling of thread exit (WIFEXITED) events.
  Previously, we were removing (forgetting) a thread once we received
  the WIFEXITED (or WIFSIGNALED) event. This was problematic for the
  main thread, since the main thread WIFEXITED event (which is better thought
  of as a process-wide event) gets reported only after the entire process
  exits. This resulted in deadlocks, where we were waiting for the
  process to stop (because we still considered the main thread "live").

  This patch changes the logic such that the main thread is removed as
  soon as its PTRACE_EVENT_EXIT (the pre-exit) event is received. At
  this point we can consider the thread gone (for most purposes). As a
  corrolary, I needed to add special logic to catch process-wide exit
  events in the cases where we don't have the main thread around.

- The second part of the patch is the removal of the assumptions that
  the main thread is always available. This generally meant replacing
  the uses of GetThreadByID(process_id) with GetCurrentThread() in
  various process-wide operations (such as memory reads).

Differential Revision: https://reviews.llvm.org/D122716
2022-04-05 11:22:37 +02:00
Pavel Labath 331150a47d [lldb] Move host platform implementations into the base class
About half of our host platform code was implemented in the Platform
class, while the rest was it RemoteAwarePlatform. Most of the time, this
did not matter, as nearly all our platforms are also
RemoteAwarePlatforms. It makes a difference for PlatformQemu, which
descends directly from the base class (as it is local-only).

This patch moves all host code paths into the base class, and marks
PlatformQemu as a "host" platform so it can make use of them (it sounds
slightly strange, but that is consistent with what the apple simulator
platforms are doing). Not all of the host implementations make sense for
this platform, but it can always override those that don't.

I add some basic tests using the platform file apis to exercise this
functionality.

Differential Revision: https://reviews.llvm.org/D122898
2022-04-05 11:22:37 +02:00
LLVM GN Syncbot a9bd565ff2 [gn build] Port 3ba8548c8e 2022-04-05 09:06:48 +00:00
Nikolas Klauser 3ba8548c8e [libc++][ranges] Implement ranges::transform
Reviewed By: ldionne, var-const, #libc

Spies: libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D122173
2022-04-05 11:06:28 +02:00
David Carlier 6194992523 [Scudo] enabling anonymous named pages on Linux 5.17 and onwards.
Reviewers: vitalybuka

Reviewed-By: vitalybuka

Differential Revision: https://reviews.llvm.org/D122962
2022-04-05 09:46:02 +01:00
Alex Zinenko 0be38d4f32 [mlir][ods] Add description to Attr and ensure doc generation
Add the description textual field to the Attr ODS class to mirror an
identical field in the Type ODS class. Add support for generating
documentation for attribute constraints defined using this field. This
ensures mlir-tblgen produces at least some documentation for dialects
that only define attribute constraints, such as DLTI.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D123024
2022-04-05 10:40:15 +02:00
LLVM GN Syncbot 331a58ae79 [gn build] Port 0320115c16 2022-04-05 08:34:08 +00:00
Jonas Paulsson dbb6a75fbb [LibCalls] Respect TLI.getExtAttrForI32Param() in inferLibFuncAttributes().
getExtAttrForI32Param() is the method to be used for determining the type of
extension attribute (if any) that is to be added for a signed/unsigned
argument.

Previously, the SExt attribute was always added to the i32 ldexp* argument as
it was expected to be ignored by targets not needing it. This patch now
changes this so that it is only added for the targets that need it in the
first place.

Putchar() argument is now also extended as required by the target (SystemZ in
the test), to fix the issue below. Many more libcalls will be handled
similarly in a following patch.

Fixes https://github.com/llvm/llvm-project/issues/54532.

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

Review: Eli Friedman
2022-04-05 10:29:42 +02:00
Andrzej Warzynski dda366ed37 [flang][cmake] Make CMake copy "omp_lib.h" into the build directory
Any header or module file in the Flang source directory is of no use to
the compiler unless it is copied into the build directory. Indeed, all
compiler search paths are relative to the compiler executable (flang-new
in our case). Hence, "omp_lib.h" should be copied into the build
directory alongside other compiler-provided files that can be "included"
(header files) or "used" (module files).

For now, "omp_lib.h" is copied into "<build-dir>/include/flang/OpenMP".
We may decide to change this in future. For example, Clang copies a
bunch of runtime headers into “<build-dir>/lib/clang/<version-number>”.
We could also consider using a similar header from a different
sub-project.

Flang's driver search path is updated accordingly. A rule for
"installing" the "omp_lib.h" header is _yet to be added_ (we will also
need to determine the suitable location for this).

Differential Revision: https://reviews.llvm.org/D122015
2022-04-05 08:25:26 +00:00
Mehdi Amini d2ca2b94fd Apply clang-tidy fixes for readability-redundant-control-flow in FuncToLLVM.cpp (NFC) 2022-04-05 08:19:33 +00:00
Nikita Popov d69e9f9d89 [OpaquePtrs][Clang] Add -opaque-pointers/-no-opaque-pointers cc1 options
This adds cc1 options for enabling and disabling opaque pointers
on the clang side. This is not super useful now (because
-mllvm -opaque-pointers and -Xclang -opaque-pointers have the same
visible effect) but will be important once opaque pointers are
enabled by default in clang. In that case, it will only be
possible to disable them using the cc1 -no-opaque-pointers option.

Differential Revision: https://reviews.llvm.org/D123034
2022-04-05 10:15:41 +02:00
Alexander Belyaev cc6788aece [mlir] Update mlir/BUILD.bazel. 2022-04-05 10:14:41 +02:00
Muhammad Omair Javaid 0320115c16 Revert "[CodeGen] Async unwind - add a pass to fix CFI information"
This reverts commit 980c3e6dd2.

This commit had failing tests with clang crashing across various
AArch64/Linux buildots.

https://lab.llvm.org/buildbot/#/builders/179/builds/3346

Differential Revision: https://reviews.llvm.org/D114545
2022-04-05 13:12:30 +05:00
Alexander Belyaev 64f659bee6 [mlir] Rewrite canonicalization of collapse(expand) and expand(collapse).
Differential Revision: https://reviews.llvm.org/D122666
2022-04-05 10:03:07 +02:00
Adrian Kuegel 72fe439a4e [mlir] Fix 1 ClangTidyPerformance finding (NFC) 2022-04-05 09:29:35 +02:00
Max Kazantsev 9a2798c7a3 [CodeGen][NFC] Hoist budget check out of loop
Less computations & early exit if we know for sure that the limit will be exceeded.
2022-04-05 14:20:42 +07:00
Evgeniy Brevnov 970ae8376e An attempt to fix problem with building
Transforms/Utils/MemTransferLowerTest
2022-04-05 14:12:00 +07:00
Simon Pilgrim 7120c67c04 Revert rG5adc94bb8a23eb819f6ca80e722f5b0e6e41401d "New regression test against expandMemCpyAsLoop utility"
This was causing link errors on buildbots (and locally)
2022-04-05 08:11:21 +01:00
Luboš Luňák 76bc772920 [lldb][gui] make 'step out' step out of the selected frame
Differential Revision: https://reviews.llvm.org/D123001
2022-04-05 08:29:13 +02:00
Luboš Luňák f90fa55569 [lldb][gui] use just '#2' instead of 'frame #2' in the threads/frame view
Since the threads/frame view is taking only a small part on the right side
of the screen, only a part of the function name of each frame is visible.
It seems rather wasteful to spell out 'frame' there when it's obvious
that it is a frame, it's better to use the space for more of the function
name.

Differential Revision: https://reviews.llvm.org/D122998
2022-04-05 08:29:13 +02:00
Luboš Luňák aaca2acd5f [lldb][gui] do not show the help window on first gui startup
It's rather annoying if it's there after every startup,
and that 'Help (F6)' at the top should be enough to help people
who don't know.

Differential Revision: https://reviews.llvm.org/D122997
2022-04-05 08:29:13 +02:00
Maksim Panchenko 163e188e3e [BOLT][test] Fix AArch64 test
Remove header dependency from cross-platform test.

Reviewed By: yota9

Differential Revision: https://reviews.llvm.org/D123107
2022-04-04 23:28:47 -07:00
Evgeniy Brevnov 5adc94bb8a New regression test against expandMemCpyAsLoop utility
Unit test for functionality going to be added by D118441

Differential Revision: https://reviews.llvm.org/D118440
2022-04-05 13:28:13 +07:00
Min-Yih Hsu 18b38ff6c7 [M68k] Adopt VarLenCodeEmitter for move instructions
The `move` instruction has one of the most complicate sets of variants, so
we're refactoring it first before finishing up rest of the data
instructions in a separate patch.

Note that since we're introducing more `move` variants, the codegen
actually got improved in terms of code size.
2022-04-04 23:02:27 -07:00
Maksim Panchenko f927106e10 [BOLT][test] Enable cross-target testing
Check for supported target architecture instead of the host arch when
deciding to execute non-runtime tests.

Reviewed By: Amir

Differential Revision: https://reviews.llvm.org/D122498
2022-04-04 23:00:54 -07:00
Maksim Panchenko f0f5d19a36 [BOLT][test] Fix X86 cross-platform tests
Use target-specific flags for building X86 non-runnable tests.

Reviewed By: Amir

Differential Revision: https://reviews.llvm.org/D123072
2022-04-04 22:25:42 -07:00
Brad Smith 4875ff1dc9 [RISCV] Remove redundant enabling of IAS for Clang, NFC
Generic_GCC::IsIntegratedAssemblerDefault() already takes care of RISCV.

Reviewed By: kito-cheng, MaskRay

Differential Revision: https://reviews.llvm.org/D123097
2022-04-04 23:44:49 -04:00
Wei Xiao ca33d74ca5 [X86] Improve x86-partial-reduction to support abs intrinsic
Current implementation only recognizes absolute operation implemented by
select instruction. This patch adds support for abs intrinsic.

Differential Revision: https://reviews.llvm.org/D122777
2022-04-05 11:32:09 +08:00