Richard Smith [Thu, 5 Sep 2019 01:23:47 +0000 (01:23 +0000)]
[c++20] Fix some ambiguities in our mangling of lambdas with explicit
template parameters.
This finishes the implementation of the proposal described in
https://github.com/itanium-cxx-abi/cxx-abi/issues/31. (We already
implemented the <lambda-sig> extensions, but didn't take them into
account when computing mangling numbers, and didn't deal properly with
expanded parameter packs, and didn't disambiguate between different
levels of template parameters in manglings.)
llvm-svn: 371004
Yi Kong [Thu, 5 Sep 2019 01:05:05 +0000 (01:05 +0000)]
Revert "Revert "[builtins] Rounding mode support for addxf3/subxf3""
Test failure fixed.
This reverts commit
e204d244badb2e9765a1020f41c773f63da208f4.
llvm-svn: 371003
Artem Dergachev [Thu, 5 Sep 2019 00:44:56 +0000 (00:44 +0000)]
[analyzer] scan-build: handle --sysroot=/path in addition to --sysroot /path.
Current code assumes flags in CompilerLinkerOptionMap don't use =,
which isn't always true.
Patch by Chris Laplante!
Differential Revision: https://reviews.llvm.org/D66569
llvm-svn: 371002
Marshall Clow [Thu, 5 Sep 2019 00:38:36 +0000 (00:38 +0000)]
Reformat the beginning of the testing doc to make clear how to run all the tests.
llvm-svn: 371001
Reid Kleckner [Thu, 5 Sep 2019 00:34:01 +0000 (00:34 +0000)]
Use -mtriple to fix AMDGPU test sensitive to object file format
GOTPCREL32 doesn't exist on COFF, so it isn't used when this test runs
on Windows.
llvm-svn: 371000
Jonas Devlieghere [Wed, 4 Sep 2019 23:05:32 +0000 (23:05 +0000)]
[Disassembler] Simplify a few methods (2/2) (NFC)
Use early returns to highlight preconditions and make the code easier to
follow.
llvm-svn: 370998
Jessica Paquette [Wed, 4 Sep 2019 22:54:52 +0000 (22:54 +0000)]
[AArch64][GlobalISel] Teach AArch64CallLowering to handle basic sibling calls
This adds support for basic sibling call lowering in AArch64. The intent here is
to only handle tail calls which do not change the ABI (hence, sibling calls.)
At this point, it is very restricted. It does not handle
- Vararg calls.
- Calls with outgoing arguments.
- Calls whose calling conventions differ from the caller's calling convention.
- Tail/sibling calls with BTI enabled.
This patch adds
- `AArch64CallLowering::isEligibleForTailCallOptimization`, which is equivalent
to the same function in AArch64ISelLowering.cpp (albeit with the restrictions
above.)
- `mayTailCallThisCC` and `canGuaranteeTCO`, which are identical to those in
AArch64ISelLowering.cpp.
- `getCallOpcode`, which is exactly what it sounds like.
Tail/sibling calls are lowered by checking if they pass target-independent tail
call positioning checks, and checking if they satisfy
`isEligibleForTailCallOptimization`. If they do, then a tail call instruction is
emitted instead of a normal call. If we have a sibling call (which is always the
case in this patch), then we do not emit any stack adjustment operations. When
we go to lower a return, we check if we've already emitted a tail call. If so,
then we skip the return lowering.
For testing, this patch
- Adds call-translator-tail-call.ll to test which tail calls we currently lower,
which ones we don't, and which ones we shouldn't.
- Updates branch-target-enforcement-indirect-calls.ll to show that we fall back
as expected.
Differential Revision: https://reviews.llvm.org/D67189
llvm-svn: 370996
Jonas Devlieghere [Wed, 4 Sep 2019 22:38:20 +0000 (22:38 +0000)]
[Disassembler] Simplify a few methods (NFC)
Use early returns to highlight preconditions and make the code easier to
follow.
llvm-svn: 370994
Richard Smith [Wed, 4 Sep 2019 22:14:50 +0000 (22:14 +0000)]
For PR43213, track whether template parameters are implicit through
template instantiation so we know whether to mangle them in
lambda-expressions.
llvm-svn: 370991
Nico Weber [Wed, 4 Sep 2019 21:34:21 +0000 (21:34 +0000)]
gn build: Merge r370985
llvm-svn: 370988
Richard Smith [Wed, 4 Sep 2019 21:31:22 +0000 (21:31 +0000)]
[www] Fix hyperlink syntax in attribute reference.
llvm-svn: 370987
Richard Smith [Wed, 4 Sep 2019 21:31:21 +0000 (21:31 +0000)]
[www] Update attribute reference for 'constinit'.
llvm-svn: 370986
Puyan Lotfi [Wed, 4 Sep 2019 21:29:10 +0000 (21:29 +0000)]
[mir-canon][NFC] Move MIR vreg renaming code to separate file for better reuse.
Moving MIRCanonicalizerPass vreg renaming code to MIRVRegNamerUtils so that it
can be reused in another pass (ie planing to write a standalone mir-namer pass).
I'm going to write a mir-namer pass so that next time someone has to author a
test in MIR, they can use it to cleanup the naming and make it more readable by
having the numbered vregs swapped out with named vregs.
Differential Revision: https://reviews.llvm.org/D67114
llvm-svn: 370985
Jonas Devlieghere [Wed, 4 Sep 2019 21:18:46 +0000 (21:18 +0000)]
[test] Escape path to match the literal string
This test was failing when you had things like `+` in your build path.
llvm-svn: 370983
Aaron Ballman [Wed, 4 Sep 2019 21:01:57 +0000 (21:01 +0000)]
Diagnose _Atomic as a C11 extension.
llvm-svn: 370982
Yuanfang Chen [Wed, 4 Sep 2019 20:58:15 +0000 (20:58 +0000)]
[DebugInfo] Emit DW_TAG_enumeration_type for referenced global enumerator.
This essentially reverts changes from r361400 while keeping behavior for
CodeView.
Reviewers: akhuang, rnk, probinson
Reviewed by: rnk
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D67141
llvm-svn: 370981
Matt Arsenault [Wed, 4 Sep 2019 20:46:31 +0000 (20:46 +0000)]
AMDGPU/GlobalISel: Select G_BITREVERSE
llvm-svn: 370980
Matt Arsenault [Wed, 4 Sep 2019 20:46:15 +0000 (20:46 +0000)]
GlobalISel: Add basic legalization for G_BITREVERSE
llvm-svn: 370979
Johannes Doerfert [Wed, 4 Sep 2019 20:34:57 +0000 (20:34 +0000)]
[Attributor][Stats] Use the right statistics macro
llvm-svn: 370976
Johannes Doerfert [Wed, 4 Sep 2019 20:34:52 +0000 (20:34 +0000)]
[Attributor][Fix] Make sure we do not delete live code
Summary: Liveness needs to mark edges, not blocks as dead.
Reviewers: sstefan1, uenoku
Subscribers: hiraditya, bollu, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67191
llvm-svn: 370975
Martin Storsjo [Wed, 4 Sep 2019 20:34:00 +0000 (20:34 +0000)]
[LLD] [COFF] Implement MinGW default manifest handling
In mingw environments, resources are normally compiled to resource
object files directly, instead of letting the linker convert them to
COFF format.
Since some time, GCC supports the notion of a default manifest object.
When invoking the linker, GCC looks for the default manifest object
file, and if found in the expected path, it is added to linker commands.
The default manifest is one that indicates support for the latest known
versions of windows, to implicitly unlock the modern behaviours of certain
APIs.
Not all mingw/gcc distributions include this file, but e.g. in msys2,
the default manifest object is distributed in a separate package (which
can be but might not always be installed).
This means that even if user projects only use one single resource
object file, the linker can end up with two resource object files,
and thus needs to support merging them.
The default manifest has a language id of zero, and GNU ld has got
logic for dropping a manifest with a zero language id, if there's
another manifest present with a nonzero language id. If there are
multiple manifests with a nonzero language id, the merging process
errors out.
Differential Revision: https://reviews.llvm.org/D66825
llvm-svn: 370974
Richard Smith [Wed, 4 Sep 2019 20:30:37 +0000 (20:30 +0000)]
[c++20] P1143R2: Add support for the C++20 'constinit' keyword.
This is mostly the same as the
[[clang::require_constant_initialization]] attribute, but has a couple
of additional syntactic and semantic restrictions.
In passing, I added a warning for the attribute form being added after
we have already seen the initialization of the variable (but before we
see the definition); that case previously slipped between the cracks and
the attribute was silently ignored.
llvm-svn: 370972
Leonard Chan [Wed, 4 Sep 2019 20:30:29 +0000 (20:30 +0000)]
[NewPM][Sancov] Make Sancov a Module Pass instead of 2 Passes
This patch merges the sancov module and funciton passes into one module pass.
The reason for this is because we ran into an out of memory error when
attempting to run asan fuzzer on some protobufs (pc.cc files). I traced the OOM
error to the destructor of SanitizerCoverage where we only call
appendTo[Compiler]Used which calls appendToUsedList. I'm not sure where precisely
in appendToUsedList causes the OOM, but I am able to confirm that it's calling
this function *repeatedly* that causes the OOM. (I hacked sancov a bit such that
I can still create and destroy a new sancov on every function run, but only call
appendToUsedList after all functions in the module have finished. This passes, but
when I make it such that appendToUsedList is called on every sancov destruction,
we hit OOM.)
I don't think the OOM is from just adding to the SmallSet and SmallVector inside
appendToUsedList since in either case for a given module, they'll have the same
max size. I suspect that when the existing llvm.compiler.used global is erased,
the memory behind it isn't freed. I could be wrong on this though.
This patch works around the OOM issue by just calling appendToUsedList at the
end of every module run instead of function run. The same amount of constants
still get added to llvm.compiler.used, abd we make the pass usage and logic
simpler by not having any inter-pass dependencies.
Differential Revision: https://reviews.llvm.org/D66988
llvm-svn: 370971
Aaron Ballman [Wed, 4 Sep 2019 20:30:00 +0000 (20:30 +0000)]
Generate parent context id from Decl* instead of DeclContext*.
Because of multiple inheritance, a DeclContext pointer does not produce
the same pointer representation as a Decl pointer that references the
same AST Node.
When dumping the parentDeclContextId field of a node, convert the pointer
to Decl* first, so the id can be used to find the AST node it references.
Patch by Bert Belder.
llvm-svn: 370970
Lang Hames [Wed, 4 Sep 2019 20:26:26 +0000 (20:26 +0000)]
[llvm-rtdyld][llvm-jitlink] Rename struct member to remove ambiguity.
This ambiguity (struct member name matching struct name) was causing errors on
a few of the MSVC bots. Hopefully this should fix it.
llvm-svn: 370969
Lang Hames [Wed, 4 Sep 2019 20:26:25 +0000 (20:26 +0000)]
[llvm-rtdyld] Add timers to match llvm-jitlink.
When using llvm-rtdyld to execute code, -show-times will now show the time
taken to load the object files, apply relocations, and execute the
rtdyld-linked code.
llvm-svn: 370968
Evandro Menezes [Wed, 4 Sep 2019 20:01:09 +0000 (20:01 +0000)]
[InstCombine] Add more test cases (NFC)
Add more test cases simplifying `log()`.
llvm-svn: 370966
Thomas Lively [Wed, 4 Sep 2019 19:50:39 +0000 (19:50 +0000)]
[WebAssembly] Initialize memory in start function
Summary:
- `__wasm_init_memory` is now the WebAssembly start function instead
of being called from `__wasm_call_ctors` or called directly by the
runtime.
- Adds a new synthetic data symbol `__wasm_init_memory_flag` that is
atomically incremented from zero to one by the thread responsible
for initializing memory.
- All threads now unconditionally perform data.drop on all passive
segments.
- Removes --passive-segments and --active-segments flags and controls
segment type based on --shared-memory instead. The deleted flags
were only present to ameliorate the upgrade path in Emscripten.
Reviewers: sbc100, aheejin
Subscribers: dschuff, jgravelle-google, sunfish, jfb, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65783
llvm-svn: 370965
Jonas Devlieghere [Wed, 4 Sep 2019 19:36:29 +0000 (19:36 +0000)]
Revert "[test] Address TestConcurrentMany*.py flakiness on macOS"
This reverts my change to pseudo_barrier.h which isn't necessary anymore
after Fred's fix to debugserver and caused TestThreadStepOut to fail.
llvm-svn: 370963
Alina Sbirlea [Wed, 4 Sep 2019 19:16:04 +0000 (19:16 +0000)]
[MemorySSA] Re-enable MemorySSA use.
Differential Revision: https://reviews.llvm.org/D58311
llvm-svn: 370957
Johannes Doerfert [Wed, 4 Sep 2019 19:01:08 +0000 (19:01 +0000)]
[Attributor][Fix] Ensure the attribute names are created properly
The names of the attributes were not always created properly which
caused problems with the yaml output.
llvm-svn: 370956
Daniel Sanders [Wed, 4 Sep 2019 18:59:43 +0000 (18:59 +0000)]
[globalisel] Support trivial COPY in GISelKnownBits
Summary: Allow GISelKnownBits to look through the trivial case of TargetOpcode::COPY
Reviewers: aditya_nandakumar
Subscribers: rovka, hiraditya, volkan, Petar.Avramovic, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67131
llvm-svn: 370955
Jonas Devlieghere [Wed, 4 Sep 2019 18:59:13 +0000 (18:59 +0000)]
[Python] Implement __next__ for value_iter
Python 3 iteration calls the next() method instead of next() and
value_iter only implemented the Python 2 version.
Differential revision: https://reviews.llvm.org/D67184
llvm-svn: 370954
Jonas Devlieghere [Wed, 4 Sep 2019 18:59:10 +0000 (18:59 +0000)]
[Python] Implement truth testing for lldb.value
Python 3 calls __bool__() instead of __len__() and lldb.value only
implemented the __len__ method. This adds the __bool__() implementation.
Differential revision: https://reviews.llvm.org/D67183
llvm-svn: 370953
Jonas Devlieghere [Wed, 4 Sep 2019 18:59:06 +0000 (18:59 +0000)]
[Python] Fix whitespace before making changes (NFC)
llvm-svn: 370952
Lang Hames [Wed, 4 Sep 2019 18:38:29 +0000 (18:38 +0000)]
[JITLink] Fix the show-timers option on llvm-jitlink.
No longer constantly shows times (even when -show-times=false). When shown,
times are now correctly grouped.
llvm-svn: 370951
Lang Hames [Wed, 4 Sep 2019 18:38:26 +0000 (18:38 +0000)]
[docs] Add some comments to the inline LLJIT example.
llvm-svn: 370950
Philip Reames [Wed, 4 Sep 2019 18:27:31 +0000 (18:27 +0000)]
[NFC] Switch last couple of invariant_load checks to use hasMetadata
llvm-svn: 370948
Evandro Menezes [Wed, 4 Sep 2019 18:15:58 +0000 (18:15 +0000)]
[TargetLibraryInfo] Define enumerator for no library function (NFC)
Add a null enumerator do designate no library function.
llvm-svn: 370947
David Bolvansky [Wed, 4 Sep 2019 18:03:21 +0000 (18:03 +0000)]
[InstCombine] sub(xor(x, y), or(x, y)) -> neg(and(x, y))
Summary:
```
Name: sub(xor(x, y), or(x, y)) -> neg(and(x, y))
%or = or i32 %y, %x
%xor = xor i32 %x, %y
%sub = sub i32 %xor, %or
=>
%sub1 = and i32 %x, %y
%sub = sub i32 0, %sub1
Optimization: sub(xor(x, y), or(x, y)) -> neg(and(x, y))
Done: 1
Optimization is correct!
```
https://rise4fun.com/Alive/8OI
Reviewers: lebedev.ri
Reviewed By: lebedev.ri
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67188
llvm-svn: 370945
Jonas Hahnfeld [Wed, 4 Sep 2019 17:47:37 +0000 (17:47 +0000)]
[OpenMP] Change initialization of __kmp_global
There's no need to initialize variables with static storage duration
because they're implicitly initialized to zero. See
https://en.cppreference.com/w/c/language/initialization#Implicit_initialization
I think that's already relied upon because the supplied 0 only sets
'kmp_time_global_t g_time;' in 'struct kmp_base_global'. The other fields
are not set in the code, but implicitly initialized by the compiler.
Differential Revision: https://reviews.llvm.org/D66292
llvm-svn: 370943
Philip Reames [Wed, 4 Sep 2019 17:46:55 +0000 (17:46 +0000)]
Update CodeGen to use hasMetadata as appropriate [NFC]
My intial grepping for rL370933 missed a directory worth of cases.
llvm-svn: 370942
David Bolvansky [Wed, 4 Sep 2019 17:37:06 +0000 (17:37 +0000)]
[NFC] Added tests for new fold
llvm-svn: 370941
David Bolvansky [Wed, 4 Sep 2019 17:33:53 +0000 (17:33 +0000)]
[NFC] Adjust test filename
llvm-svn: 370939
Craig Topper [Wed, 4 Sep 2019 17:33:38 +0000 (17:33 +0000)]
[X86] Pre-commit test cases and test run line changes for D67087
llvm-svn: 370937
Greg Clayton [Wed, 4 Sep 2019 17:32:51 +0000 (17:32 +0000)]
Add encode and decode methods to InlineInfo and document encoding format to the GSYM file format.
This patch adds the ability to encode and decode InlineInfo objects and adds test coverage. Error handling is introduced in the encoding and decoding which will be used from here on out for remaining patches.
Differential Revision: https://reviews.llvm.org/D66600
llvm-svn: 370936
David Bolvansky [Wed, 4 Sep 2019 17:30:53 +0000 (17:30 +0000)]
[InstCombine] Fold sub (and A, B) (or A, B)) to neg (xor A, B)
Summary:
```
Name: sub(and(x, y), or(x, y)) -> neg(xor(x, y))
%or = or i32 %y, %x
%and = and i32 %x, %y
%sub = sub i32 %and, %or
=>
%sub1 = xor i32 %x, %y
%sub = sub i32 0, %sub1
Optimization: sub(and(x, y), or(x, y)) -> neg(xor(x, y))
Done: 1
Optimization is correct!
```
https://rise4fun.com/Alive/VI6
Found by @lebedev.ri. Also author of the proof.
Reviewers: lebedev.ri, spatel
Reviewed By: lebedev.ri
Subscribers: llvm-commits, lebedev.ri
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67155
llvm-svn: 370934
Philip Reames [Wed, 4 Sep 2019 17:28:48 +0000 (17:28 +0000)]
[Instruction] Add hasMetadata(Kind) helper [NFC]
It's a common idiom, so let's add the obvious wrapper for metadata kinds which are basically booleans.
llvm-svn: 370933
Adrian Prantl [Wed, 4 Sep 2019 17:23:15 +0000 (17:23 +0000)]
Upstream macCatalyst support in debugserver and the macOS dynamic loader
plugin.
Unfortunately the test is currently XFAILed because of missing changes
to the clang driver.
Differential Revision: https://reviews.llvm.org/D67124
llvm-svn: 370931
Johannes Doerfert [Wed, 4 Sep 2019 17:15:37 +0000 (17:15 +0000)]
[OpenMP][Docs] Provide implementation status details
This adds a more fine-grained list of OpenMP features with their
implementation status and associated reviews/commits.
Reviewers: kkwli0, ABataev, RaviNarayanaswamy, gtbercea, Hahnfeld
Subscribers: bollu, guansong, jfb, hfinkel, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64375
llvm-svn: 370930
Matt Arsenault [Wed, 4 Sep 2019 17:12:57 +0000 (17:12 +0000)]
AMDGPU: Handle frame index expansion with no free SGPRs pre gfx9
Since an add instruction must produce an unused carry out, this
requires additional SGPRs. This can be avoided by keeping the entire
offset computation in SGPRs. If one SGPR is still available, this only
costs one extra mov. If none are available, the entire computation can
be done in place and reversed.
This does assume the use is a VGPR operand. This was already assumed,
and we currently only select frame indexes to VALU instructions. This
should probably be fixed at some point to handle more possible MIR.
llvm-svn: 370929
Yuanfang Chen [Wed, 4 Sep 2019 17:10:18 +0000 (17:10 +0000)]
Avoid assemble step in verbose-output-quoting.c
Reviewers: hans
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D65527
llvm-svn: 370928
Matt Arsenault [Wed, 4 Sep 2019 17:06:53 +0000 (17:06 +0000)]
GlobalISel: Add G_BITREVERSE
This is the first failing pattern for AMDGPU and is trivial to handle.
llvm-svn: 370927
Louis Dionne [Wed, 4 Sep 2019 16:41:31 +0000 (16:41 +0000)]
[libc++] Only build with -fvisibility=hidden on Clang
The visibility annotations in libc++ are not quite right for GCC, which
results in symbols not being exported when -fvisibility=hidden is used.
To fix the GCC build bots, this commit reverts to the previous state of
not building with hidden visibility on GCC.
In the future, we can build with hidden visibility all the time and
export symbols explicitly using a list. See https://llvm.org/D66970
for one take at this.
llvm-svn: 370926
Johannes Doerfert [Wed, 4 Sep 2019 16:36:54 +0000 (16:36 +0000)]
[Attributor][NFC] Add assertion to guard against accidental misuse
llvm-svn: 370925
Johannes Doerfert [Wed, 4 Sep 2019 16:35:20 +0000 (16:35 +0000)]
[Attributor] Look at internal functions only on-demand
Summary:
Instead of building attributes for internal functions which we do not
update as long as we assume they are dead, we now do not create
attributes until we assume the internal function to be live. This
improves the number of required iterations, as well as the number of
required updates, in real code. On our tests, the results are mixed.
Reviewers: sstefan1, uenoku
Subscribers: hiraditya, bollu, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66914
llvm-svn: 370924
Fangrui Song [Wed, 4 Sep 2019 16:27:35 +0000 (16:27 +0000)]
[ELF] Don't shrink RelrSection
Fixes PR43214.
The size of SHT_RELR may oscillate between 2 numbers (see D53003 for a
similar --pack-dyn-relocs=android issue). This can happen if the shrink
of SHT_RELR causes it to take more words to encode relocation offsets
(this can happen with thunks or segments with overlapping p_offset
ranges), and the expansion of SHT_RELR causes it to take fewer words to
encode relocation offsets.
To avoid the issue, add padding 1s to the end of the relocation section
if its size would decrease. Trailing 1s do not decode to more relocations.
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D67164
llvm-svn: 370923
Johannes Doerfert [Wed, 4 Sep 2019 16:26:20 +0000 (16:26 +0000)]
[Attributor] Use the white list for attributes consistently
Summary:
We create attributes on-demand so we need to check the white list
on-demand. This also unifies the location at which we create,
initialize, and eventually invalidate new abstract attributes.
The tests show mixed results, a few more call site attributes are
determined which can cause more iterations.
Reviewers: uenoku, sstefan1
Subscribers: hiraditya, bollu, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66913
llvm-svn: 370922
Matt Arsenault [Wed, 4 Sep 2019 16:19:45 +0000 (16:19 +0000)]
AMDGPU/GlobalISel: Make 16-bit constants legal
This is mostly for the benefit of patterns which use 16-bit constants.
llvm-svn: 370921
Matt Arsenault [Wed, 4 Sep 2019 16:19:34 +0000 (16:19 +0000)]
GlobalISel/TableGen: Don't skip REG_SEQUENCE based on patterns
This partially adds support for patterns with REG_SEQUENCE. The source
patterns are now accepted, but the pattern is still rejected due to
missing support for the instruction renderer.
llvm-svn: 370920
Alexander Kornienko [Wed, 4 Sep 2019 16:19:32 +0000 (16:19 +0000)]
[clang-tidy] Fix bugprone-argument-comment bug if there are marcos.
Summary:
Fix bugprone-argument-comment bug if there are marcos.
For example:
```
void j(int a, int b, int c);
j(X(1), /*b=*/1, X(1));
```
clang-tidy can't recognize comment "/*b=*/". It suggests fix like this:
```
j(X(1), /*b=*//*b=*/1, X(1));
```
This change tries to fix this issue.
Reviewers: alexfh, hokein, aaron.ballman
Reviewed By: alexfh
Subscribers: xazax.hun, cfe-commits
Tags: #clang, #clang-tools-extra
Patch by Yubo Xie.
Differential Revision: https://reviews.llvm.org/D67080
llvm-svn: 370919
Matt Arsenault [Wed, 4 Sep 2019 16:19:29 +0000 (16:19 +0000)]
GlobalISel: Define GINodeEquiv for undef
AMDGPU uses this for undef vector elements in some patterns which will
be enabled in a future patch.
llvm-svn: 370918
Johannes Doerfert [Wed, 4 Sep 2019 16:16:13 +0000 (16:16 +0000)]
[Attributor] Deal more explicit with non-exact definitions
Summary:
Before we tried to rule out non-exact definitions early but that lead to
on-demand attributes created for them anyway. As a consequence we needed
to look at the definition in the initialize of each attribute again.
This patch centralized this lookup and tightens the condition under
which we give up on non-exact definitions.
Reviewers: uenoku, sstefan1
Subscribers: hiraditya, bollu, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67115
llvm-svn: 370917
Frederic Riss [Wed, 4 Sep 2019 16:13:12 +0000 (16:13 +0000)]
Workaround TestConcurrentMany* flakiness in a more pricipled way
The flakiness on our local machines seems to come for a race in the kernel
between task_suspend and the creation of the Mach exceptions for the threads
that hit breakpoints. The debugserver code is written with the assumption
that the kernel will be able to provide us with all the exceptions for a
given task once task_suspend returns. On machines with higher core counts,
this seems not to be the case. The first batch of exceptions we get after
task_suspend does not contain exceptions for all the threads that have hit
a breakpoint, thus they get misreprorted in the first stop packet.
Adding a 1ms timeout to the call that retrieves the batch of exceptions
seems to workaround the issue reliably on our machines, and it shoulnd't
impact standard debugging scenarios too much (a stop will incur an additional
1ms delay). We'll be talking to the kernel team to figure out the right
contract for those APIs.
This patch also reverts part of Jonas' previous workaround for the
issue (r370785).
llvm-svn: 370916
Craig Topper [Wed, 4 Sep 2019 16:01:43 +0000 (16:01 +0000)]
[X86] Add support for avx512bf16 for __builtin_cpu_supports and compiler-rt's cpu indicator.
llvm-svn: 370915
Simon Pilgrim [Wed, 4 Sep 2019 16:01:09 +0000 (16:01 +0000)]
[Attributor] Ensure AAIsDead correctly overrides getIRPosition
As commented on D65712, the getIRPosition methods weren't correctly being overridden.
Differential Revision: https://reviews.llvm.org/D67170
llvm-svn: 370914
Krzysztof Parzyszek [Wed, 4 Sep 2019 15:22:36 +0000 (15:22 +0000)]
[Hexagon] Improve generated code for test-if-bit-clear, one more time
Adjust isel patterns after recent commit. Fixes https://llvm.org/PR43194.
llvm-svn: 370913
Jinsong Ji [Wed, 4 Sep 2019 15:22:26 +0000 (15:22 +0000)]
[PowerPC][Altivec][Clang] Check compile-time constant for vec_dst*
Summary:
This is follow up of https://reviews.llvm.org/D66699.
We might get ISEL ICE if we call vec_dss with non const 3rd arg.
```
Cannot select: intrinsic %llvm.ppc.altivec.dst
```
We should check the constraints in clang and generate better error
messages.
Reviewers: nemanjai, hfinkel, echristo, #powerpc, wuzish
Reviewed By: #powerpc, wuzish
Subscribers: wuzish, kbarton, MaskRay, shchenz, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66748
llvm-svn: 370912
Sanjay Patel [Wed, 4 Sep 2019 15:12:55 +0000 (15:12 +0000)]
[InstSimplify] guard against unreachable code (PR43218)
This would crash:
https://bugs.llvm.org/show_bug.cgi?id=43218
llvm-svn: 370911
Ilya Biryukov [Wed, 4 Sep 2019 14:26:28 +0000 (14:26 +0000)]
[Driver] Use shared singleton instance of DriverOptTable
Summary:
This significantly reduces the time required to run clangd tests, by
~10%.
Should also have an effect on other tests that run command-line parsing
multiple times inside a single invocation.
Reviewers: gribozavr, sammccall
Reviewed By: sammccall
Subscribers: kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D67163
llvm-svn: 370908
Alexey Lapshin [Wed, 4 Sep 2019 14:19:49 +0000 (14:19 +0000)]
[Debuginfo][SROA] Need to handle dbg.value in SROA pass.
SROA pass processes debug info incorrecly if applied twice.
Specifically, after SROA works first time, instcombine converts dbg.declare
intrinsics into dbg.value. Inlining creates new opportunities for SROA,
so it is called again. This time it does not handle correctly previously
inserted dbg.value intrinsics.
Differential Revision: https://reviews.llvm.org/D64595
llvm-svn: 370906
Balazs Keri [Wed, 4 Sep 2019 14:12:18 +0000 (14:12 +0000)]
[ASTImporter] Added visibility context check for TypedefNameDecl.
Summary:
ASTImporter makes now difference between typedefs and type aliases
with same name in different translation units
if these are not visible outside.
Reviewers: martong, a.sidorin, shafik, a_sidorin
Reviewed By: martong, shafik
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64480
llvm-svn: 370903
Jinsong Ji [Wed, 4 Sep 2019 14:01:47 +0000 (14:01 +0000)]
[PowerPC][Altivec] Fix constant argument for vec_dss
Summary:
This is similar to vec_ct* in https://reviews.llvm.org/rL304205.
The argument must be a constant, otherwise instruction selection
will fail. always_inline is not enough for isel to always fold
everything away at -O0.
The fix is to turn the function into macros in altivec.h.
Fixes https://bugs.llvm.org/show_bug.cgi?id=43072
Reviewers: nemanjai, hfinkel, #powerpc, wuzish
Reviewed By: #powerpc, wuzish
Subscribers: wuzish, kbarton, MaskRay, shchenz, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66699
llvm-svn: 370902
Sanjay Patel [Wed, 4 Sep 2019 13:38:49 +0000 (13:38 +0000)]
[InstCombine] add tests for insert/extract with identity shuffles; NFC
llvm-svn: 370901
Louis Dionne [Wed, 4 Sep 2019 13:35:03 +0000 (13:35 +0000)]
[libc++] Move __clamp_to_integral to <cmath>, and harden against min()/max() macros
llvm-svn: 370900
Pavel Labath [Wed, 4 Sep 2019 13:26:41 +0000 (13:26 +0000)]
disassemble command: fix error message when disassembly fails
We were printing the start_addr field, which is not correct, as in this
branch we are processing the memory described by cur_range. Print that
instead.
Ideally, in particular this case, the error message would also say
something about not being able to disassemble due to not having found
the module from the core file, but that is not easy to do right now, so
I'm leaving that for another time.
llvm-svn: 370898
Kadir Cetinkaya [Wed, 4 Sep 2019 13:04:34 +0000 (13:04 +0000)]
[clangd] Add TUScheduler.h to CodeComplete.cpp to unbreak builds
llvm-svn: 370895
James Molloy [Wed, 4 Sep 2019 12:57:23 +0000 (12:57 +0000)]
[ModuloSchedule] Fix no-asserts build
Apologies, due to a git SNAFU this fix (dump doesn't exist and silence unused variables) stayed in my index rather than applying to rL370893.
llvm-svn: 370894
James Molloy [Wed, 4 Sep 2019 12:54:24 +0000 (12:54 +0000)]
[ModuloSchedule] Introduce PeelingModuloScheduleExpander
This is the beginnings of a reimplementation of ModuloScheduleExpander. It works
by generating a single-block correct pipelined kernel and then peeling out the
prolog and epilogs.
This patch implements kernel generation as well as a validator that will
confirm the number of phis added is the same as the ModuloScheduleExpander.
Prolog and epilog peeling will come in a different patch.
Differential Revision: https://reviews.llvm.org/D67081
llvm-svn: 370893
Simon Pilgrim [Wed, 4 Sep 2019 12:51:40 +0000 (12:51 +0000)]
Fix "enumeral and non-enumeral type in conditional expression" warnings. NFCI.
llvm-svn: 370892
Louis Dionne [Wed, 4 Sep 2019 12:48:32 +0000 (12:48 +0000)]
[libc++] Add `__truncating_cast` for safely casting float types to integers
This is needed anytime we need to clamp an arbitrary floating point
value to an integer type.
Thanks to Eric Fiselier for the patch.
Differential Revision: https://reviews.llvm.org/D66836
llvm-svn: 370891
David Bolvansky [Wed, 4 Sep 2019 12:46:25 +0000 (12:46 +0000)]
[NFC] Added a negative test for new fold
llvm-svn: 370890
Louis Dionne [Wed, 4 Sep 2019 12:44:19 +0000 (12:44 +0000)]
[libc++] Use __extension__ in a portable manner
llvm-svn: 370889
David Bolvansky [Wed, 4 Sep 2019 12:43:14 +0000 (12:43 +0000)]
[NFC] Fixed test
llvm-svn: 370888
Raphael Isemann [Wed, 4 Sep 2019 12:38:43 +0000 (12:38 +0000)]
[lldb] Fix log statement in Socket::Write
We change num_bytes in this method, so this doesn't actually
log the parameter that we called the function with. No test
as we don't test logging code.
llvm-svn: 370887
David Bolvansky [Wed, 4 Sep 2019 12:22:28 +0000 (12:22 +0000)]
[NFC] Adjust tests for new fold
llvm-svn: 370886
David Bolvansky [Wed, 4 Sep 2019 12:18:53 +0000 (12:18 +0000)]
[NFC] Added tests for new fold
llvm-svn: 370885
Sam McCall [Wed, 4 Sep 2019 12:15:20 +0000 (12:15 +0000)]
[clangd] Fix SelectionTree behavior on implicit 'this'
llvm-svn: 370884
David Bolvansky [Wed, 4 Sep 2019 12:00:33 +0000 (12:00 +0000)]
[InstCombine] Fold sub (or A, B) (and A, B) to (xor A, B)
Summary:
```
Name: sub or and to xor
%or = or i32 %y, %x
%and = and i32 %x, %y
%sub = sub i32 %or, %and
=>
%sub = xor i32 %x, %y
Optimization: sub or and to xor
Done: 1
Optimization is correct!
```
https://rise4fun.com/Alive/eJu
Reviewers: spatel, lebedev.ri
Reviewed By: lebedev.ri
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67153
llvm-svn: 370883
Pavel Labath [Wed, 4 Sep 2019 11:47:20 +0000 (11:47 +0000)]
Fix address sizes in the dwarfdump-debug-loc-error-cases test
the test is building a 64-bit executable, so the addresses should be
64-bit too. The test was still passing even with smaller address size,
but it was hitting the "unexpected end of data" error sooner than it
should.
llvm-svn: 370882
David Bolvansky [Wed, 4 Sep 2019 11:44:00 +0000 (11:44 +0000)]
[NFC] Added a new test for D67153
llvm-svn: 370881
Raphael Isemann [Wed, 4 Sep 2019 11:41:23 +0000 (11:41 +0000)]
[lldb] Limit the amount of zeroes we use for padding when printing small floats
Summary:
We got a radar that printing small floats is not very user-friendly in LLDB as we print them with up to
100 leading zeroes before starting to use scientific notation. This patch changes this by already using
scientific notation when we hit 6 padding zeroes by default and moves this value into a target setting
so that users can just set this number back to 100 if they for some reason preferred the old behaviour.
This new setting is influencing how we format data, so that's why we have to reset the data visualisation
cache when it is changed.
Note that we have always been using scientific notation for large numbers because it seems that
the LLVM implementation doesn't support printing out the padding zeroes for them. I would have fixed
that if it was trivial, but looking at the LLVM implementation for this it seems that this is not as trivial
as it sounds. I would say we look into this if we ever get a bug report about someone wanting to have
a large amount of trailing zeroes in their numbers instead of using scientific notation.
Fixes rdar://
39744137
Reviewers: #lldb, clayborg
Reviewed By: clayborg
Subscribers: JDevlieghere, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D67001
llvm-svn: 370880
Raphael Isemann [Wed, 4 Sep 2019 11:40:29 +0000 (11:40 +0000)]
[lldb] Early exit in RangeDataVector:FindEntryIndexesThatContain
Summary:
We currently spend a lot of time in this function (around 27% of the br-by-regex benchmark in lldb-bench)
by just iterating over all the ranges. We already sorted these ranges by their base address, we we can actually
just stop checking ranges as soon as we find one that has a higher base address.
Reviewers: labath
Reviewed By: labath
Subscribers: amccarth, arphaman, JDevlieghere, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D67123
llvm-svn: 370879
David Bolvansky [Wed, 4 Sep 2019 11:17:08 +0000 (11:17 +0000)]
[NFC] Added tests for 'SUB of OR and AND to XOR' fold
llvm-svn: 370878
Jeremy Morse [Wed, 4 Sep 2019 11:09:05 +0000 (11:09 +0000)]
[DebugInfo] LiveDebugValues: locations with different exprs should not be merged
When comparing variable locations, LiveDebugValues currently considers only
the machine location, ignoring any DIExpression applied to it. This is a
problem because that DIExpression can do pretty much anything to the machine
location, for example dereferencing it.
This patch adds DIExpressions to that comparison; now variables based on the
same register/memory-location but with different expressions will compare
differently, and be dropped if we attempt to merge them between blocks. This
reduces variable coverage-range a little, but only because we were producing
broken locations.
Differential Revision: https://reviews.llvm.org/D66942
llvm-svn: 370877
Nico Weber [Wed, 4 Sep 2019 11:08:09 +0000 (11:08 +0000)]
gn build: Merge r370862
llvm-svn: 370876
Fangrui Song [Wed, 4 Sep 2019 11:02:58 +0000 (11:02 +0000)]
[ELF] Fix spell corrector: don't call elf::InputFile::getSymbols() on shared objects
Exposed by pr34872.s
llvm-svn: 370875
Roman Lebedev [Wed, 4 Sep 2019 10:57:06 +0000 (10:57 +0000)]
Revert "[Clang Interpreter] Initial patch for the constexpr interpreter"
Breaks BUILD_SHARED_LIBS build, introduces cycles in library dependency
graphs. (clangInterp depends on clangAST which depends on clangInterp)
This reverts r370839, which is an yet another recommit of D64146.
llvm-svn: 370874
Simon Pilgrim [Wed, 4 Sep 2019 10:26:39 +0000 (10:26 +0000)]
[cmake] Remove MSVC C4180 override
Tested on VS2017 and VS2019 llvm/clang builds with WX enabled - its no longer necessary to disable this warning.
Differential Revision: https://reviews.llvm.org/D67103
llvm-svn: 370871
Jeremy Morse [Wed, 4 Sep 2019 10:18:03 +0000 (10:18 +0000)]
[LiveDebugValues][NFC] Silence an unused variable warning
On release builds, 'MI' isn't used by anything (it's already inserted into a
block by BuildMI), while on non-release builds it's used by a LLVM_DEBUG
statement. Mark as explicitly used to avoid the warning.
llvm-svn: 370870