Jonas Devlieghere [Thu, 20 Aug 2020 22:07:27 +0000 (15:07 -0700)]
[lldb] Extract FileSystem initialization code into helper (NFC)
The FileSystem initialization depends on the reproducer mode. It has
been growing organically to the point where it deserves its own helper
function. This also allows for early returns to simplify the code.
Fangrui Song [Thu, 20 Aug 2020 22:00:25 +0000 (15:00 -0700)]
[test] Replace `yaml2obj >` with `yaml2obj -o` and remove unneeded input redirection
George Mitenkov [Thu, 20 Aug 2020 20:47:35 +0000 (23:47 +0300)]
[MLIR][SPIRVToLLVM] Removed std to llvm patterns from the conversion
Removed the Standard to LLVM conversion patterns that were previously
pulled in for testing purposes. This helps to separate the conversion
to LLVM dialect of the MLIR module with both SPIR-V and Standard
dialects in it (particularly helpful for SPIR-V cpu runner). Also,
tests were changed accordingly.
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D86285
Fangrui Song [Thu, 20 Aug 2020 21:11:08 +0000 (14:11 -0700)]
[llvm-dwarfdump] Fix a typo: witin -> within
Jonas Devlieghere [Thu, 20 Aug 2020 18:36:32 +0000 (11:36 -0700)]
[lldb] Provide GetHomeDirectory wrapper in Host::FileSystem (NFC)
Provider a wrapper around llvm::sys::path::home_directory in the
FileSystem class. This will make it possible for the reproducers to
intercept the call in a central place.
Jon Roelofs [Thu, 20 Aug 2020 20:56:57 +0000 (14:56 -0600)]
Fix a couple of typos. NFC
Simon Pilgrim [Thu, 20 Aug 2020 20:37:51 +0000 (21:37 +0100)]
[X86] Enable constexpr on POPCNT intrinsics (PR31446)
This is a first step patch to enable constexpr support and testing to a large number of x86 intrinsics.
All I've done here is provide a DEFAULT_FN_ATTRS_CONSTEXPR variant to our existing DEFAULT_FN_ATTRS tag approach that adds constexpr on c++ builds. The clang cuda headers do something similar.
I've started with POPCNT mainly as its tiny and are wrappers to generic __builtin_* intrinsics which already act as constexpr.
Differential Revision: https://reviews.llvm.org/D86229
Matt Arsenault [Sat, 8 Aug 2020 16:22:40 +0000 (12:22 -0400)]
CodeGen: Don't drop AA metadata when splitting MachineMemOperands
Assuming this is used to split a memory access into smaller pieces,
the new access should still have the same aliasing properties as the
original memory access. As far as I can tell, this wasn't
intentionally dropped. It may be necessary to drop this if you are
moving the operand outside of the bounds of the original object in
such a way that it may alias another IR object, but I don't think any
of the existing users are doing this. Some of the uses widen into
unused alignment padding, which I think is OK.
Matt Arsenault [Fri, 26 Jun 2020 23:02:46 +0000 (19:02 -0400)]
AMDGPU/GlobalISel: Legalize odd sized loads with widening
Custom lower and widen odd sized loads up to the alignment. The
default set of legalization actions doesn't have a way to represent
this. This fixes naturally aligned <3 x s8> and <3 x s16> loads.
This also starts moving towards eliminating the buggy and
overcomplicated legalization rules for narrowing. All the memory size
changes should be done in the lower or custom action, not NarrowScalar
/ FewerElements. These currently have redundant and ambiguous code
with the lower action.
vnalamot [Thu, 20 Aug 2020 14:18:11 +0000 (19:48 +0530)]
allSGPRSpillsAreDead() should use actual FP/BP frame indices
The SGPR spills happen in SILowerSGPRSpills() and allSGPRSpillsAreDead()
make sure there are no SGPR spills pending during PEI. But the FP/BP
spills happen during PEI and are exceptions.
Use actual frame indices of FP/BP in allSGPRSpillsAreDead() to
accommodate the exceptions.
Differential Revision: https://reviews.llvm.org/D86291
Kamau Bridgeman [Mon, 22 Jun 2020 16:43:03 +0000 (11:43 -0500)]
[PowerPC][PCRelative] Thread Local Storage Support for General Dynamic
This patch is the initial support for the General Dynamic Thread Local
Local Storage model to produce code sequence and relocations correct
to the ABI for the model when using PC relative memory operations.
Patch by: NeHuang
Reviewed By: stefanp
Differential Revision: https://reviews.llvm.org/D82315
Julian Lettner [Fri, 14 Aug 2020 00:26:56 +0000 (17:26 -0700)]
[TSan][Darwin] Remove unnecessary lit substitution
We don't test on very old versions of Apple platforms anymore. The
following lit substitution concerning the minimum deployment target for
ARC support can be removed.
```
%darwin_min_target_with_full_runtime_arc_support -> 10.11
```
Differential Revision: https://reviews.llvm.org/D85803
Cameron McInally [Thu, 20 Aug 2020 19:36:15 +0000 (14:36 -0500)]
[NFCI][SVE] Move fixed length i32/i64 SDIV tests
Move fixed length SDIV tests from sve-fixed-length-int-arith.ll to sve-fixed-length-int-div.ll. The former uses CHECK lines that verify legalization decisions. That's overkill for the i8/i16 SDIV tests, since they have a tricky legalization.
Julian Lettner [Fri, 14 Aug 2020 01:06:19 +0000 (18:06 -0700)]
[TSan][Darwin] Enable test on non-macOS platforms
After removing the unnecessary `-mmacosx-version-min=10.12` compiler
flag this test can run on all platforms. I confirmed that this test is
green for iOS, iOS simulator, and watchOS simulator.
Differential Revision: https://reviews.llvm.org/D85952
Fangrui Song [Mon, 17 Aug 2020 01:26:13 +0000 (18:26 -0700)]
[llvm-dwarfdump] --statistics: switch to json::OStream. NFC
Then it is trivial to make the output indented (the second parameter of
json::OStream::OStream specifies the indentation).
Reviewed By: jhenderson, echristo
Differential Revision: https://reviews.llvm.org/D86045
Raul Tambre [Thu, 20 Aug 2020 19:15:01 +0000 (22:15 +0300)]
Test commit
Gongyu Deng [Thu, 20 Aug 2020 17:10:34 +0000 (19:10 +0200)]
[lldb] tab completion for breakpoint names
1. created a common completion for breakpoint names;
2. bound the breakpoint name common completion with eArgTypeBreakpointName;
3. implemented the dedicated completion for breakpoint read -N.
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D80693
Cameron McInally [Thu, 20 Aug 2020 18:28:46 +0000 (13:28 -0500)]
[SVE] Lower fixed length vXi8/vXi16 SDIV to scalable
There are no nxv16i8/nxv8i16 SDIV instructions, so these fixed width operations must be promoted to nxv4i32.
Differential Revision: https://reviews.llvm.org/D86114
LLVM GN Syncbot [Thu, 20 Aug 2020 18:24:44 +0000 (18:24 +0000)]
[gn build] Port
1a995a0af3c
Jessica Clarke [Thu, 20 Aug 2020 17:36:50 +0000 (18:36 +0100)]
[RISCV] Enable MCCodeEmitter instruction predicate verifier
This ensures that we never encode an instruction which is unavailable,
such as if we explicitly insert a forbidden instruction when lowering.
This is particularly important on RISC-V given its high degree of
modularity, and will become increasingly important as new standard
extensions appear.
Reviewed By: asb, lenary
Differential Revision: https://reviews.llvm.org/D85015
Roman Lebedev [Thu, 20 Aug 2020 16:16:48 +0000 (19:16 +0300)]
[NFC][InstCombine] Tests for PHI-of-insertvalue's
Currently we don't do anything about these,
neither in InstCombine, nor in SimplifyCFG's sinking.
These happen exceedingly rarely, but i've seen them in the cases where
PHI-aware aggregate reconstruction would have fired if not for them.
Jay Foad [Thu, 20 Aug 2020 16:46:16 +0000 (17:46 +0100)]
[AMDGPU] Remove uses of Register::isPhysicalRegister/isVirtualRegister
... in favour of the isPhysical/isVirtual methods.
Mircea Trofin [Wed, 19 Aug 2020 16:30:52 +0000 (09:30 -0700)]
[NFC] Expose the -Oz module optimization pipeline to opt
This exposes the module optimization pipeline as a pass that can be
applied stand-alone when using 'opt'. This helps ml inliner training
scenarios, where we start with IR captured right before inlining,
perform the inlining (-scc-oz-module-inliner) and then want to continue
and observe the final IR (where this patch comes into play). We can then
apply llc on the resulting IR to continue compilation down to native.
Differential Revision: https://reviews.llvm.org/D86224
Jordan Rupprecht [Thu, 20 Aug 2020 16:15:37 +0000 (09:15 -0700)]
[lldb][asan] Mark destructor as virtual to allow subclasses.
`lldb_private::ScriptInterpreterPython::CommandDataPython` inherits from `lldb_private::BreakpointOptions::CommandData`, but the latter does not have a virtual destructor. This leads to a new-delete-type-mismatch error when running certain tests (such as `functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py`) under asan.
Siva Chandra Reddy [Wed, 19 Aug 2020 08:08:03 +0000 (01:08 -0700)]
[libc] Add a class called NormalFloat which represents normalized floats.
This class helps in dealing with normal and subnormal numbers uniformly.
Moreover, since this class has been designed to handle all floating
formats across platforms, it helps implement floating point functions in
a uniform manner.
The implementations of frexp and logb have been switched to use this new
class as it allows us to use just one implementation across all
different floating point formats.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D86241
Jay Foad [Thu, 20 Aug 2020 15:47:30 +0000 (16:47 +0100)]
[PeepholeOptimizer] Remove dead code
At this point we have already ruled out all def operands, so we can't
possibly see a dead implicit def operand.
Siva Chandra Reddy [Thu, 20 Aug 2020 06:19:44 +0000 (23:19 -0700)]
[libc][NFC] Switch math tests to the new ULP based tolerance.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D86267
Eduardo Caldas [Tue, 18 Aug 2020 12:16:57 +0000 (12:16 +0000)]
[SyntaxTree] Split tests related to Namespace
Differential Revision: https://reviews.llvm.org/D86139
Eduardo Caldas [Thu, 20 Aug 2020 14:18:55 +0000 (14:18 +0000)]
[SyntaxTree] Unify logic for generating `id-expression`
Eduardo Caldas [Wed, 19 Aug 2020 16:43:33 +0000 (16:43 +0000)]
[SyntaxTree] Add support for `MemberExpression`
Differential Revision: https://reviews.llvm.org/D86227
Hans Wennborg [Thu, 20 Aug 2020 14:44:14 +0000 (16:44 +0200)]
lld docs config: Use a list key in html_sidebars
Otherwise the docs-lld-html target fails to build using recent Sphinx
with the following not very helpful error message:
An error happened in rendering the page index.
Reason: TemplateNotFound()
It turns out the values in the html_sidebars dictionary always need to be lists
now. See https://github.com/sphinx-doc/sphinx/issues/6186
Pavel Labath [Mon, 17 Aug 2020 12:18:44 +0000 (14:18 +0200)]
[lldb/Utility] Simplify Scalar handling of float types
Similarly to D85836, collapse all Scalar float types to a single enum
value, and use APFloat semantics to differentiate between. This
simplifies the code, and opens to door to supporting other floating
point semantics (which would be needed for fully supporting
architectures with more interesting float types such as PPC).
Differential Revision: https://reviews.llvm.org/D86220
Alex Bradbury [Thu, 20 Aug 2020 14:12:56 +0000 (15:12 +0100)]
[index-while-building] Fix build with -DBUILD_SHARED_LIBS=True
The dependencies in clang/lib/IndexSerialization/CMakeLists.txt were
incomplete, leading to link errors for a -DBUILD_SHARED_LIBS=True build.
Bevin Hansson [Thu, 20 Aug 2020 13:34:44 +0000 (15:34 +0200)]
Add triples to fixed-point tests which lacked them.
This caused failures on clang-x390x-linux.
David Green [Thu, 20 Aug 2020 13:31:14 +0000 (14:31 +0100)]
[LV] Allow tail folded reduction selects to remain in the loop
The normal scheme for tail folding reductions is to use:
loop:
p = phi(0, a)
mask = ...
x = masked_load(..., mask)
a = add(x, p)
s = select(mask, a, p)
This means we need to keep the register p and a alive out of the loop, plus
the mask. On a target with predicated operations we can instead generate
the phi as p = phi(0, s). This ensures the select in the loop and we can
fold select(m, add(a, b), c) to something like a vaddt c, a, b using the
m predicate. This in turn allows us to tail predicate the entire loop.
Differential Revision: https://reviews.llvm.org/D84741
Raphael Isemann [Thu, 20 Aug 2020 13:23:50 +0000 (15:23 +0200)]
Revert "[compiler-rt] Compile assembly files as ASM not C"
This reverts commit
d58fd4e52197d55bf42ca446c8b0ed31b5c2ec1f. This broke
compiler-rt compilation on macOS:
codesign --sign - /Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/lib/clang/12.0.99/lib/darwin/libclang_rt.tsan_ios_dynamic.dylib
ld: warning: ignoring file projects/compiler-rt/lib/tsan/CMakeFiles/clang_rt.tsan_ios_dynamic.dir/rtl/tsan_rtl_amd64.S.o, building for iOS-arm64 but attempting to link with file built for iOS Simulator-x86_64
ld: warning: ignoring file projects/compiler-rt/lib/tsan/CMakeFiles/clang_rt.tsan_ios_dynamic.dir/rtl/tsan_rtl_aarch64.S.o, building for iOS-arm64 but attempting to link with file built for iOS Simulator-x86_64
Undefined symbols for architecture arm64:
"_wrap__setjmp", referenced from:
substitution__setjmp in tsan_interceptors_posix.cpp.o
"_wrap_setjmp", referenced from:
substitution_setjmp in tsan_interceptors_posix.cpp.o
"_wrap_sigsetjmp", referenced from:
substitution_sigsetjmp in tsan_interceptors_posix.cpp.o
ld: symbol(s) not found for architecture arm64
Pavel Labath [Wed, 19 Aug 2020 13:52:58 +0000 (15:52 +0200)]
[lldb] Forcefully complete a type when adding typedefs
This is very similar to D85968, only more elusive to since we were not
adding the typedef type to the relevant DeclContext until D86140, which
meant that the DeclContext was populated (and the relevant assertion
hit) only after importing the type into the expression ast in a
particular way.
I haven't checked whether this situation can be hit in the gmodules
case, but my money is on "yes".
Differential Revision: https://reviews.llvm.org/D86216
Joachim Priesner [Thu, 20 Aug 2020 13:15:29 +0000 (09:15 -0400)]
Fix -allow-enabling-analyzer-alpha-checkers always being passed to run-clang-tidy.py
The action='store_true' option of argparse.add_argument implicitly
generates a default value of False if the argument is not specified.
Thus, the allow_enabling_alpha_checkers argument of
get_tidy_invocation is never None.
Aleksandr Platonov [Thu, 20 Aug 2020 12:50:13 +0000 (15:50 +0300)]
[clangd] Don't crash on `#pragma clang __debug parser_crash`
Currently, clangd crashes when opening a file with `#pragma clang __debug parser_crash` (e.g. clang/test/Modules/Inputs/crash.h).
This patch disables these crashes.
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D86279
Adam Czachorowski [Thu, 20 Aug 2020 12:48:02 +0000 (14:48 +0200)]
[clangd] Remove useless stderr logging.
This was accidentally added in
53b9199a5cdba8a6e294e1fb183f308ec558db22
Differential Revision: https://reviews.llvm.org/D86284
Bjorn Pettersson [Thu, 20 Aug 2020 12:36:20 +0000 (14:36 +0200)]
[AArch64] Update a code comment incorrectly referring to zero_reg. NFC
The getSrcFromCopy helper nowadays return a MachineOperand pointer,
so talking about zero_reg was incorrect as it nowadays return
a nullptr when not finding a copy like instruction.
Adam Czachorowski [Fri, 14 Aug 2020 14:37:34 +0000 (16:37 +0200)]
[clang] When loading preamble from AST file, re-export modules in Sema.
This addresses a FIXME in ASTReader.
Modules were already re-exported for Preprocessor, but not for Sema.
The result was that, with -fmodules-local-submodule-visibility, all AST
nodes belonging to a module that was loaded in a premable where not
accesible from the main part of the file and a diagnostic recommending
importing those modules would be generated.
Differential Revision: https://reviews.llvm.org/D86069
Adam Czachorowski [Thu, 13 Aug 2020 15:24:22 +0000 (17:24 +0200)]
[clangd] Fix crash-bug in preamble indexing when using modules.
When preamble contains #undef, indexing code finds the matching #define
and uses that during indexing. However, it would only look for local
definitions. If the macro was defined in a module, MacroInfo
would be nullptr and clangd would crash.
This change makes clangd ignore any #undef without a matching #define
inside the same TU.
The indexing of macros happens for preamble only, so then #undef must be
in the preamble, which is why we need two .h files in a test.
Note that clangd is currently not ready for module support, but this
brings us one step closer.
This was previously attempted in
4061d9e42cff621462931ac7df9666806c77a237, but had to be reverted due to
broken test. This version fixes that test-only bug by setting a custom module
cache path to avoid re-use of modules across test invocations.
Differential Revision: https://reviews.llvm.org/D85923
Simon Pilgrim [Thu, 20 Aug 2020 11:41:34 +0000 (12:41 +0100)]
Fix Wdocumentation unknown parameter warning. NFC.
David Green [Thu, 20 Aug 2020 11:24:27 +0000 (12:24 +0100)]
[ARM] Regenerate mve-vabd.ll test. NFC
Shinji Okumura [Thu, 20 Aug 2020 10:52:53 +0000 (19:52 +0900)]
[Attributor] Handle CallBase case in AAValueConstantRange::initialize
Currently, although we handle `CallBase` case in updateImpl, we give up in initialize in the case.
That is problematic when we propagate a range from call site returned position to floating position.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D86196
Vitaly Buka [Thu, 20 Aug 2020 11:12:49 +0000 (04:12 -0700)]
[APInt] Allow self-assignment with libstdc++
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-ubuntu/builds/8256/steps/test-check-all/logs/FAIL%3A%20LLVM%3A%3Athinlto-function-summary-paramaccess.ll
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D86053
Georgii Rymar [Thu, 20 Aug 2020 11:04:30 +0000 (14:04 +0300)]
Revert "[llvm-readobj/elf] - Refine the code for broken PT_DYNAMIC segment diagnostic."
This reverts commit
455d5a8a065b4b93df11d1696dc1546c403465a5.
It broke UBSan:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap-ubsan/builds/21386/steps/check-llvm%20ubsan/logs/stdio
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/test/tools/llvm-readobj/ELF/malformed-pt-dynamic.test:62:10: error: WARN3: expected string not found in input
# WARN3: error: '[[FILE]]': Invalid data was encountered while parsing the file
^
<stdin>:2:1: note: scanning from here
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/tools/llvm-readobj/ELFDumper.cpp:1956:46: runtime error: addition of unsigned offset to 0x0000020c5b30 overflowed to 0x0000020c5b2f
^
<stdin>:2:1: note: with "FILE" equal to "/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/test/tools/llvm-readobj/ELF/Output/malformed-pt-dynamic\\.test\\.tmp3"
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/tools/llvm-readobj/ELFDumper.cpp:1956:46: runtime error: addition of unsigned offset to 0x0000020c5b30 overflowed to 0x0000020c5b2f
^
<stdin>:2:117: note: possible intended match here
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/tools/llvm-readobj/ELFDumper.cpp:1956:46: runtime error: addition of unsigned offset to 0x0000020c5b30 overflowed to 0x0000020c5b2f
^
Input file: <stdin>
Check file: /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/test/tools/llvm-readobj/ELF/malformed-pt-dynamic.test
Paul Walker [Fri, 14 Aug 2020 17:28:38 +0000 (18:28 +0100)]
[SVE] Add ISEL patterns for predicated shifts by an immediate.
For scalable vector shifts the prediacte is typically all active,
which gets selected to an unpredicated shift by immediate. When
code generating for fixed length vectors the predicate is based
on the vector length and so additional patterns are required to
make use of SVE's predicated shift by immediate instructions.
Differential Revision: https://reviews.llvm.org/D86204
David Stenberg [Thu, 20 Aug 2020 07:05:37 +0000 (09:05 +0200)]
[GlobalOpt] Fix an incorrect Modified status
When removing a non-constant store to a global in
CleanupPointerRootUsers(), the GlobalOpt pass could incorrectly return
false.
This was caught using the check introduced by D80916.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D86149
David Stenberg [Thu, 20 Aug 2020 06:28:24 +0000 (08:28 +0200)]
Reland "[LoopUnswitch] Fix incorrect Modified status"
Relanded since the buildbot issue was unrelated to this commit.
When hoisting simple values out from a loop, and an optsize attribute, a
convergent call, or an invoke instruction hindered the pass from
unswitching the loop, the pass would return an incorrect Modified
status.
This was caught using the check introduced by D80916.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D86085
Bjorn Pettersson [Thu, 20 Aug 2020 09:41:05 +0000 (11:41 +0200)]
[DebugInfo] Fix DwarfExpression::addConstantFP for float on big-endian
The byte swapping, when dealing with 4 byte (float) FP constants
in DwarfExpression::addConstantFP, added in commit
ef8992b9f0189005
was not correct. It always performed byte swapping using an
uint64_t value. When dealing with 4 byte values the 4 interesting
bytes ended up in the big end of the uint64_t, but later we emitted
the 4 bytes at the little end. So we ended up with zeroes being
emitted and faulty debug information.
This patch simplifies things a bit, IMHO. Using the APInt
representation throughout the function, instead of looking at
the internal representation using getRawBytes and without using
reinterpret_cast etc. And using API.byteSwap() should result in
correct byte swapping independent of APInt being 4 or 8 bytes.
Differential Revision: https://reviews.llvm.org/D86272
Georgii Rymar [Wed, 19 Aug 2020 11:14:38 +0000 (14:14 +0300)]
[llvm-readobj/elf] - Refine the code for broken PT_DYNAMIC segment diagnostic.
The code that reports "PT_DYNAMIC segment offset + size exceeds the size of the file"
has an issue: it is possible to bypass the validation by overflowing the size + offset result.
Differential revision: https://reviews.llvm.org/D85519
David Stenberg [Thu, 20 Aug 2020 09:11:48 +0000 (11:11 +0200)]
Revert "[LoopUnswitch] Fix incorrect Modified status"
This reverts commit
dfd447c22043b0a64bf1d146735ca33f926bd22d.
After I pushed this commit, llvm-sphinx-docs started failing, due to:
Warning, treated as error:
extension 'recommonmark' has no setup() function;
is it really a Sphinx extension module?
I don't see how this commit may have caused that, but I'm still
reverting it since I don't know how to proceed with that
troubleshooting.
Evgeny Leviant [Thu, 20 Aug 2020 09:13:43 +0000 (12:13 +0300)]
[ThinLTO] Import globals recursively
Differential revision: https://reviews.llvm.org/D73698
Sebastian Neubauer [Thu, 4 Jun 2020 10:22:36 +0000 (12:22 +0200)]
[AMDGPU] Add A16/G16 to InstCombine
When sampling from images with coordinates that only have 16 bit
accuracy, convert the image intrinsic call to use a16 or g16.
This does only happen if the target hardware supports it.
An alternative would be to always apply this combination, independent of
the target hardware and extend 16 bit arguments to 32 bit arguments
during legalization. To me, this sounds like an unnecessary roundtrip
that could prevent some further InstCombine optimizations.
Differential Revision: https://reviews.llvm.org/D85887
Konstantin Schwarz [Tue, 18 Aug 2020 08:32:44 +0000 (10:32 +0200)]
[GlobalISel][IRTranslator] Support PHI instructions in landingpad blocks
The check for the landingpad instructions was overly restrictive. In optimimized builds PHI nodes can appear
before the landingpad instructions, resulting in a fallback to SelectionDAG.
This change relaxes the check to allow PHI nodes.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D86141
Georgii Rymar [Tue, 18 Aug 2020 12:24:26 +0000 (15:24 +0300)]
[yaml2obj] - Make the 'Machine' key optional.
Currently we have to set 'Machine' to something in our
YAML descriptions. Usually we use 'EM_X86_64' for 64-bit targets
and 'EM_386' for 32-bit targets. At the same time, in fact, in most
cases our tests do not need a machine type and we can use
'EM_NONE'.
This is cleaner, because avoids the need of using a particular machine.
In this patch I've made the 'Machine' key optional (the default value,
when it is not specified is `EM_NONE`) and removed it (where possible)
from yaml2obj, obj2yaml and llvm-readobj tests.
There are few tests left where I decided not to remove it, because
I didn't want to touch CHECK lines or doing anything more complex
than a removing a "Machine: *" line and formatting lines around.
Differential revision: https://reviews.llvm.org/D86202
Bevin Hansson [Thu, 20 Aug 2020 08:24:03 +0000 (10:24 +0200)]
Refactor most of the fixed-point tests.
The tests were not written with update_cc_test_checks
in mind, which make them difficult to update. Fix this.
Also, some of the consteval tests were outright broken,
since the CHECK lines were wrong.
Other than this, the semantics of the tests are preserved.
Bevin Hansson [Wed, 5 Aug 2020 14:40:05 +0000 (16:40 +0200)]
[IR] Add FixedPointBuilder.
This patch adds a convenience class for using FixedPointSemantics
to build fixed-point operations in IR.
RFC: http://lists.llvm.org/pipermail/llvm-dev/2020-August/144025.html
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D85314
Bevin Hansson [Thu, 16 Jul 2020 11:56:07 +0000 (13:56 +0200)]
[ADT] Move FixedPoint.h from Clang to LLVM.
This patch moves FixedPointSemantics and APFixedPoint
from Clang to LLVM ADT.
This will make it easier to use the fixed-point
classes in LLVM for constructing an IR builder for
fixed-point and for reusing the APFixedPoint class
for constant evaluation purposes.
RFC: http://lists.llvm.org/pipermail/llvm-dev/2020-August/144025.html
Reviewed By: leonardchan, rjmccall
Differential Revision: https://reviews.llvm.org/D85312
Bevin Hansson [Tue, 4 Aug 2020 10:55:38 +0000 (12:55 +0200)]
[AST] Get field size in chars rather than bits in RecordLayoutBuilder.
In D79719, LayoutField was refactored to fetch the size of field
types in bits and then convert to chars, rather than fetching
them in chars directly. This is not ideal, since it makes the
calculations char size dependent, and breaks for sizes that
are not a multiple of the char size.
This patch changes it to use getTypeInfoInChars instead of
getTypeInfo.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D85191
Arjun P [Thu, 20 Aug 2020 08:07:44 +0000 (13:37 +0530)]
[MLIR] Redundancy detection for FlatAffineConstraints using Simplex
This patch adds the capability to perform constraint redundancy checks for `FlatAffineConstraints` using `Simplex`, via a new member function `FlatAffineConstraints::removeRedundantConstraints`. The pre-existing redundancy detection algorithm runs a full rational emptiness check for each inequality separately for checking redundancy. Leveraging the existing `Simplex` infrastructure, in this patch we have an algorithm for redundancy checks that can check each constraint by performing pivots on the tableau, which provides an alternative to running Fourier-Motzkin elimination for each constraint separately.
Differential Revision: https://reviews.llvm.org/D84935
dfukalov [Wed, 19 Aug 2020 21:14:14 +0000 (00:14 +0300)]
[AMDGPU][LoopUnroll] Increase BB size to analyze for complete unroll.
The `UnrollMaxBlockToAnalyze` parameter is used at the stage when we have no
information about a loop body BB cost. In some cases, e.g. for simple loop
```
for(int i=0; i<32; ++i){
D = Arr2[i*8 + C1];
Arr1[i*64 + C2] += C3 * D;
Arr1[i*64 + C2 + 2048] += C4 * D;
}
```
current default parameter value is not enough to run deeper cost analyze so the
loop is not completely unrolled.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D86248
Petr Hosek [Thu, 20 Aug 2020 07:03:45 +0000 (00:03 -0700)]
[compiler-rt] Compile assembly files as ASM not C
It isn't very wise to pass an assembly file to the compiler and tell it to compile as a C file and hope that the compiler recognizes it as assembly instead.
Instead enable the ASM language and mark the files as being ASM.
[525/634] Building C object lib/tsan/CMakeFiles/clang_rt.tsan-aarch64.dir/rtl/tsan_rtl_aarch64.S.o
FAILED: lib/tsan/CMakeFiles/clang_rt.tsan-aarch64.dir/rtl/tsan_rtl_aarch64.S.o
/opt/tooling/drive/host/bin/clang --target=aarch64-linux-gnu -I/opt/tooling/drive/llvm/compiler-rt/lib/tsan/.. -isystem /opt/tooling/drive/toolchain/opt/drive/toolchain/include -x c -Wall -Wno-unused-parameter -fno-lto -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-non-virtual-dtor -fPIE -fno-rtti -Wframe-larger-than=530 -Wglobal-constructors --sysroot=. -MD -MT lib/tsan/CMakeFiles/clang_rt.tsan-aarch64.dir/rtl/tsan_rtl_aarch64.S.o -MF lib/tsan/CMakeFiles/clang_rt.tsan-aarch64.dir/rtl/tsan_rtl_aarch64.S.o.d -o lib/tsan/CMakeFiles/clang_rt.tsan-aarch64.dir/rtl/tsan_rtl_aarch64.S.o -c /opt/tooling/drive/llvm/compiler-rt/lib/tsan/rtl/tsan_rtl_aarch64.S
/opt/tooling/drive/llvm/compiler-rt/lib/tsan/rtl/tsan_rtl_aarch64.S:29:1: error: expected identifier or '('
.section .text
^
1 error generated.
Fixed Clang not being passed as the assembly compiler for compiler-rt runtime build.
Patch By: tambre
Differential Revision: https://reviews.llvm.org/D85706
Yvan Roux [Thu, 20 Aug 2020 07:25:33 +0000 (09:25 +0200)]
[ARM][MachineOutliner] Add default mode.
Use the stack to save and restore the link register when there is no
available register to do it.
Differential Revision: https://reviews.llvm.org/D76069
David Stenberg [Thu, 20 Aug 2020 06:28:24 +0000 (08:28 +0200)]
[LoopUnswitch] Fix incorrect Modified status
When hoisting simple values out from a loop, and an optsize attribute, a
convergent call, or an invoke instruction hindered the pass from
unswitching the loop, the pass would return an incorrect Modified
status.
This was caught using the check introduced by D80916.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D86085
Johannes Doerfert [Tue, 18 Aug 2020 20:54:05 +0000 (15:54 -0500)]
[Attributor][FIX] Update the call graph properly when internalizing functions
The internal version is now part of the SCC, make sure to perform this
update.
Johannes Doerfert [Tue, 18 Aug 2020 15:03:25 +0000 (10:03 -0500)]
[Attributor] Simplify comparison against constant null pointer
Comparison against null is a common pattern that usually is followed by
error handling code and the likes. We now use AANonNull to simplify
these comparisons optimistically in order to make more code dead early
on.
Reviewed By: uenoku
Differential Revision: https://reviews.llvm.org/D86145
Johannes Doerfert [Tue, 18 Aug 2020 15:01:37 +0000 (10:01 -0500)]
[Attributor][FIX] Do not use cyclic arguments for `nonnull`
`AADereferenceable::getAssumedDereferenceableBytes()` is actually
deducing `dereferenceable_or_null`. We should not use that information
to deduce `nonnull`, since it doesn't imply `nonnull`.
Johannes Doerfert [Sun, 2 Aug 2020 06:54:05 +0000 (01:54 -0500)]
[Attributor][AAIsDead][NFC] Skip uninteresting instructions early
Johannes Doerfert [Sun, 2 Aug 2020 07:03:11 +0000 (02:03 -0500)]
[Attributor][NFC] Improve the depgraph test to make differences clear
Johannes Doerfert [Sun, 2 Aug 2020 05:36:52 +0000 (00:36 -0500)]
[Attributor][NFC] Extract functionality into own member
Fangrui Song [Thu, 20 Aug 2020 05:48:28 +0000 (22:48 -0700)]
[ELF][test] Fix some llvm-objdump RUN lines which don't actually test anything
Qiu Chaofan [Thu, 20 Aug 2020 05:29:43 +0000 (13:29 +0800)]
[PowerPC] Support constrained scalar fptosi/fptoui
This patch adds support for constrained scalar fp to int operations on
PowerPC. Besides, this fixes the FP exception bit of quad-precision
convert & truncate instructions.
Reviewed By: steven.zhang, uweigand
Differential Revision: https://reviews.llvm.org/D81537
Johannes Doerfert [Thu, 20 Aug 2020 05:25:13 +0000 (00:25 -0500)]
Revert "[IR] Intrinsics default attributes and opt-out flag"
This commit introduced a non-trivial compile time regression that needs
to be addressed: https://reviews.llvm.org/D70365#2227627
Given that it is unclear how long that will take, I'll revert it for
now.
This reverts commit
eedf18fc1f5fc71bb896204abf41fc5a2dbf25f7.
Johannes Doerfert [Thu, 20 Aug 2020 05:00:35 +0000 (00:00 -0500)]
Revert "[OpenMPOpt] ICV tracking for calls"
This commits breaks certain OpenMP codes (on power) because it expanded
the Attributor scope without telling the Attributor about the SCC
extend. See: https://reviews.llvm.org/D85544#2227611
This reverts commit
b0b32e649011d9a60165b9b53eb2764b7da9c8ca.
Shilei Tian [Thu, 20 Aug 2020 03:12:02 +0000 (23:12 -0400)]
[OpenMP] Introduce target memory manager
Target memory manager is introduced in this patch which aims to manage target
memory such that they will not be freed immediately when they are not used
because the overhead of memory allocation and free is very large. For CUDA
device, cuMemFree even blocks the context switch on device which affects
concurrent kernel execution.
The memory manager can be taken as a memory pool. It divides the pool into
multiple buckets according to the size such that memory allocation/free
distributed to different buckets will not affect each other.
In this version, we use the exact-equality policy to find a free buffer. This
is an open question: will best-fit work better here? IMO, best-fit is not good
for target memory management because computation on GPU usually requires GBs of
data. Best-fit might lead to a serious waste. For example, there is a free
buffer of size 1960MB, and now we need a buffer of size 1200MB. If best-fit,
the free buffer will be returned, leading to a 760MB waste.
The allocation will happen when there is no free memory left, and the memory
free on device will take place in the following two cases:
1. The program ends. Obviously. However, there is a little problem that plugin
library is destroyed before the memory manager is destroyed, leading to a fact
that the call to target plugin will not succeed.
2. Device is out of memory when we request a new memory. The manager will walk
through all free buffers from the bucket with largest base size, pick up one
buffer, free it, and try to allocate immediately. If it succeeds, it will
return right away rather than freeing all buffers in free list.
Update:
A threshold (8KB by default) is set such that users could control what size of memory
will be managed by the manager. It can also be configured by an environment variable
`LIBOMPTARGET_MEMORY_MANAGER_THRESHOLD`.
Reviewed By: jdoerfert, ye-luo, JonChesterfield
Differential Revision: https://reviews.llvm.org/D81054
Zi Xuan Wu (Zeson) [Thu, 20 Aug 2020 02:58:37 +0000 (10:58 +0800)]
[NFC] It's a test commit, which updates CREDITS.TXT
Tony [Thu, 20 Aug 2020 01:09:12 +0000 (01:09 +0000)]
[AMDGPU] Correct DWARF register defintions
- Rename AMDGPU SCC DWARF register to STATUS since the scalar
condition code is a bit within the STATUS register.
- Correct bit size of the VCC_64 register to 64 which is the size in
wave64 mode.
Differential Revision: https://reviews.llvm.org/D86259
Jonas Devlieghere [Thu, 20 Aug 2020 00:51:50 +0000 (17:51 -0700)]
[lldb] Return empty string from getExtraMakeArgs when not implemented
No return statement means the method returns None which breaks a list
comprehension down the line that expects a str instance.
Craig Topper [Thu, 20 Aug 2020 00:44:21 +0000 (17:44 -0700)]
[X86][AutoUpgrade] Simplify string management in UpgradeDataLayoutString a bit. NFCI
We don't need a std::string for a literal string, we can use a
StringRef.
The addition of StringRefs produces a Twine that we can just call
str() without converting to a SmallString ourselves. Twine will
do that internally.
Rahul Joshi [Wed, 19 Aug 2020 23:07:42 +0000 (16:07 -0700)]
[MLIR] Add PatternRewriter::mergeBlockBefore() to merge a block in the middle of another block.
- This utility to merge a block anywhere into another one can help inline single
block regions into other blocks.
- Modified patterns test to use the new function.
Differential Revision: https://reviews.llvm.org/D86251
Craig Topper [Wed, 19 Aug 2020 22:58:16 +0000 (15:58 -0700)]
[X86] Add support 'tune' in target attribute
This adds parsing and codegen support for tune in target attribute.
I've implemented this so that arch in the target attribute implicitly disables tune from the command line. I'm not sure what gcc does here. But since -march implies -mtune. I assume 'arch' in the target attribute implies tune in the target attribute.
Differential Revision: https://reviews.llvm.org/D86187
Craig Topper [Wed, 19 Aug 2020 22:58:06 +0000 (15:58 -0700)]
[X86] Add mtune command line test cases that should have gone with
4cbceb74bb5676d0181d4d0cab5194d90a42c2ec
Matt Arsenault [Mon, 3 Aug 2020 18:13:38 +0000 (14:13 -0400)]
GlobalISel: Implement fewerElementsVector for G_CONCAT_VECTORS sources
This fixes <6 x s16> = G_CONCAT_VECTORS from <3 x s16> handling.
Richard Smith [Wed, 19 Aug 2020 19:46:52 +0000 (12:46 -0700)]
[c++14] Implement missed piece of N3323: use "converted constant" rules
for array bounds, not "integer constant" rules.
For an array bound of class type, this causes us to perform an implicit
conversion to size_t, instead of looking for a unique conversion to
integral or unscoped enumeration type. This affects which cases are
valid when a class has multiple implicit conversion functions to
different types.
Richard Smith [Wed, 19 Aug 2020 19:46:22 +0000 (12:46 -0700)]
Explain why the array bound is non-constant in VLA diagnostics.
In passing, also use a more precise diagnostic to explain why an
expression is not an ICE if it's not of integral type.
Jonas Devlieghere [Wed, 19 Aug 2020 22:35:29 +0000 (15:35 -0700)]
[lldb] Update TestSimulatorPlatform.py to set ARCH_CFLAGS instead of TRIPLE
I move the triple (de)composition logic into the builder in
e5d08fcbac72
but this test is relying on Make to construct the set the ARCH,
ARCH_CFLAGS and SDKROOT based on the given TRIPLE. This patch updates
the test to pass these variables directly.
Differential revision: https://reviews.llvm.org/D86244
Med Ismail Bennani [Wed, 19 Aug 2020 20:04:35 +0000 (22:04 +0200)]
[lldb/interpreter] Add REPL-specific init file
This patch adds the infrastructure to have language specific REPL init
files. It's the foundation work to a following patch that will introduce
Swift REPL init file.
When lldb is launched with the `--repl` option, it will look for a REPL
init file in the home directory and source it. This overrides the
default `~/.lldbinit`, which content might make the REPL behave
unexpectedly. If the REPL init file doesn't exists, lldb will fall back
to the default init file.
rdar://
65836048
Differential Revision: https://reviews.llvm.org/D86242
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Dokyung Song [Wed, 19 Aug 2020 20:21:05 +0000 (20:21 +0000)]
[libFuzzer] Fix value-profile-load test.
The behavior of the CrossOver mutator has changed with
bb54bcf84970c04c9748004f3a4cf59b0c1832a7. This seems to affect the
value-profile-load test on Darwin. This patch provides a wider margin for
determining success of the value-profile-load test, by testing the targeted
functionality (i.e., GEP index value profile) more directly and faster. To this
end, LoadTest.cpp now uses a narrower condition (Size != 8) for initial pruning
of inputs, effectively preventing libFuzzer from generating inputs longer than
necessary and spending time on mutating such long inputs in the corpus - a
functionality not meant to be tested by this specific test.
Previously, on x86/Linux, it required 6,597,751 execs with -use_value_profile=1
and 19,605,575 execs with -use_value_profile=0 to hit the crash. With this
patch, the test passes with 174,493 execs, providing a wider margin from the
given trials of 10,000,000. Note that, without the value profile (i.e.,
-use_value_profile=0), the test wouldn't pass as it still requires 19,605,575
execs to hit the crash.
Differential Revision: https://reviews.llvm.org/D86247
Matt Morehouse [Wed, 19 Aug 2020 22:07:17 +0000 (15:07 -0700)]
[DFSan] Handle mmap() calls before interceptors are installed.
InitializeInterceptors() calls dlsym(), which calls calloc(). Depending
on the allocator implementation, calloc() may invoke mmap(), which
results in a segfault since REAL(mmap) is still being resolved.
We fix this by doing a direct syscall if interceptors haven't been fully
resolved yet.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D86168
Siva Chandra Reddy [Wed, 19 Aug 2020 21:44:23 +0000 (14:44 -0700)]
[libc][obvious] Fix x86 long double conversion to integer.
Fixes incorrectly constructed ceill tests.
Francesco Petrogalli [Wed, 19 Aug 2020 19:50:24 +0000 (19:50 +0000)]
[llvm] Add default constructor of `llvm::ElementCount`.
This patch prevents failures like those reported in
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/34173.
We have enabled the default constructor for
`llvm::ElementCount` to make sure the code compiles on Windows.
Reviewed By: ormris
Differential Revision: https://reviews.llvm.org/D86240
Petr Hosek [Wed, 19 Aug 2020 21:33:52 +0000 (14:33 -0700)]
[CMake] Fix an issue where get_system_libname creates an empty regex capture on windows
Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=1119478
Patch By: haampie
Differential Revision: https://reviews.llvm.org/D86245
Kyungwoo Lee [Wed, 19 Aug 2020 21:28:06 +0000 (17:28 -0400)]
Force Remove Attribute
-force-attribute adds an attribute to function via command-line.
However, there was no counter-part to remove an attribute. This patch
adds -force-remove-attribute that removes an attribute from function.
Differential Revision: https://reviews.llvm.org/D85586
Sanjay Patel [Wed, 19 Aug 2020 20:32:24 +0000 (16:32 -0400)]
[ValueTracking] define/use max recursion depth in header
There's a potential motivating case to increase this limit in PR47191:
http://bugs.llvm.org/PR47191
But first we should make it less hacky. The limit in InstCombine is directly tied
to this value because an increase there can cause asserts in the underlying value
tracking calls if not changed together. The usage in VectorUtils is independent,
but the comment suggests that we should use the same value unless there's a known
reason to diverge. There are similar limits in codegen analysis, but I think we
should leave those independent in case we intentionally want the optimization
power/cost to be different there.
Differential Revision: https://reviews.llvm.org/D86113
Mars Saxman [Wed, 19 Aug 2020 20:45:18 +0000 (22:45 +0200)]
Implement FPToUI and UIToFP ops in standard dialect
Add the unsigned complements to the existing FPToSI and SIToFP operations in the
standard dialect, with one-to-one lowerings to the corresponding LLVM operations.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D85557
Hiroshi Yamauchi [Fri, 14 Aug 2020 19:20:08 +0000 (12:20 -0700)]
[X86] Add feature for Fast Short REP MOV (FSRM) for Icelake or newer.
Differential Revision: https://reviews.llvm.org/D85989
Jonas Devlieghere [Wed, 19 Aug 2020 20:25:57 +0000 (13:25 -0700)]
[lldb] Move Xcode SDK helper functions into lldbutil
This allows the logic to be reused by both the builders and the tests.