Commit Graph

381363 Commits

Author SHA1 Message Date
Jonas Devlieghere 6dbea3efc5 [lldb] Add scoped timer to HostInfoMacOSX::GetXcodeSDKPath 2021-03-01 14:57:42 -08:00
Nikita Popov c35761db0f [GlobalISel] Bail on G_PHI narrowing of odd types (PR48188)
The current narrowing code for G_PHI can only handle the case
where the size is a multiple of the narrow size. If this is not
the case, fall back to SDAG instead of asserting.

Original patch by shepmaster.

Differential Revision: https://reviews.llvm.org/D92446
2021-03-01 23:30:50 +01:00
Yaxun (Sam) Liu 9ecbb34e1d Fix test cxx-call-kernel.cpp
Only test it with x86 since other target may have an ABI
making it difficult to test.

Change-Id: I85423c8bbbbbb8f24cb3ea4cb64a408069b4d61c
2021-03-01 17:10:53 -05:00
Nathan James abbe9e227e
[clang-tidy] Added command line option `fix-notes`
Added an option to control whether to apply the fixes found in notes attached to clang tidy errors or not.
Diagnostics may contain multiple notes each offering different ways to fix the issue, for that reason the default behaviour should be to not look at fixes found in notes.
Instead offer up all the available fix-its in the output but don't try to apply the first one unless `-fix-notes` is supplied.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D84924
2021-03-01 22:07:11 +00:00
Matt Arsenault 0131498402 GlobalISel: Remove dead code
Generic code should probably not introduce G_INSERT/G_EXTRACT. The
mirror unpackRegs should also be removed, but AMDGPU still has a use
remaining which needs to be fixed.
2021-03-01 17:06:43 -05:00
Jessica Paquette 3e8223b165 [AArch64][GlobalISel] NFC: Remove dead G_BUILD_VECTOR legalization rule
Remove a rule which allows larger scalar types than the destination vector
element type.

This appears to be irrelevant now that we have G_BUILD_VECTOR_TRUNC. Plus,
making a G_BUILD_VECTOR which satisfies this introduces a verifier failure
anyway.

Differential Revision: https://reviews.llvm.org/D97727
2021-03-01 14:04:40 -08:00
Artem Belevich 32e0645276 [CUDA] Remove `noreturn` attribute from __assertfail().
`noreturn` complicates control flow and tends to trigger a known bug in ptxas if
the assert is used within loops in sufficiently complicated code.
https://bugs.llvm.org/show_bug.cgi?id=27738

Differential Revision: https://reviews.llvm.org/D97708
2021-03-01 13:59:22 -08:00
David Green e880f8b88a [ARM] Rename pass to MVETPAndVPTOptimisationsPass
This pass has for a while performed Tail predication as well as VPT
block optimizations. Rename the pass to make that clear.
2021-03-01 21:57:19 +00:00
Amara Emerson b783aa8979 [AArch64] Fix emitting an AdrpAddLdr LOH when there's a potential clobber of the
def of the adrp before the ldr.

Apparently this pass used to have liveness analysis but it was removed for
scompile time reasons. This workaround prevents the LOH from being emitted
unless the ADD and LDR are adjacent.

Fixes https://github.com/JuliaLang/julia/issues/39820

Differential Revision: https://reviews.llvm.org/D97571
2021-03-01 13:52:57 -08:00
Nathan James 8bfc141931
[clang-tidy] Added option to uniqueptr delete release check
Adds an option, `PreferResetCall`, currently defaulted to `false`, to the check.
When `true` the check will refactor by calling the `reset` member function.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D97630
2021-03-01 21:52:13 +00:00
Stella Stamenova 801067f4c0 [mlir][lldb] Fix several gcc warnings in mlir and lldb
These warnings are raised when compiling with gcc due to either having too few or too many commas, or in the case of lldb, the possibility of a nullptr.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D97586
2021-03-01 13:48:22 -08:00
David Green 54e2876132 [ARM] Update and add extra WLS testing. NFC 2021-03-01 21:46:09 +00:00
Yaxun (Sam) Liu 53d30381f5 Fix build failure due to dump()
Change-Id: I86b534223d63bf8bb8f49af5a64b300efbeba77b
2021-03-01 16:44:08 -05:00
Fangrui Song 04c3040f41 [InstrProfiling] Place __llvm_prf_vnodes and __llvm_prf_names in llvm.used on ELF
`__llvm_prf_vnodes` and `__llvm_prf_names` are used by runtime but not
referenced via relocation in the translation unit.

With `-z start-stop-gc` (D96914 https://sourceware.org/bugzilla/show_bug.cgi?id=27451),
the linker no longer lets `__start_/__stop_` references retain them.

Place `__llvm_prf_vnodes` and `__llvm_prf_names` in `llvm.used` to make
them retained by the linker.

This patch changes most existing `UsedVars` cases to `CompilerUsedVars`
to reflect the ideal state - if the binary format properly supports
section based GC (dead stripping), `llvm.compiler.used` should be sufficient.

`__llvm_prf_vnodes` and `__llvm_prf_names` are switched to `UsedVars`
since we want them to be unconditionally retained by both compiler and linker.

Behaviors on other COFF/Mach-O are not affected.

Differential Revision: https://reviews.llvm.org/D97649
2021-03-01 13:43:23 -08:00
Med Ismail Bennani 5a9c34918b [lldb/Plugins] Fix SWIGPythonBridge build issue
This patch should fi the build issue on the windows bots:
https://lab.llvm.org/buildbot/#/builders/83/builds/4214/steps/5/logs/stdio

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-03-01 22:37:36 +01:00
Anirudh Prasad 5cb417527c [SystemZ] Introduce distinction between the jg/jl family of mnemonics for GNU as vs HLASM
- This patch adds in the distinction between jg[*] and jl[*] pc-relative
  mnemonics based on the variant/dialect.
- Under the hlasm variant, we use the jl[*] family of mnemonics and under
  the att (GNU as) variant, we use the jg[*] family of mnemonics.
- jgnop which was added in https://reviews.llvm.org/D92185, is now restricted
  to att variant. jlnop is introduced and restricted to hlasm variant.
- The br[*]l additional mnemonics are mapped to either jl[*]/jg[*] based on
  the variant.

Reviewed By: uweigand

Differential Revision: https://reviews.llvm.org/D97581
2021-03-01 16:36:07 -05:00
Yaxun (Sam) Liu 5cf2a37f12 [HIP] Emit kernel symbol
Currently clang uses stub function to launch kernel. This is inconvenient
to interop with C++ programs since the stub function has different name
as kernel, which is required by ROCm debugger.

This patch emits a variable symbol which has the same name as the kernel
and uses it to register and launch the kernel. This allows C++ program to
launch a kernel by using the original kernel name.

Reviewed by: Artem Belevich

Differential Revision: https://reviews.llvm.org/D86376
2021-03-01 16:31:40 -05:00
Sanjay Patel 154c47dc06 [SDAG] add helper for select->logic folds; NFC
This set of transforms should be extended to handle vector types.
2021-03-01 16:24:15 -05:00
Richard Smith 564f5b0734 Revert "[c++20] Mark class type NTTPs as done and start defining the feature test macro."
Some of the parts of this work were reverted; stop defining the feature
test macro for now.

This reverts commit b4c63ef6dd.
2021-03-01 12:53:35 -08:00
Nico Weber 0658fc654c [lld/mac] Implement the missing bits of -undefined
This adds support for `-undefined dynamic_lookup`, and for
`-undefined warning` and `-undefined suppress` with `-flat_namespace`.

We just replace undefined symbols with a DynamicLookup when we hit them.

With this, `check-llvm` passes when using ld64.lld.darwinnew as host linker.

Differential Revision: https://reviews.llvm.org/D97642
2021-03-01 15:30:53 -05:00
Krystian Kuzniarek 6ca52815fb [clang-format][PR47290] Add ShortNamespaceLines format option
clang-format documentation states that having enabled
FixNamespaceComments one may expect below code:

c++
namespace a {
foo();
}

to be turned into:

c++
namespace a {
foo();
} // namespace a

In reality, no "// namespace a" was added. The problem was too high
value of kShortNamespaceMaxLines, which is used while deciding whether
a namespace is long enough to be formatted.

As with 9163fe2, clang-format idempotence is preserved.

Differential Revision: https://reviews.llvm.org/D87587
2021-03-01 21:28:14 +01:00
Björn Schäpers 418b4a7b31 [clang-format] Respect spaces in line comment section...
... without an active column limit.

Before line comments were not touched at all with ColumnLimit == 0.

Differential Revision: https://reviews.llvm.org/D96896
2021-03-01 21:28:14 +01:00
Nico Weber 8174f33dc9 [lld/mac] Add support for -flat_namespace
-flat_namespace makes lld emit binaries that use name lookup that's more in
line with other POSIX systems: Instead of looking up symbols as (dylib,name)
pairs by dyld, they're instead looked up just by name.

-flat_namespace has three effects:

1. MH_TWOLEVEL and MH_NNOUNDEFS are no longer set in the Mach-O header
2. All symbols use BIND_SPECIAL_DYLIB_FLAT_LOOKUP as ordinal
3. When a dylib is added to the link, its dependent dylibs are also added,
   so that lld can verify that no undefined symbols remain at the end of
   a link with -flat_namespace. These transitive dylibs are added for symbol
   resolution, but they are not emitted in LC_LOAD_COMMANDs.

-undefined with -flat_namespace still isn't implemented. Before this change,
it was impossible to hit that combination because -flat_namespace caused a
diagnostic. Now that it no longer does, emit a dedicated temporary diagnostic
when both flags are used.

Differential Revision: https://reviews.llvm.org/D97641
2021-03-01 15:25:10 -05:00
Nico Weber 3e6b6cee00 [lld/mac] Use libSystem.dylib instead of libSystem.B.dylib in tests
For -flat_namespace, lld needs to load dylibs in LC_LOAD_DYLIB.
The current setup meant that libSystem.dylib would cause a LC_LOAD_DYLIB
with libSystem.B.dylib, but that didn't exist in our libsysroot for
tests. So just drop the .B.

See https://reviews.llvm.org/D97641#2595237 and
https://reviews.llvm.org/D97641#2595270
2021-03-01 15:23:28 -05:00
Nico Weber 2e803ec746 [lld/mac on non-mac] fix test/MachO/search-paths.test after ab45289d2e 2021-03-01 15:21:24 -05:00
peter klausler 5a451a4289 [flang] Runtime: SCAN and VERIFY
Implement the related character intrinsic functions
SCAN and VERIFY.

Differential Revision: https://reviews.llvm.org/D97580
2021-03-01 12:15:29 -08:00
Med Ismail Bennani 46796762af [lldb/Plugins] Add ScriptedProcess Process Plugin
This patch introduces Scripted Processes to lldb.

The goal, here, is to be able to attach in the debugger to fake processes
that are backed by script files (in Python, Lua, Swift, etc ...) and
inspect them statically.

Scripted Processes can be used in cooperative multithreading environments
like the XNU Kernel or other real-time operating systems, but it can
also help us improve the debugger testing infrastructure by writting
synthetic tests that simulates hard-to-reproduce process/thread states.

Although ScriptedProcess is not feature-complete at the moment, it has
basic execution capabilities and will improve in the following patches.

rdar://65508855

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-03-01 21:13:32 +01:00
Med Ismail Bennani 2cff3dec11 [lldb/bindings] Add Python ScriptedProcess base class to lldb module
In order to facilitate the writting of Scripted Processes, this patch
introduces a `ScriptedProcess` python base class in the lldb module.

The base class holds the python interface with all the - abstract -
methods that need to be implemented by the inherited class but also some
methods that can be overwritten.

This patch also provides an example of a Scripted Process with the
`MyScriptedProcess` class.

rdar://65508855

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-03-01 21:13:32 +01:00
Med Ismail Bennani 182f0d1a34 [lldb/Interpreter] Add ScriptInterpreter Wrapper for ScriptedProcess
This patch adds a ScriptedProcess interface to the ScriptInterpreter and
more specifically, to the ScriptInterpreterPython.

This interface will be used in the C++ `ScriptProcess` Process Plugin to
call the script methods.

At the moment, not all methods are implemented, they will upstreamed in
upcoming patches.

This patch also adds helper methods to the ScriptInterpreter to
convert `SBAPI` Types (SBData & SBError) to `lldb_private` types
(DataExtractor & Status).

rdar://65508855

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-03-01 21:13:31 +01:00
Med Ismail Bennani d62a53aaf1 [lldb/Commands] Add command options for ScriptedProcess to ProcessLaunch
This patch adds a new command options to the CommandObjectProcessLaunch
for scripted processes.

Among the options, the user need to specify the class name managing the
scripted process. The user can also use a key-value dictionary holding
arbitrary data that will be passed to the managing class.

This patch also adds getters and setters to `SBLaunchInfo` for the
class name managing the scripted process and the dictionary.

rdar://65508855

Differential Review: https://reviews.llvm.org/D95710

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-03-01 21:13:31 +01:00
Med Ismail Bennani 103ad3f907 [lldb/Commands] Fix short option collision for `process launch`
This patch changes the short option used in `CommandOptionsProcessLaunch`
for the `-v|--environment` command option to `-E|--environment`.

The reason for that is, that it collides with the `-v|--structured-data-value`
command option generated by `OptionGroupPythonClassWithDict` that
I'm using in an upcoming patch for the `process launch` command.

The long option `--environment` remains the same.

Differential Review: https://reviews.llvm.org/D95100

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-03-01 21:13:31 +01:00
Nico Weber ab45289d2e [lld/mac] Make -v print version and search paths in additon to linking, not instead of linking
This matches ld64's behavior.

Differential Revision: https://reviews.llvm.org/D97718
2021-03-01 15:09:46 -05:00
Nico Weber bacacb9d5c [lld/mac] Prefix errors with "ld64.lld" instead of just "lld"
Matches the ELF and COFF ports, which use ld.lld and lld-link, respectively.

While here, also move up `cleanupCallback` to match ELF / COFF.

Differential Revision: https://reviews.llvm.org/D97715
2021-03-01 15:08:19 -05:00
Sanjay Patel fd64580f74 [AArch64] add tests for select-of-bools; NFC 2021-03-01 15:01:45 -05:00
Sanjay Patel bcd504d8a3 [x86] add tests for select-of-bools; NFC 2021-03-01 15:01:45 -05:00
Wouter van Oortmerssen a0f4526836 [WebAssembly] Fix split-dwarf not emitting DW_OP_WASM_location correctly
It was using the regular path for target indices that uses uleb, but TI_GLOBAL_RELOC needs to be uint32_t.
Introduced here: https://reviews.llvm.org/D85685
Fixes: https://github.com/emscripten-core/emscripten/issues/13240

Differential Revision: https://reviews.llvm.org/D97564
2021-03-01 11:53:30 -08:00
Jan Kratochvil 011e7bcaa3 Revert "[lldb] Fix handling of `DW_AT_decl_file` according to D91014"
This reverts commit 7ec7876fed.

Non-x86_64 non-Linux bots broke by the testcase.
2021-03-01 20:45:30 +01:00
Jez Ng 922de2574c [lld-macho] Partial revert of D95204
Trying to unbreak https://lab.llvm.org/buildbot/#/builders/57/builds/4753

I'm not able to repro the failures locally so... here's hoping
2021-03-01 11:29:42 -08:00
Shoaib Meenai 015d78a25e [lldb] Remove XPCServices symlinking
This is a downstream change that was accidentally included upstream.

Reviewed By: vsk

Differential Revision: https://reviews.llvm.org/D97701
2021-03-01 11:23:46 -08:00
Rob Suderman 087bc20fe4 [MLIR][TOSA] Lower tosa.transpose to linalg.generic
Lowers the transpose operation to a generic linalg op when permutations
is a constant value.

Reviewed By: mravishankar

Differential Revision: https://reviews.llvm.org/D97508
2021-03-01 11:09:49 -08:00
Vedant Kumar 2fcc3f4b18 [test/profile] Disable instrprof-write-buffer-internal.c on Windows
This is failing due to:

"instrprof-write-buffer-internal.c.tmp.buf.profraw: Invalid
instrumentation profile data (file header is corrupt)"

https://lab.llvm.org/buildbot/#/builders/127/builds/6830
2021-03-01 11:06:38 -08:00
Vedant Kumar 8f7dc99647 [test/profile] Pass -w to suppress suggestion to use fopen_s 2021-03-01 11:06:38 -08:00
Ahmed Taei ea7f211b2e [mlir] Add polynomial approximation for math::ExpOp
Similar to fast_exp in https://github.com/boulos/syrah

Differential Revision: https://reviews.llvm.org/D97599
2021-03-01 11:02:07 -08:00
Martin Storsjö 74c883f7e5 [libcxx] [test] Use the native path types in path.compare
This makes sure that it actually tests the right compare() overloads
in windows configurations.

This also fixes the allocation guards that enforce no allocations
while running the compare() functions.

Differential Revision: https://reviews.llvm.org/D97551
2021-03-01 21:01:46 +02:00
Fangrui Song d942a82a07 Make -f[no-]split-dwarf-inlining CC1 default align with driver default (no inlining)
This makes CC1 and driver defaults consistent.
In addition, for more common cases (-g is specified without -gsplit-dwarf), users will not see -fno-split-dwarf-inlining in CC1 options.

Verified that the below is still true:

* `clang -g` => `splitDebugInlining: false` in DICompileUnit
* `clang -g -gsplit-dwarf` => `splitDebugInlining: false` in DICompileUnit
* `clang -g -gsplit-dwarf -fsplit-dwarf-inlining` => no `splitDebugInlining: false`

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D97706
2021-03-01 10:55:19 -08:00
Emily Shi 71ef54337d [darwin] switch blocking mutex from osspinlock to os_unfair_lock
OSSpinLock is deprecated, so we are switching to `os_unfair_lock`. However, `os_unfair_lock` isn't available on older OSs, so we keep `OSSpinLock` as fallback.

Also change runtime assumption check to static since they only ever check constant values.

rdar://69588111

Reviewed By: delcypher, yln

Differential Revision: https://reviews.llvm.org/D97509
2021-03-01 10:52:47 -08:00
Nathan James 8f9f7d02aa
[clang-tidy] Tweak misc-static-assert fix in c++17
If C++17 mode is enabled and the assert doesn't have a string literal, we can emit a static assert with no message in favour of one with an empty message.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D97313
2021-03-01 18:51:50 +00:00
Vedant Kumar 18adbb86f9 [test/profile] Add test coverage for __llvm_profile_write_buffer_internal
Reviewed By: davidxl, MaskRay

Differential Revision: https://reviews.llvm.org/D97697
2021-03-01 10:46:14 -08:00
Nicolas Guillemot 6fb6bdff37 Fix the value_type of defusechain_iterator to match its operator*()
defusechain_iterator has an operator*() and operator->() that return
references to a MachineOperand, but its "reference" and "pointer"
typedefs are set as if the iterator returns a MachineInstr reference.
This causes compilation errors when defusechain_iterator is used in
generic code that uses the "reference" and "pointer" typedefs.
This patch fixes this by updating the typedefs to use MachineOperand
instead of MachineInstr.

Reviewed By: mkitzan

Differential Revision: https://reviews.llvm.org/D97522
2021-03-01 10:41:10 -08:00
Nathan James 8adfb38224
[clang-tidy] Simplify diagnostics for UniqueptrResetRelease check
Tweak the diagnostics to create small replacements rather than grabbing source text from the lexer.
Also simplified the diagnostic message.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D97632
2021-03-01 18:40:37 +00:00