Duncan P. N. Exon Smith [Sun, 10 Nov 2019 19:07:20 +0000 (11:07 -0800)]
clang/Modules: Add missing diagnostics for malformed AST files
These were found via an audit. In the case of `ParseLineTable` this is
actually dead code, since parsing the line table always succeeds, but
it's prudent to be defensive since it's possible an assertion there
could be converted to a `true` return in the future.
Jonas Devlieghere [Mon, 11 Nov 2019 23:58:27 +0000 (15:58 -0800)]
[lldb] Re-enable VSCode tests
The VSCode tests were all disabled on macOS because the implementation
had some issues that resulted in flakiness on Darwin. It seems most of
these issues have been addressed. I've re-enabled all the tests that
consistently passed locally.
Craig Topper [Mon, 11 Nov 2019 23:51:00 +0000 (15:51 -0800)]
[X86] Add avx512 command lines to vector-constrained-fp-intrinsics.ll. NFC
Craig Topper [Mon, 11 Nov 2019 23:42:25 +0000 (15:42 -0800)]
[X86] Autogenerate checks in fp-intrinsics.ll. Split fma tests off to fp-intrinsics-fma.ll. NFC
Duncan P. N. Exon Smith [Sun, 10 Nov 2019 18:50:12 +0000 (10:50 -0800)]
clang/Modules: Split loop in ReadAST between failable and not
Split a loop in ReadAST that visits the just-loaded module chain,
between an initial loop that reads further from the ASTs (and can fail)
and a second loop that does some preloading (and cannot fail). This
makes it less likely for a reading failure to affect the AST.
This is not fixing a known bug and the behaviour change may not be
observable, it's just part of an audit to look at all of the error
handling in the ASTReader.
https://reviews.llvm.org/D70056
Duncan P. N. Exon Smith [Mon, 11 Nov 2019 23:42:25 +0000 (15:42 -0800)]
clang/Modules: Use range-based for in ASTReader::ReadAST, NFC
Sean Fertile [Mon, 28 Oct 2019 20:07:10 +0000 (16:07 -0400)]
[PowerPC][XCOFF] Add support for zero initialized global values.
For XCOFF, globals mapped into the .bss section are linked as COMMON
definitions. This behaviour is incorrect for zero initialized data, so
emit those to the .data section instead.
Differential Revision: https://reviews.llvm.org/D69528
Victor Huang [Mon, 11 Nov 2019 23:47:47 +0000 (23:47 +0000)]
Fixing PowerPC llc test cases for Disable hoisting MI to hotter basic blocks by adding powerpc triple
Duncan P. N. Exon Smith [Sun, 10 Nov 2019 19:17:42 +0000 (11:17 -0800)]
clang/Modules: Delay err_module_file_conflict if a diagnostic is in flight
As part of an audit of whether all errors are being reported from the
ASTReader, delay err_module_file_conflict if a diagnostic is already in
flight when it is hit. This required plumbing an extra argument through
the delayed diagnostic mechanics in DiagnosticsEngine.
Jonas Devlieghere [Mon, 11 Nov 2019 22:16:52 +0000 (14:16 -0800)]
[Reproducer] Quit the debugger after generating a reproducer
Currently nothing prevents you from continuing your debug session after
generating the reproducer. This can cause the reproducer to end up in an
inconsistent state. Most of the time this doesn't matter, but I want to
prevent this from causing bugs in the future.
Victor Huang [Mon, 11 Nov 2019 21:32:56 +0000 (21:32 +0000)]
Disable hoisting MI to hotter basic blocks
In current Hoist() function of machine licm pass, it will not check the source and destination basic block frequencies that a instruction is hoisted from/to.
There is a chance that instruction is hoisted from a cold to a hot basic block.
In this patch, we add options to disable machine instruction hoisting if destination block is hotter.
Differential Revision: https://reviews.llvm.org/D63676
Evandro Menezes [Mon, 11 Nov 2019 20:27:14 +0000 (14:27 -0600)]
[AArch64] Update for Exynos
Fix the costs of FP register moves.
Evandro Menezes [Mon, 11 Nov 2019 20:24:24 +0000 (14:24 -0600)]
[AArch64] Add new scheduling predicates
Add new scheduling predicates to identify more ASIMD forms.
Sylvestre Ledru [Mon, 11 Nov 2019 20:52:08 +0000 (21:52 +0100)]
clang-format: fix a typo introduced by the previous change
Adrian Prantl [Mon, 11 Nov 2019 20:22:55 +0000 (12:22 -0800)]
Replace tabs with spaces. (NFC)
Adrian Prantl [Sat, 9 Nov 2019 01:35:52 +0000 (17:35 -0800)]
Fix a regression in macOS-style path remapping.
When we switched to the LLVM .debug_line parser, the .dSYM-style path
remapping logic stopped working for relative paths because of how
RemapSourceFile silently fails for relative paths. This patch both
makes the code more readable and fixes this particular bug.
One interesting thing I learned is that Module::RemapSourceFile() is a
macOS-only code path that operates on on the lldb::Module level and is
completely separate from target.source-map, which operates on a
per-Target level.
Differential Revision: https://reviews.llvm.org/D70037
rdar://problem/
56924558
Adrian Prantl [Fri, 8 Nov 2019 22:05:45 +0000 (14:05 -0800)]
Add a testcase for .dSYM path remapping dictionaries.
rdar://problem/
56924558
Thomas Raoux [Mon, 11 Nov 2019 19:25:19 +0000 (11:25 -0800)]
[ModuloSchedule] Fix modulo expansion for data loop carried dependencies.
The new experimental expansion has a problem when a value has a data
dependency with an instruction from a previous stage. This is due to
the way we peel out the kernel. To fix that I'm changing the way we
peel out the kernel. We now peel the kernel NumberStage - 1 times.
The code would be correct at this point if we didn't have to handle
cases where the loop iteration is smaller than the number of stages.
To handle this case we move instructions between different epilogues
based on their stage and remap the PHI instructions correctly.
Differential Revision: https://reviews.llvm.org/D69538
Alexey Bataev [Thu, 7 Nov 2019 16:03:10 +0000 (11:03 -0500)]
[OPENMP50]Generalize handling of context matching/scoring.
Summary:
Untie context matching/scoring from the attribute for declare variant
directive to simplify future uses in other context-dependent directives.
Reviewers: jdoerfert
Subscribers: guansong, kkwli0, caomhin, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D69952
Alexey Bataev [Mon, 11 Nov 2019 18:44:42 +0000 (13:44 -0500)]
[OPENMP50]Add support for nested atomic and simd constructs in
simd-based directives.
According to OpenMP 5.0 standard, ordered simd, atomic and simd
directives are allowed as nested directives in the simd-based
directives.
Simon Pilgrim [Mon, 11 Nov 2019 18:51:14 +0000 (18:51 +0000)]
Add missing override modifiers for FileCheckExpressionAST::eval() overrides.
Simon Pilgrim [Mon, 11 Nov 2019 18:44:13 +0000 (18:44 +0000)]
Make FileCheckNumericVariable::getDefLineNumber const. NFC
Fixes cppcheck warning.
Jonas Devlieghere [Mon, 11 Nov 2019 18:40:06 +0000 (10:40 -0800)]
[debuginfo] Update test to account for missing __debug_macinfo
We no longer emit this section if it's empty.
Sam McCall [Mon, 11 Nov 2019 18:00:44 +0000 (19:00 +0100)]
[clangd] Fix crash in DefineInline::prepare()
Michael Park [Fri, 8 Nov 2019 13:42:26 +0000 (13:42 +0000)]
[libc++][P0980] Marked member functions move/copy/assign of char_traits constexpr.
Reviewers: ldionne, EricWF, mclow.lists
Reviewed By: ldionne
Subscribers: christof, dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D68840
Yitzhak Mandelbaum [Mon, 4 Nov 2019 13:30:18 +0000 (08:30 -0500)]
[libTooling] Further simplify `Stencil` type and introduce `MatchComputation`.
Summary:
This revision introduces a new interface `MatchComputation` which generalizes
the `Stencil` interface and replaces the `std::function` interface of
`MatchConsumer`. With this revision, `Stencil` (as an abstraction) becomes just
one collection of implementations of
`MatchComputation<std::string>`. Correspondingly, we remove the `Stencil` class
entirely in favor of a simple type alias, deprecate `MatchConsumer` and change
all functions that accepted `MatchConsumer<std::string>` to use
`MatchComputation<std::string>` instead.
Reviewers: gribozavr
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D69802
Christopher Ferris [Mon, 11 Nov 2019 17:30:17 +0000 (09:30 -0800)]
[scudo][standalone] Match function name change to bionic name change.
Summary: Bionic was modified to have all function names consistent. Modify the code and get rid of the special case for bionic since it's no longer needed.
Reviewers: cryptoad
Reviewed By: cryptoad
Subscribers: srhines, llvm-commits, #sanitizers
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D70031
Thomas Raoux [Wed, 6 Nov 2019 19:57:05 +0000 (11:57 -0800)]
[ModuloSchedule] Do target loop analysis before peeling.
Simple change to call target hook analyzeLoopForPipelining before
changing the loop. After peeling analyzing the loop may be more
complicated for target that don't have a loop instruction. This doesn't
affect Hexagone and PPC as they have hardware loop instructions.
Differential Revision: https://reviews.llvm.org/D69912
Kevin P. Neal [Wed, 30 Oct 2019 17:55:43 +0000 (13:55 -0400)]
Fix errors where we thought we were checking for labels but weren't due to use of the wrong prefix.
Spotted by Craig Topper in reviewing D69275.
Yi-Hong Lyu [Mon, 11 Nov 2019 16:15:52 +0000 (16:15 +0000)]
[CGP] Make ICMP_EQ use CR result of ICMP_S(L|G)T dominators
For example:
long long test(long long a, long long b) {
if (a << b > 0)
return b;
if (a << b < 0)
return a;
return a*b;
}
Produces:
sld. 5, 3, 4
ble 0, .LBB0_2
mr 3, 4
blr
.LBB0_2: # %if.end
cmpldi 5, 0
li 5, 1
isel 4, 4, 5, 2
mulld 3, 4, 3
blr
But the compare (cmpldi 5, 0) is redundant and can be removed (CR0 already
contains the result of that comparison).
The root cause of this is that LLVM converts signed comparisons into equality
comparison based on dominance. Equality comparisons are unsigned by default, so
we get either a record-form or cmp (without the l for logical) feeding a cmpl.
That is the situation we want to avoid here.
Differential Revision: https://reviews.llvm.org/D60506
Sam McCall [Mon, 11 Nov 2019 17:25:01 +0000 (18:25 +0100)]
[Support] Add erase() to json::Object
Simon Pilgrim [Mon, 11 Nov 2019 17:23:21 +0000 (17:23 +0000)]
Fix filename typo in rG8d288a0668a5
Simon Pilgrim [Mon, 11 Nov 2019 17:19:01 +0000 (17:19 +0000)]
Timer - fix shadow variable warnings for Name/Description members. NFC.
Nick Desaulniers [Mon, 11 Nov 2019 17:10:14 +0000 (09:10 -0800)]
change LLVM_VERSION_SUFFIX default from svn to git
Summary:
Sayonara SVN!
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewers: tstellar, jyknight, lebedev.ri, smeenai, mgorny, hans, mclow.lists
Reviewed By: mgorny, hans
Subscribers: christof, libcxx-commits, llvm-commits, srhines
Tags: #libc, #llvm
Differential Revision: https://reviews.llvm.org/D70019
Sam McCall [Mon, 11 Nov 2019 16:52:31 +0000 (17:52 +0100)]
[Format] Fix clang-format.el unit tests after commit
f349cc37cc485fd5f
Also add a comment that test is not automatically run, and how to run it.
Patch by Philipp Stephani!
Pavel Labath [Mon, 11 Nov 2019 16:52:38 +0000 (17:52 +0100)]
lldb: Fix some -Wdeprecated-copy warnings
gcc-9 started warning when a class defined a copy constructor without a
copy assignment operator (or vice-versa).
This fixes those warnings by deleting the other special member too
(after verifying it doesn't do anything non-trivial).
LLVM GN Syncbot [Mon, 11 Nov 2019 16:47:59 +0000 (16:47 +0000)]
gn build: Merge
8d288a0668a
Abel Kocsis [Mon, 11 Nov 2019 16:47:14 +0000 (17:47 +0100)]
[clang-tidy] Add bugprone-bad-signal-to-kill-thread check and its alias cert-pos44-c
Abel Kocsis [Mon, 11 Nov 2019 16:34:04 +0000 (17:34 +0100)]
Revert "[clang-tidy] Add bugprone-bad-signal-to-kill-thread checker and alias cert-pos44-c"
This reverts commit
4edf0cb0e03e31d468979d0d7dec08bd9f4f8204.
Francis Visoiu Mistrih [Thu, 7 Nov 2019 01:09:55 +0000 (17:09 -0800)]
[ObjC] Override TailCallKind when lowering objc intrinsics
The tail-call-kind-ness is known by the ObjCARC analysis and can be
enforced while lowering the intrinsics to calls.
This allows us to get the requested tail calls at -O0 without trying to
preserve the attributes throughout passes that change code even at -O0
,like the Always Inliner, where the ObjCOpt pass doesn't run.
Differential Revision: https://reviews.llvm.org/D69980
Pavel Labath [Mon, 11 Nov 2019 16:10:46 +0000 (17:10 +0100)]
Fix TestNoGPacketSupported on linux
The mock server pretends the process stopped with signal 17, which is
SIGCHLD on linux. This causes lldb to resume to process, utterly
confusing the test. Lldb probably shouldn't resume in this case, but for
now this issue can be fixed by changing the signal number to 2, which is
SIGINT just about anywhere.
Abel Kocsis [Mon, 11 Nov 2019 16:26:44 +0000 (17:26 +0100)]
[clang-tidy] Add bugprone-bad-signal-to-kill-thread checker and alias cert-pos44-c
Stefan Pintile [Fri, 8 Nov 2019 22:14:28 +0000 (16:14 -0600)]
[PowerPC] Implementing overflow version for XO-Form instructions
The Overflow version of XO-Form instruction uses the SO, OV and
OV32 special registers.
This changes modifies existing multiclasses and instruction
definitions to allow for the use of the XER register to record
the various types if overflow from possible add, subtract and
multiply instructions. It then modifies the existing instructions
as to use these multiclasses as needed.
Patch By: Kamau Bridgeman
Differential Revision: https://reviews.llvm.org/D66902
Haojian Wu [Mon, 11 Nov 2019 15:42:40 +0000 (16:42 +0100)]
[clangd] fixes semantic highlighting test
Summary: fixes https://github.com/clangd/clangd/issues/176
Patch by liu hui!
Reviewers: ilya-biryukov, hokein, sammccall
Reviewed By: hokein
Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang-tools-extra, #clang
Differential Revision: https://reviews.llvm.org/D70078
Martin Probst [Thu, 7 Nov 2019 22:37:06 +0000 (23:37 +0100)]
clang-format: [JS] test declared fields.
Summary:
TypeScript now supports declaring fields:
class Foo {
declare field: string;
}
clang-format happens to already format this fine, so this change just
adds a regression test.
Reviewers: krasimir
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D69972
Martin Probst [Thu, 7 Nov 2019 22:39:03 +0000 (23:39 +0100)]
clang-format: [JS] support null operators.
Summary:
JavaScript / TypeScript is adding two new operators: the null
propagating operator `?.` and the nullish coalescing operator `??`.
const x = foo ?? 'default';
const z = foo?.bar?.baz;
This change adds support to lex and format both.
Reviewers: krasimir
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D69971
Louis Dionne [Mon, 11 Nov 2019 15:21:57 +0000 (10:21 -0500)]
[libc++] Mark __call_once_proxy as hidden and internal
We effectively never want to export that function, which is an
implementation detail of libc++. This was previously tried in
603715c66b6b and then reverted in
8335dd314f36 because it caused
linker warnings. These linker warnings should go away now that we
use internal_linkage instead of always_inline to implement per-TU
insulation.
joanlluch [Mon, 11 Nov 2019 15:15:33 +0000 (16:15 +0100)]
[TargetLowering][DAGCombine][MSP430] Shift Amount Threshold in DAGCombine (4) (Baseline tests)
Summary: Baseline tests before applying D70042
Reviewers: spatel, asl
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70083
Sanjay Patel [Mon, 11 Nov 2019 14:56:03 +0000 (09:56 -0500)]
Revert "[InstCombine] avoid crash from deleting an instruction that still has uses (PR43723) (3rd try)"
This reverts commit
3db8a3ef86e7b3331ab466a78c10a62be9e69829.
This caused a different memory-sanitizer failure than earlier attempts,
but it's still not right.
Sanjay Patel [Mon, 11 Nov 2019 14:27:17 +0000 (09:27 -0500)]
[InstCombine] avoid crash from deleting an instruction that still has uses (PR43723) (3rd try)
Re-try because earlier attempts were reverted due to use-after-free.
Hopefully, diagnosed correctly this time - we replace/remove the
invariant.start first rather than the invariant.end to avoid angering
worklist-based iteration.
We gather a set of white-listed instructions in isAllocSiteRemovable() and then
replace/erase them. But we don't know in general if the instructions in the set
have uses amongst themselves, so order of deletion makes a difference.
There's already a special-case for the llvm.objectsize intrinsic, so add another
for llvm.invariant.start.
Should fix:
https://bugs.llvm.org/show_bug.cgi?id=43723
Differential Revision: https://reviews.llvm.org/D69977
Tom Weaver [Mon, 11 Nov 2019 14:13:33 +0000 (14:13 +0000)]
Revert "[DBG][OPT] Attempt to salvage or undef debug info when removing trivially deletable instructions in the Reassociate Expression pass."
This reverts commit
1984a27db58e9053371ab6d6dc288c81c8a071ac.
Tom Weaver [Mon, 11 Nov 2019 13:47:13 +0000 (13:47 +0000)]
[DBG][OPT] Attempt to salvage or undef debug info when removing trivially deletable instructions in the Reassociate Expression pass.
Reviewed By: aprantl, vsk
Differential revision: https://reviews.llvm.org/D69943
Tom Weaver [Mon, 11 Nov 2019 13:38:34 +0000 (13:38 +0000)]
[NFC][TEST_COMMIT] Add fullstop to comment.
Utkarsh Saxena [Mon, 11 Nov 2019 11:38:17 +0000 (12:38 +0100)]
[clangd] Use name of Macro to compute its SymbolID, NFC.
Summary:
We use the name from the IdentifierInfo of the Macro to compute its
SymbolID. It is better to just take the Name as a parameter to avoid
storing the IdentifierInfo whenever we need the SymbolID for the Macro.
Patch by UTKARSH SAXENA!
Reviewers: hokein
Reviewed By: hokein
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D69937
Simon Pilgrim [Mon, 11 Nov 2019 11:24:09 +0000 (11:24 +0000)]
AArch64FunctionInfo - fix uninitialized variable warnings. NFCI.
Simon Pilgrim [Mon, 11 Nov 2019 11:18:44 +0000 (11:18 +0000)]
Fix -Wcovered-switch-default warning. NFCI.
Simon Pilgrim [Mon, 11 Nov 2019 11:13:32 +0000 (11:13 +0000)]
Fix -Wparentheses warning. NFCI.
Simon Pilgrim [Mon, 11 Nov 2019 10:53:47 +0000 (10:53 +0000)]
Remove superfluous ';' to fix Wpedantic. NFC.
Nuno Lopes [Mon, 11 Nov 2019 10:45:42 +0000 (10:45 +0000)]
docs: fix warning in LangRef parsing
Jay Foad [Fri, 12 Jul 2019 16:33:54 +0000 (17:33 +0100)]
[InstCombine] Simplify binary op when only one operand is a select
Summary:
SimplifySelectsFeedingBinaryOp simplified binary ops when both operands
were selects with the same condition. This patch extends it to handle
these cases where only one operand is a select:
X op (C ? P : Q) -> C ? (X op P) : (X op Q)
// if X op P and X op Q both simplify
(C ? P : Q) op Y -> C ? (P op Y) : (Q op Y)
// if P op Y and Q op Y both simplify
For example: X *fast (C ? 1.0 : 0.0) -> C ? X : 0.0
Reviewers: mcberg2017, majnemer, craig.topper, qcolombet, mcrosier
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D64713
Michał Górny [Mon, 11 Nov 2019 10:01:21 +0000 (11:01 +0100)]
[lldb] [test] Fix typo in TestSendSignal
Hans Wennborg [Mon, 11 Nov 2019 09:51:11 +0000 (10:51 +0100)]
Revert
cdcf58e5af0 "[RISCV] enable LTO support, pass some options to linker."
This started passing target-features on the linker line, not just for RISCV but
for all targets, leading to error messages in Chromium Android build:
'+soft-float-abi' is not a recognized feature for this target (ignoring feature)
'+soft-float-abi' is not a recognized feature for this target (ignoring feature)
See Phabricator review for details.
Reverting until this can be fixed properly.
> Summary:
> 1. enable LTO need to pass target feature and abi to LTO code generation
> RISCV backend need the target feature to decide which extension used in
> code generation.
> 2. move getTargetFeatures to CommonArgs.h and add ForLTOPlugin flag
> 3. add general tools::getTargetABI in CommonArgs.h because different target uses different
> way to get the target ABI.
>
> Patch by Kuan Hsu Chen (khchen)
>
> Reviewers: lenary, lewis-revill, asb, MaskRay
>
> Reviewed By: lenary
>
> Subscribers: hiraditya, dschuff, aheejin, fedor.sergeev, mehdi_amini, inglorion, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, steven_wu, rogfer01, MartinMosbeck, brucehoult, the_o, dexonsmith, rkruppe, PkmX, jocewei, psnobl, benna, Jim, lenary, s.egerton, pzheng, cfe-commits
>
> Tags: #clang
>
> Differential Revision: https://reviews.llvm.org/D67409
Michał Górny [Mon, 11 Nov 2019 09:53:39 +0000 (10:53 +0100)]
[lldb] [test] Mark TestSendSignal XFAIL on NetBSD
Luís Marques [Mon, 11 Nov 2019 09:46:54 +0000 (09:46 +0000)]
[RISCV][NFC] Add nounwind to LKK test functions
Differential Revision: https://reviews.llvm.org/D70067
Haojian Wu [Mon, 11 Nov 2019 09:34:29 +0000 (10:34 +0100)]
[clangd] Fix a regression of not showing documentation from forward declarations.
Summary:
There is a regression from https://reviews.llvm.org/D68467. Unlike class
forward declarations, function ducomentation is written in the declaration in
headers, the function definition doesn't contain any documentation, cases like:
```
foo.h
// this is foo.
void foo();
foo.cc
void foo() {}
```
we should still show documentation from the foo declaration.
Reviewers: ilya-biryukov
Reviewed By: ilya-biryukov
Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D69961
QingShan Zhang [Mon, 11 Nov 2019 09:44:13 +0000 (09:44 +0000)]
[NFC] Add one test to verify the sign_extend of vector type.
joanlluch [Mon, 11 Nov 2019 09:17:57 +0000 (10:17 +0100)]
[TargetLowering][DAGCombine][MSP430] Shift Amount Threshold in DAGCombine (3)
Summary:
Additional filtering of undesired shifts for targets that do not support them efficiently.
Related with D69116 and D69120
Applies the TLI.getShiftAmountThreshold hook to prevent undesired generation of shifts for the following IR code:
```
define i16 @testShiftBits(i16 %a) {
entry:
%and = and i16 %a, -64
%cmp = icmp eq i16 %and, 64
%conv = zext i1 %cmp to i16
ret i16 %conv
}
define i16 @testShiftBits_11(i16 %a) {
entry:
%cmp = icmp ugt i16 %a, 63
%conv = zext i1 %cmp to i16
ret i16 %conv
}
define i16 @testShiftBits_12(i16 %a) {
entry:
%cmp = icmp ult i16 %a, 64
%conv = zext i1 %cmp to i16
ret i16 %conv
}
```
The attached diff file shows the piece code in TargetLowering that is responsible for the generation of shifts in relation to the IR above.
Before applying this patch, shifts will be generated to replace non-legal icmp immediates. However, shifts may be undesired if they are even more expensive for the target.
For all my previous patches in this series (cited above) I added test cases for the MSP430 target. However, in this case, the target is not suitable for showing improvements related with this patch, because the MSP430 does not implement "isLegalICmpImmediate". The default implementation returns always true, therefore the patched code in TargetLowering is never reached for that target. Targets implementing both "isLegalICmpImmediate" and "getShiftAmountThreshold" will benefit from this.
The differential effect of this patch can only be shown for the MSP430 by temporarily implementing "isLegalICmpImmediate" to return false for large immediates. This is simulated with the implementation of a command line flag that was incorporated in D69975
This patch belongs to a initiative to "relax" the generation of shifts by LLVM for targets requiring it
Reviewers: spatel, lebedev.ri, asl
Reviewed By: spatel
Subscribers: lenary, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D69326
Georgii Rymar [Mon, 11 Nov 2019 09:11:54 +0000 (12:11 +0300)]
[FixBB] - Fix one more std::min -> std::min<uint64_t> to make BB happy.
BB: http://lab.llvm.org:8011/builders/clang-armv7-linux-build-cache/builds/22133/steps/build%20stage%201/logs/stdio
Matt Arsenault [Mon, 11 Nov 2019 08:24:21 +0000 (13:54 +0530)]
Use MCRegister in copyPhysReg
Georgii Rymar [Mon, 11 Nov 2019 08:59:38 +0000 (11:59 +0300)]
[FixBB] - An attemp to fix clang-armv7-linux-build-cache builder.
http://lab.llvm.org:8011/builders/clang-armv7-linux-build-cache/builds/22130/steps/build%20stage%201/logs/stdio
/usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/ObjectYAML -I/home/buildslave/buildslave/clang-armv7-linux-build-cache/llvm/llvm/lib/ObjectYAML -I/usr/include/libxml2 -Iinclude -I/home/buildslave/buildslave/clang-armv7-linux-build-cache/llvm/llvm/include -mthumb -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -UNDEBUG -fno-exceptions -fno-rtti -std=c++14 -MMD -MT lib/ObjectYAML/CMakeFiles/LLVMObjectYAML.dir/YAML.cpp.o -MF lib/ObjectYAML/CMakeFiles/LLVMObjectYAML.dir/YAML.cpp.o.d -o lib/ObjectYAML/CMakeFiles/LLVMObjectYAML.dir/YAML.cpp.o -c /home/buildslave/buildslave/clang-armv7-linux-build-cache/llvm/llvm/lib/ObjectYAML/YAML.cpp
/home/buildslave/buildslave/clang-armv7-linux-build-cache/llvm/llvm/lib/ObjectYAML/YAML.cpp:42:41: error: no matching function for call to 'min'
OS.write((const char *)Data.data(), std::min(N, Data.size()));
^~~~~~~~
/usr/bin/../lib/gcc/arm-linux-gnueabihf/5.4.0/../../../../include/c++/5.4.0/bits/algorithmfwd.h:370:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('unsigned long long' vs. 'unsigned int')
min(const _Tp&, const _Tp&);
^
/usr/bin/../lib/gcc/arm-linux-gnueabihf/5.4.0/../../../../include/c++/5.4.0/bits/stl_algo.h:3451:5: note: candidate template ignored: could not match 'initializer_list<type-parameter-0-0>' against 'unsigned long long'
min(initializer_list<_Tp> __l, _Compare __comp)
^
/usr/bin/../lib/gcc/arm-linux-gnueabihf/5.4.0/../../../../include/c++/5.4.0/bits/algorithmfwd.h:375:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
min(const _Tp&, const _Tp&, _Compare);
^
/usr/bin/../lib/gcc/arm-linux-gnueabihf/5.4.0/../../../../include/c++/5.4.0/bits/stl_algo.h:3445:5: note: candidate function template not viable: requires single argument '__l', but 2 arguments were provided
min(initializer_list<_Tp> __l)
^
/home/buildslave/buildslave/clang-armv7-linux-build-cache/llvm/llvm/lib/ObjectYAML/YAML.cpp:46:28: error: no matching function for call to 'min'
for (uint64_t I = 0, E = std::min(N, Data.size() / 2); I != E; ++I) {
^~~~~~~~
/usr/bin/../lib/gcc/arm-linux-gnueabihf/5.4.0/../../../../include/c++/5.4.0/bits/algorithmfwd.h:370:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('unsigned long long' vs. 'unsigned int')
min(const _Tp&, const _Tp&);
^
/usr/bin/../lib/gcc/arm-linux-gnueabihf/5.4.0/../../../../include/c++/5.4.0/bits/stl_algo.h:3451:5: note: candidate template ignored: could not match 'initializer_list<type-parameter-0-0>' against 'unsigned long long'
min(initializer_list<_Tp> __l, _Compare __comp)
^
/usr/bin/../lib/gcc/arm-linux-gnueabihf/5.4.0/../../../../include/c++/5.4.0/bits/algorithmfwd.h:375:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
min(const _Tp&, const _Tp&, _Compare);
^
/usr/bin/../lib/gcc/arm-linux-gnueabihf/5.4.0/../../../../include/c++/5.4.0/bits/stl_algo.h:3445:5: note: candidate function template not viable: requires single argument '__l', but 2 arguments were provided
min(initializer_list<_Tp> __l)
Fix: specify the type for std::min call.
Sander de Smalen [Tue, 5 Nov 2019 16:54:54 +0000 (16:54 +0000)]
[AArch64][SVE] Spilling/filling of SVE callee-saves.
Implement the spills/fills of callee-saved SVE registers using STR and LDR
instructions.
Also adds the `aarch64_sve_vector_pcs` attribute to specify the
callee-saved registers to be used for functions that return SVE vectors or
take SVE vectors as arguments. The callee-saved registers are vector
registers z8-z23 and predicate registers p4-p15.
The overal frame-layout with SVE will be as follows:
+-------------+
| stack args |
+-------------+
| Callee Saves|
| X29, X30 |
|-------------| <- FP
| SVE Callee | < //////////////
| saved regs | < //////////////
| z23 | < //////////////
| : | < // SCALABLE //
| z8 | < //////////////
| p15 | < /// STACK ////
| : | < //////////////
| p4 | < //// AREA ////
+-------------+ < //////////////
| : | < //////////////
| SVE locals | < //////////////
| : | < //////////////
+-------------+
|/////////////| alignment gap.
| : |
| Stack objs |
| : |
+-------------+ <- SP after call and frame-setup
Reviewers: cameron.mcinally, efriedma, greened, thegameg, ostannard, rengolin
Reviewed By: ostannard
Differential Revision: https://reviews.llvm.org/D68996
Georgii Rymar [Fri, 1 Nov 2019 12:24:58 +0000 (15:24 +0300)]
[yaml2obj] - Add a way to describe the custom data that is not part of an output section.
Currently there is no way to describe the data that is not a part of an output section.
It can be a data used to align sections or to fill the gaps with something,
or another kind of custom data. In this patch I suggest a way to describe it. It looks like that:
```
Sections:
- Type: CustomFiller
Pattern: "CCDD"
Size: 4
- Name: .bar
Type: SHT_PROGBITS
Content: "FF"
```
I.e. I've added a kind of synthetic section with a synthetic type "CustomFiller".
In the code it is called a "SyntheticFiller", which is "a synthetic section which
might be used to write the custom data around regular output sections. It does
not present in the sections header table, but it might affect the output file size and
program headers produced. Think about it as about piece of data."
`SyntheticFiller` currently has a `Pattern` field and a `Size` field + an optional `Name`.
When written, `Size` of bytes in the output will be filled with a `Pattern`.
It is possible to reference a named filler it by name from the program headers description,
just like any other normal section.
Differential revision: https://reviews.llvm.org/D69709
Ilya Biryukov [Fri, 8 Nov 2019 15:04:07 +0000 (16:04 +0100)]
[clangd] Fixes colon escaping on Windows
vscode always escapes the colon on the file uri, which causes the semantic highlighting fails on windows.
fixes: https://github.com/clangd/clangd/issues/176
marshall [Sun, 10 Nov 2019 13:44:10 +0000 (13:44 +0000)]
libc++ status page: New papers and issues adopted in Belfast
QingShan Zhang [Mon, 11 Nov 2019 06:54:26 +0000 (06:54 +0000)]
[NFC] Add one test to verify the dependency brings by Macro-Fusion.
Tsang Whitney W.H [Sun, 10 Nov 2019 20:00:30 +0000 (20:00 +0000)]
[DirectedGraph]: Add setTargetNode member function
Summary:Add the setTargetNode member function to class DGEdge.
Authored By:etiotto
Reviewer:bmahjour, Whitney, jdoerfert, Meinersbur, fhahn, kbarton,
dmgreen
Reviewed By:Meinersbur
Subscribers:dexonsmith, kristina, llvm-commits
Tag:LLVM
Differential Revision:https://reviews.llvm.org/D68474
Vladimir Vereschaka [Mon, 11 Nov 2019 01:58:29 +0000 (17:58 -0800)]
Revert "Fixed a profdata file size detection on Windows system."
This reverts commit
bcbb121ff6c8440382abfce8f2911a095f14602b.
Using 'ls -o' is not compatible way to fix the problem. FreeBSD and OSX
version of 'ls' do not support -o flag and test gets failed on these
platforms.
Differential Revision: https://reviews.llvm.org/D69317
Craig Topper [Mon, 11 Nov 2019 00:20:19 +0000 (16:20 -0800)]
[InstCombine] Turn (extractelement <1 x i64/double> (bitcast (x86_mmx))) into a single bitcast from x86_mmx to i64/double.
The _m64 type is represented in IR as <1 x i64>. The x86-64 ABI
on Linux passes <1 x i64> as a double. MMX intrinsics use x86_mmx
type in IR.These things result in a lot of bitcasts in mmx code.
There's another instcombine that tries to turn bitcast <1 x i64>
to double into extractelement and a bitcast.
The combine here tries to reverse this extractelement conversion
if we see an mmx type.
Craig Topper [Sun, 10 Nov 2019 08:34:32 +0000 (00:34 -0800)]
[InstCombine] Add a test case for suboptimal handling of (double (bitcast (<1 x i64> (bitcast (x86_mmx)))))
The outer bitcast gets turned into an extractelement and another
bitcast rather than combining away to a single bitcast from mmx
to double.
Sanjay Patel [Sun, 10 Nov 2019 23:47:49 +0000 (18:47 -0500)]
Revert "[InstCombine] avoid crash from deleting an instruction that still has uses (PR43723) (2nd try)"
This reverts commit
56b2aee1875a1ee47ddf859a6584f8728787fb7b.
Still causes a use-after-free on sanitizer bots.
Sanjay Patel [Sun, 10 Nov 2019 22:24:48 +0000 (17:24 -0500)]
[InstCombine] avoid crash from deleting an instruction that still has uses (PR43723) (2nd try)
Re-try rGef02831f0a4e (reverted due to use-after-free), but bail out completely
if we encounter an unexpected llvm.invariant.start.
We gather a set of white-listed instructions in isAllocSiteRemovable() and then
replace/erase them. But we don't know in general if the instructions in the set
have uses amongst themselves, so order of deletion makes a difference.
There's already a special-case for the llvm.objectsize intrinsic, so add another
for llvm.invariant.end.
Should fix:
https://bugs.llvm.org/show_bug.cgi?id=43723
Differential Revision: https://reviews.llvm.org/D69977
Stefan Stipanovic [Sun, 10 Nov 2019 20:45:11 +0000 (21:45 +0100)]
getArgOperandNo helper function.
Summary: A helper function to get argument number of a arg operand Use.
Reviewers: jdoerfert, uenoku
Subscribers: hiraditya, lebedev.ri, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66844
Duncan P. N. Exon Smith [Sun, 10 Nov 2019 18:31:03 +0000 (10:31 -0800)]
clang/Modules: Remove unused parameter from ModuleManager::removeModules
The other paremeters appear to be sufficient to determine which modules
have just been loaded and need to be removed, so stop collecting and
sending in that set explicitly.
Roman Lebedev [Sun, 10 Nov 2019 16:44:46 +0000 (19:44 +0300)]
[NFC][Codegen] Add `x u% C1 == C2` with C1 u> C2 non-tautological tests
drichards-87 [Sun, 10 Nov 2019 16:27:32 +0000 (09:27 -0700)]
Docs: Updates Sphinx Quickstart template for new contributors
Sanjay Patel [Sun, 10 Nov 2019 16:18:05 +0000 (11:18 -0500)]
Revert "[InstCombine] avoid crash from deleting an instruction that still has uses (PR43723)"
This reverts commit
ef02831f0a4e3b3ccaa45a5589e4cabecbf527ab.
Sanitizer bots fail with this change.
Luís Marques [Sun, 10 Nov 2019 16:04:43 +0000 (16:04 +0000)]
[RISCV] Fix CFA when doing split sp adjustment with fp
Summary: When using the split sp adjustment and using the frame-pointer
we were still emitting CFI CFA directives based on the sp value. The
final sp-based offset also didn't reflect the two-stage sp adjust. There
remain CFI issues that aren't related to the split sp adjustment, and
thus will be addressed in a separate patch.
Reviewers: asb, lenary, shiva0217
Reviewed By: lenary, shiva0217
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D69385
Luís Marques [Sun, 10 Nov 2019 15:56:51 +0000 (15:56 +0000)]
[RISCV][NFC] Add CFI-related tests
Summary: Adds tests necessary to properly show the impact of other
patches that affect the emission of CFI directives.
Reviewers: asb, lenary
Reviewed By: lenary
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D69721
Sanjay Patel [Sun, 10 Nov 2019 14:16:32 +0000 (09:16 -0500)]
[InstCombine] avoid crash from deleting an instruction that still has uses (PR43723)
We gather a set of white-listed instructions in isAllocSiteRemovable() and then
replace/erase them. But we don't know in general if the instructions in the set
have uses amongst themselves, so order of deletion makes a difference.
There's already a special-case for the llvm.objectsize intrinsic, so add another
for llvm.invariant.end.
Should fix:
https://bugs.llvm.org/show_bug.cgi?id=43723
Differential Revision: https://reviews.llvm.org/D69977
Simon Pilgrim [Sun, 10 Nov 2019 12:15:49 +0000 (12:15 +0000)]
Remove unused variable (which allows us to remove vector include). NFC.
Benjamin Kramer [Sun, 10 Nov 2019 11:53:19 +0000 (12:53 +0100)]
[Driver] Remove unused variable. NFC.
Roman Lebedev [Sun, 10 Nov 2019 11:21:50 +0000 (14:21 +0300)]
[NFC][Codegen] Add `x u% C1 == C2` with C1 u<= C2 tautological tests
Simon Pilgrim [Sun, 10 Nov 2019 11:21:43 +0000 (11:21 +0000)]
Twine - fix uninitialized variable warnings. NFCI.
Simon Pilgrim [Sun, 10 Nov 2019 11:19:50 +0000 (11:19 +0000)]
TableGen - fix uninitialized variable warnings. NFCI.
Simon Pilgrim [Sun, 10 Nov 2019 11:18:15 +0000 (11:18 +0000)]
PODSmallVector - fix MSVC uninitialized variable warnings. NFCI.
Simon Pilgrim [Sun, 10 Nov 2019 11:15:39 +0000 (11:15 +0000)]
Path - fix uninitialized variable warnings. NFCI.
Simon Pilgrim [Sun, 10 Nov 2019 11:14:58 +0000 (11:14 +0000)]
CodeGenRegBank - make functions const to fix cppcheck warnings.
Fangrui Song [Sat, 9 Nov 2019 23:20:20 +0000 (15:20 -0800)]
[MC] Clean up MacroInstantiation. NFC
Tsang Whitney W.H [Sun, 10 Nov 2019 05:39:40 +0000 (05:39 +0000)]
[NFC]: Fix PVS Studio warning in LoopNestAnalysis
Summary:This patch fixes the following warnings uncovered by PVS
Studio:
/home/xbolva00/LLVM/llvm-project/llvm/lib/Analysis/LoopCacheAnalysis.cpp
353 warn V612 An unconditional 'return' within a loop.
/home/xbolva00/LLVM/llvm-project/llvm/lib/Analysis/LoopCacheAnalysis.cpp
456 err V502 Perhaps the '?:' operator works in a different way than it
was expected. The '?:' operator has a lower priority than the '=='
operator.
Authored By:etiotto
Reviewer:Meinersbur, kbarton, bmahjour, Whitney, xbolva00
Reviewed By:xbolva00
Subscribers:hiraditya, llvm-commits
Tag:LLVM
Differential Revision:https://reviews.llvm.org/D69821
Craig Topper [Sun, 10 Nov 2019 01:58:56 +0000 (17:58 -0800)]
[X86] Handle MO_ConstantPoolIndex in X86AsmPrinter::PrintOperand
Fixes PR43952