Roman Lebedev [Tue, 25 Feb 2020 18:52:19 +0000 (21:52 +0300)]
[SCEV] SCEVExpander::isHighCostExpansionHelper(): cost-model add/mul
Summary:
While this resolves the regression from D73722 in `llvm/test/Transforms/IndVarSimplify/exit_value_test2.ll`,
this now regresses `llvm/test/Transforms/IndVarSimplify/elim-extend.ll` `@nestedIV` test,
we no longer can perform that expansion within default budget of `4`, but require budget of `6`.
That regression is being addressed by D73777.
The basic idea here is simple.
```
Op0, Op1, Op2 ...
| | |
\--+--/ |
| |
\---+---/
```
I.e. given N operands, we will have N-1 operations,
so we have to add cost of an add (mul) for **every** Op processed,
**except** the first one, plus we need to recurse into *every* Op.
I'm guessing there's already canonicalization that ensures we won't
have `1` operand in `scMulExpr`, and no `0` in `scAddExpr`/`scMulExpr`.
Reviewers: reames, mkazantsev, wmi, sanjoy
Reviewed By: mkazantsev
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73728
Roman Lebedev [Tue, 25 Feb 2020 18:52:07 +0000 (21:52 +0300)]
[SCEV] SCEVExpander::isHighCostExpansionHelper(): cost-model plain UDiv
Summary:
If we don't believe this UDiv is actually a LShr in disguise, things are much worse.
First, we try to see if this UDiv actually originates from user code,
by looking for `S + 1`, and if found considering this UDiv to be free.
But otherwise, we always considered this UDiv to be high-cost.
However that is no longer the case with TTI-driven cost model:
our default budget is 4, which matches the default cost of UDiv,
so now we allow a single UDiv to not be counted as high-cost.
While that is the case, it is evident this is actually a regression
due to the fact that cost-modelling is incomplete - we did not account
for the `add`, `mul` costs yet. That is being addressed in D73728.
Cost-modelling for UDiv also seems pretty straight-forward:
subtract cost of the UDiv itself, and recurse into both the LHS and RHS.
Reviewers: reames, mkazantsev, wmi, sanjoy
Reviewed By: mkazantsev
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73722
Roman Lebedev [Tue, 25 Feb 2020 19:16:29 +0000 (22:16 +0300)]
[NFC][IndVarSimplify] Adjust value names in IndVarSimplify/exit_value_test2.ll
%tmp prefix confuses auto-update scripts
Roman Lebedev [Tue, 25 Feb 2020 18:51:22 +0000 (21:51 +0300)]
[SCEV] SCEVExpander::isHighCostExpansionHelper(): cost-model UDiv by power-of-two as LShr
Summary:
Like with casts, we need to subtract the cost of `lshr` instruction
from budget, and recurse into LHS operand.
Seems "pretty obviously correct" to me?
To be noted, there is a number of other shortcuts we //could// cost-model:
* `... + (-1 * ...)` -> `... - ...` <- likely very frequent case
* `x - (rem x, power-of-2)`, which is currently `(x udiv power-of-2) * power-of-2` -> `x & -log2(power-of-2)`
* `rem x, power-of-2`, which is currently `x - ((x udiv power-of-2) * power-of-2)` -> `x & log2(power-of-2)-1`
* `... * power-of-2` -> `... << log2(power-of-2)` <- likely not very beneficial
Reviewers: reames, mkazantsev, wmi, sanjoy
Reviewed By: mkazantsev
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73718
Roman Lebedev [Tue, 25 Feb 2020 18:51:16 +0000 (21:51 +0300)]
[SCEV] SCEVExpander::isHighCostExpansionHelper(): begin cost modelling - model cast cost
Summary:
This is not a NFC, although it does not change any of the existing tests.
I'm not really sure if we should have specific tests for the cost modelling itself.
This is the first patch that actually makes `SCEVExpander::isHighCostExpansionHelper()`
account for the cost of the SCEV expression, and consider the budget available,
by modelling cast expressions.
I believe the logic itself is "pretty obviously correct" - from budget,
we need to subtract the cost of the cast expression from inner type `Op->getType()`
to the `S->getType()` type, and recurse into the expression we are casting.
Reviewers: reames, mkazantsev, wmi, sanjoy
Reviewed By: mkazantsev
Subscribers: xbolva00, hiraditya, javed.absar, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73716
Roman Lebedev [Tue, 25 Feb 2020 18:51:12 +0000 (21:51 +0300)]
[SCEV] SCEVExpander::isHighCostExpansion(): assert if TTI is not provided
Summary:
Currently, as per `check-llvm`, we never call `SCEVExpander::isHighCostExpansion()` with null TTI,
so this appears to be a safe restriction.
Reviewers: reames, mkazantsev, wmi, sanjoy
Reviewed By: mkazantsev
Subscribers: javed.absar, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73712
Roman Lebedev [Tue, 25 Feb 2020 18:51:06 +0000 (21:51 +0300)]
[NFC][SCEV] SCEVExpander::isHighCostExpansionHelper(): check that we processed expression first
Summary:
As far as i can tell this is still NFC.
Initially in rL146438 it was added at the top of the function,
later rL238507 dethroned it, and rL244474 did it again.
I'm not sure if we have already checked the cost of this expansion, we should be doing that again.
Reviewers: reames, mkazantsev, wmi, sanjoy, atrick, igor-laevsky
Reviewed By: mkazantsev
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73706
Roman Lebedev [Tue, 25 Feb 2020 18:51:02 +0000 (21:51 +0300)]
[NFC][SCEV] Piping to pass new SCEVCheapExpansionBudget option into SCEVExpander::isHighCostExpansionHelper()
Summary:
In future patches`SCEVExpander::isHighCostExpansionHelper()` will respect the budget allocated by performing TTI cost modelling.
This is a fully NFC patch to make things reviewable.
Reviewers: reames, mkazantsev, wmi, sanjoy
Reviewed By: mkazantsev
Subscribers: hiraditya, zzheng, javed.absar, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73705
Roman Lebedev [Tue, 25 Feb 2020 18:50:55 +0000 (21:50 +0300)]
[NFC][SCEV] Piping to pass TTI into SCEVExpander::isHighCostExpansionHelper()
Summary:
Future patches will make use of TTI to perform cost-model-driven `SCEVExpander::isHighCostExpansionHelper()`
This is a fully NFC patch to make things reviewable.
Reviewers: reames, mkazantsev, wmi, sanjoy
Reviewed By: mkazantsev
Subscribers: hiraditya, zzheng, javed.absar, dmgreen, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73704
Bill Wendling [Tue, 25 Feb 2020 19:45:56 +0000 (11:45 -0800)]
Add 'l' constraint to goto label reference
A goto label uses the 'l' constraint, skipping it can cause unexpected
warnings.
Martin Storsjö [Tue, 25 Feb 2020 07:36:24 +0000 (09:36 +0200)]
[libcxx] Fix building for windows after
54fa9ecd3088508
Move the implementation of __libcpp_thread_poll_with_backoff
and __libcpp_timed_backoff_policy::operator() out of the
_LIBCPP_HAS_THREAD_API_PTHREAD block. None of the code in these
methods is pthreads specific.
Also add "inline _LIBCPP_INLINE_VISIBILITY" to
__libcpp_timed_backoff_policy::operator(), to avoid errors due to
multiple definitions of the operator. Contrary to
__libcpp_thread_poll_with_backoff (which is a template function),
this is a normal non-templated method.
Differential Revision: https://reviews.llvm.org/D75102
Sanjay Patel [Tue, 25 Feb 2020 19:23:03 +0000 (14:23 -0500)]
[PhaseOrdering] add tests for missed CSE; NFC
Also add a RUN line for the new pass manager.
Jim Ingham [Sat, 22 Feb 2020 00:45:29 +0000 (16:45 -0800)]
Fix a race between lldb's packet timeout and the profile thread's usleep.
The debugserver profile thread used to suspend itself between samples with
a usleep. When you detach or kill, MachProcess::Clear would delay replying
to the incoming packet until pthread_join of the profile thread returned.
If you are unlucky or the suspend delay is long, it could take longer than
the packet timeout for pthread_join to return. Then you would get an error
about detach not succeeding from lldb - even though in fact the detach was
successful...
I replaced the usleep with PThreadEvents entity. Then we just call a timed
WaitForEventBits, and when debugserver wants to stop the profile thread, it
can set the event bit, and the sleep will exit immediately.
Differential Revision: https://reviews.llvm.org/D75004
Scott Linder [Fri, 8 Nov 2019 20:07:54 +0000 (15:07 -0500)]
[AMDGPU] Implement wave64 DWARF register mapping
Summary:
Implement the DWARF register mapping described in
llvm/docs/AMDGPUUsage.rst
This is currently limited to wave64 VGPRs/AGPRs.
This also includes some minor changes in AMDGPUInstPrinter,
AMDGPUMCTargetDesc, and AMDGPUAsmParser to make generating CFI assembly
text and ELF sections possible to ease testing, although complete CFI
support is not yet implemented.
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D74915
Scott Linder [Tue, 25 Feb 2020 14:03:11 +0000 (09:03 -0500)]
Support emitting .cfi_undefined in CodeGen
This will be used by AMDGPU.
Differential Revision: https://reviews.llvm.org/D74914
Scott Linder [Tue, 25 Feb 2020 14:01:26 +0000 (09:01 -0500)]
Emit register names in cfi assembly directives
Update .cfi_undefined, .cfi_register, and .cfi_return_column to
print symbolic register arguments.
Differential Revision: https://reviews.llvm.org/D74914
Yaxun (Sam) Liu [Fri, 21 Feb 2020 00:02:53 +0000 (19:02 -0500)]
Make __builtin_amdgcn_dispatch_ptr dereferenceable and align at 4
Differential Revision: https://reviews.llvm.org/D75028
Vedant Kumar [Tue, 25 Feb 2020 18:49:53 +0000 (10:49 -0800)]
[X86MCTargetDesc.h] Speculative fix for macro collision with sys/param.h
See discussion on https://reviews.llvm.org/D75091 for information about
the build failure and alternatives considered.
Quentin Colombet [Tue, 25 Feb 2020 01:30:58 +0000 (17:30 -0800)]
[MachineInstr] Add a dumpr method
Add a dump method that recursively prints an instruction and all
the instructions defining its operands and so on.
This is helpful when looking at combiner issue.
NFC
Differential Revision: https://reviews.llvm.org/D75094
Sean Fertile [Tue, 25 Feb 2020 17:41:31 +0000 (12:41 -0500)]
[PowerPC][NFC] Remove comments mentioning Darwin and VRSAVE from lit test.
Roman Lebedev [Tue, 25 Feb 2020 17:08:58 +0000 (20:08 +0300)]
[Codegen] Revert rL354676/rL354677 and followups - introduced PR43446 miscompile
This reverts https://reviews.llvm.org/D58468
(rL354676,
44037d7a6377ec8e5542cced73583283334b516b),
and all and any follow-ups to that code block.
https://bugs.llvm.org/show_bug.cgi?id=43446
Roman Lebedev [Tue, 25 Feb 2020 17:07:15 +0000 (20:07 +0300)]
[NFC][Codegen] Add miscompile test for constant store merging from PR43446
This miscompile was introduced by rL354676 / https://reviews.llvm.org/D58468
https://bugs.llvm.org/show_bug.cgi?id=43446
Louis Dionne [Tue, 25 Feb 2020 17:10:28 +0000 (12:10 -0500)]
[libc++] Remove incorrect XFAIL in modules test
Apparently, the test still works on single-threaded systems.
Philip Reames [Tue, 25 Feb 2020 16:56:53 +0000 (08:56 -0800)]
Revert "[LICM] Support hosting of dynamic allocas out of loops"
This reverts commit
8d22100f66c4170510c6ff028c60672acfe1cff9.
There was a functional regression reported (https://bugs.llvm.org/show_bug.cgi?id=44996). I'm not actually sure the patch is wrong, but I don't have time to investigate currently, and this line of work isn't something I'm likely to get back to quickly.
Pavel Labath [Tue, 25 Feb 2020 16:57:36 +0000 (17:57 +0100)]
Revert "[DWARFDebugLine] Avoid dumping prologue members we did not parse"
The changed test started failing on the windows bots. Reverting while I
investigate.
This reverts commit
deb116ee0a5b80f61bc341ed68606dc5ad093569.
Jay Foad [Tue, 25 Feb 2020 16:45:14 +0000 (16:45 +0000)]
AMDGPU/GlobalISel: Un-XFAIL a test
This was missed in
12fe9b26ec88bb2dd40d574a644edca302e804b2
Louis Dionne [Tue, 25 Feb 2020 16:42:08 +0000 (11:42 -0500)]
[libc++] Revert
03dd205c151 "Adjust max_align_t handling"
That commit was made without approval from a libc++ reviewer, and it
also broke the build in C++03 mode.
Louis Dionne [Mon, 24 Feb 2020 23:12:44 +0000 (18:12 -0500)]
[libc++] Proper fix for libc++'s modulemap after D68480
Summary:
In libc++, we normally #ifdef out header content instead of #erroring
out when the Standard in use is insufficient for the requirements of
the header.
Reviewers: EricWF
Subscribers: jkorous, dexonsmith, libcxx-commits, teemperor
Tags: #libc
Differential Revision: https://reviews.llvm.org/D75074
Matt Arsenault [Tue, 18 Feb 2020 03:10:27 +0000 (22:10 -0500)]
AMDGPU/GlobalISel: Use packed for G_ADD/G_SUB/G_MUL v2s16
Rong Xu [Tue, 25 Feb 2020 16:04:01 +0000 (08:04 -0800)]
[remark][diagnostics] [codegen] Fix PR44896
This patch fixes PR44896. For IR input files, option fdiscard-value-names
should be ignored as we need named values in loadModule().
Commit
60d3947922 sets this option after loadModule() where valued names
already created. This creates an inconsistent state in setNameImpl()
that leads to a seg fault.
This patch forces fdiscard-value-names to be false for IR input files.
This patch also emits a warning of "ignoring -fdiscard-value-names" if
option fdiscard-value-names is explictly enabled in the commandline for
IR input files.
Differential Revision: https://reviews.llvm.org/D74878
Anastasia Stulova [Tue, 25 Feb 2020 14:49:59 +0000 (14:49 +0000)]
[Sema][C++] Propagate conversion kind to specialize the diagnostics
Compute and propagate conversion kind to diagnostics helper in C++
to provide more specific diagnostics about incorrect implicit
conversions in assignments, initializations, params, etc...
Duplicated some diagnostics as errors because C++ is more strict.
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74116
Haojian Wu [Tue, 25 Feb 2020 16:02:08 +0000 (17:02 +0100)]
Make builtbot happy.
Disable the failing rename test, it should not be failed, needs further
investigation.
Jay Foad [Tue, 25 Feb 2020 10:31:37 +0000 (10:31 +0000)]
AMDGPU/GlobalISel: Legalize s64 min/max by lowering
Reviewers: arsenm, rampitec
Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, rovka, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75108
Fangrui Song [Tue, 25 Feb 2020 05:52:47 +0000 (21:52 -0800)]
[ELF] Support archive:file syntax in input section descriptions
Fixes https://bugs.llvm.org/show_bug.cgi?id=44450
https://sourceware.org/binutils/docs/ld/Input-Section-Basics.html#Input-Section-Basics
The following two rules are not implemented.
* `archive:` matches every file in the archive.
* `:file` matches a file not in an archive.
Reviewed By: grimar, ruiu
Differential Revision: https://reviews.llvm.org/D75100
Haojian Wu [Tue, 25 Feb 2020 15:32:22 +0000 (16:32 +0100)]
[clang-rename] Add the USR of incomplete decl to the USRSet.
Summary:
This fixes a clangd rename issue, which is missing the reference of
an incomplete specialization.
Unfortunately, I didn't reproduce this issue in clang-rename, I guess
the input `FoundDecl` of AdditionalUSRFinder is different in clangd vs
clang-rename, clang-rename uses the underlying CXXRecordDecl of the
ClassTemplateDecl, which is fixed in https://github.com/llvm/llvm-project/commit/
5d862c042b52ae2aad37471d0b83b6c678a520e3;
while clangd-rename uses the ClassTemplateDecl.
Reviewers: kbobyrev
Reviewed By: kbobyrev
Subscribers: ilya-biryukov, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74829
Artem Dergachev [Mon, 17 Feb 2020 18:42:50 +0000 (21:42 +0300)]
[analyzer] Add support for CXXInheritedCtorInitExpr.
So far we've been dropping coverage every time we've encountered
a CXXInheritedCtorInitExpr. This patch attempts to add some
initial support for it.
Constructors for arguments of a CXXInheritedCtorInitExpr are still
not fully supported.
Differential Revision: https://reviews.llvm.org/D74735
Pavel Labath [Mon, 24 Feb 2020 12:32:31 +0000 (13:32 +0100)]
[DWARFDebugLine] Avoid dumping prologue members we did not parse
Summary:
This patch if motivated by D74560, specifically the subthread about what
to print upon encountering reserved initial length values.
If the debug_line prologue has an unsupported version, we skip parsing
the rest of the data. If we encounter an reserved initial length field,
we don't even parse the version. However, we still print out all members
(with value 0) in the dump function.
This patch introduces early exits in the Prologue::dump function so that
we print only the fields that were parsed successfully. In case of an
unsupported version, we skip printing all subsequent prologue fields --
because we don't even know if this version has those fields. In case of a
reserved unit length, we don't print anything -- if the very first field
of the prologue is invalid, it's hard to say if we even have a prologue
to begin with.
Note that the user will still be able to see the invalid/reserved
initial length value in the error message. I've modified (reordered)
debug_line_invalid.test to show that the error message comes straight
after the debug_line offset. I've also added some flush() calls to the
dumping code to ensure this is the case in all situations (without that,
the warnings could get out of sync if the output was not a terminal -- I
guess this is why std::iostreams have the tie() function).
Reviewers: jhenderson, ikudrin, dblaikie
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75043
Ayke van Laethem [Tue, 4 Feb 2020 15:29:01 +0000 (16:29 +0100)]
[LLDB] Let DataExtractor deal with two-byte addresses
AVR usually uses two byte addresses. By making DataExtractor deal with
this, it is possible to load AVR binaries that don't have debug info
associated with them.
Differential Revision: https://reviews.llvm.org/D73969
Roman Lebedev [Tue, 25 Feb 2020 14:24:27 +0000 (17:24 +0300)]
[InstCombine] foldShiftIntoShiftInAnotherHandOfAndInICmp(): fix miscompile (PR44802)
Much like with reassociateShiftAmtsOfTwoSameDirectionShifts(),
as input, we have the following pattern:
icmp eq/ne (and ((x shift Q), (y oppositeshift K))), 0
We want to rewrite that as:
icmp eq/ne (and (x shift (Q+K)), y), 0 iff (Q+K) u< bitwidth(x)
While we know that originally (Q+K) would not overflow
(because 2 * (N-1) u<= iN -1), we may have looked past extensions of
shift amounts. so it may now overflow in smaller bitwidth.
To ensure that does not happen, we need to ensure that the total maximal
shift amount is still representable in that smaller bitwidth.
If the overflow would happen, (Q+K) u< bitwidth(x) check would be bogus.
https://bugs.llvm.org/show_bug.cgi?id=44802
Roman Lebedev [Tue, 25 Feb 2020 14:14:43 +0000 (17:14 +0300)]
[NFC][InstCombine] Add shift amount reassociation in bittest miscompile example from PR44802
https://bugs.llvm.org/show_bug.cgi?id=44802
Roman Lebedev [Tue, 25 Feb 2020 13:48:36 +0000 (16:48 +0300)]
[InstCombine] reassociateShiftAmtsOfTwoSameDirectionShifts(): fix miscompile (PR44802)
As input, we have the following pattern:
Sh0 (Sh1 X, Q), K
We want to rewrite that as:
Sh x, (Q+K) iff (Q+K) u< bitwidth(x)
While we know that originally (Q+K) would not overflow
(because 2 * (N-1) u<= iN -1), we may have looked past extensions of
shift amounts. so it may now overflow in smaller bitwidth.
To ensure that does not happen, we need to ensure that the total maximal
shift amount is still representable in that smaller bitwidth.
If the overflow would happen, (Q+K) u< bitwidth(x) check would be bogus.
https://bugs.llvm.org/show_bug.cgi?id=44802
Roman Lebedev [Tue, 25 Feb 2020 13:06:13 +0000 (16:06 +0300)]
[NFC][InstCombine] Add shift amount reassociation miscompile example from PR44802
https://bugs.llvm.org/show_bug.cgi?id=44802
Benjamin Kramer [Tue, 25 Feb 2020 15:03:06 +0000 (16:03 +0100)]
Make test not write to the source directory
Jay Foad [Tue, 25 Feb 2020 14:38:57 +0000 (14:38 +0000)]
[AMDGPU] Precommit some test updates for D68338 "Remove dubious logic in bidirectional list scheduler"
Nico Weber [Mon, 24 Feb 2020 21:07:16 +0000 (16:07 -0500)]
clang-cl: Add a `/showIncludes:user` flag.
This flag is like /showIncludes, but it only includes user headers and
omits system headers (similar to MD and MMD). The motivation is that
projects that already track system includes though other means can use
this flag to get consistent behavior on Windows and non-Windows, and it
saves tools that output /showIncludes output (e.g. ninja) some work.
implementation-wise, this makes `HeaderIncludesCallback` honor the
existing `IncludeSystemHeaders` bit, and changes the three clients of
`HeaderIncludesCallback` (`/showIncludes`, `-H`, `CC_PRINT_HEADERS=1`)
to pass `-sys-header-deps` to set that bit -- except for
`/showIncludes:user`, which doesn't pass it.
Differential Revision: https://reviews.llvm.org/D75093
Kristóf Umann [Fri, 20 Sep 2019 09:01:45 +0000 (11:01 +0200)]
[analyzer][MallocChecker][NFC] Change the use of IdentifierInfo* to CallDescription
Exactly what it says on the tin! I decided not to merge this with the patch that
changes all these to a CallDescriptionMap object, so the patch is that much more
trivial.
Differential Revision: https://reviews.llvm.org/D68163
Kadir Cetinkaya [Wed, 19 Feb 2020 18:11:01 +0000 (19:11 +0100)]
[clangd] Migrate Lexer usages in TypeHierarchy to TokenBuffers
Summary:
Also fixes a bug, resulting from directly using ND.getEndLoc() for end
location of the range. As ND.getEndLoc() points to the begining of the last
token, whereas it should point one past the end, since LSP ranges are half open
(exclusive on the end).
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74850
Joerg Sonnenberger [Tue, 25 Feb 2020 14:22:18 +0000 (15:22 +0100)]
Stop including sys/param.h from Unix.h
Kelvin Li [Mon, 24 Feb 2020 21:11:05 +0000 (16:11 -0500)]
[OpenMP][cmake] ignore warning on unknown CUDA version
Differential Revision: https://reviews.llvm.org/D75001
Jonathan Coe [Tue, 25 Feb 2020 13:59:52 +0000 (13:59 +0000)]
[clang-format] Wrap lines for C# property accessors
Summary: Ensure that auto-implemented properties `{ get; private set }` are wrapped on to one line for C# code.
Reviewers: MyDeveloperDay, krasimir
Reviewed By: MyDeveloperDay, krasimir
Subscribers: cfe-commits
Tags: #clang-format, #clang
Differential Revision: https://reviews.llvm.org/D75006
Hans Wennborg [Tue, 25 Feb 2020 14:15:25 +0000 (15:15 +0100)]
Fix DfaEmitter::visitDfaState() crash in MSVC x86 debug builds (PR44945)
No functionality change (intended), but this seems to make the code a
bit clearer for the compiler and maybe for human readers too.
Luís Marques [Tue, 25 Feb 2020 14:15:16 +0000 (14:15 +0000)]
[RISCV] Fix sysroot tests without GCC on RISC-V hosts with GCC
D68391 added tests that check scenarios where no RISC-V GCC toolchain is
supposed to be detected. When running the tests on RISC-V hosts the system's
GCC toolchain will be detected, and the tests will fail. This patch adds a
`--gcc-toolchain` option pointing to a path where no GCC toolchain is
present, ensuring that the tests are run under the expected conditions, and
therefore are able to pass in all test environments.
Differential Revision: https://reviews.llvm.org/D75061
Alex Zinenko [Tue, 25 Feb 2020 14:14:59 +0000 (15:14 +0100)]
[mlir] NFC: update documentation in ConvertLinalgToLLVM
The documentation was describing an obsolete version of the
transformation.
Sanjay Patel [Tue, 25 Feb 2020 14:12:12 +0000 (09:12 -0500)]
[CodeGen] fix clang test that runs the optimizer pipeline; NFC
There's already a FIXME note on this file; it can break when the
underlying LLVM behavior changes independently of anything in clang.
Sanjay Patel [Tue, 25 Feb 2020 13:54:58 +0000 (08:54 -0500)]
[PhaseOrdering] add test for missing vector/CSE transforms (PR45015); NFC
Adam Balogh [Tue, 18 Feb 2020 10:22:08 +0000 (11:22 +0100)]
[Analyzer] Fix for iterator modeling and checkers: handle negative numbers correctly
Currently, using negative numbers in iterator operations (additions and
subractions) results in advancements with huge positive numbers due to
an error. This patch fixes it.
Differential Revision: https://reviews.llvm.org/D74760
Balázs Kéri [Tue, 25 Feb 2020 13:47:38 +0000 (14:47 +0100)]
[ASTImporter] Improved variable template redecl chain handling.
Reviewers: martong, a.sidorin, shafik
Reviewed By: martong
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, teemperor, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74720
Sanjay Patel [Mon, 24 Feb 2020 22:16:57 +0000 (17:16 -0500)]
[VectorCombine] add tests for possible extract->shuffle; NFC
Sanjay Patel [Mon, 24 Feb 2020 22:05:44 +0000 (17:05 -0500)]
[VectorCombine] make cost calc consistent for binops and cmps
Code duplication (subsequently removed by refactoring) allowed
a logic discrepancy to creep in here.
We were being conservative about creating a vector binop -- but
not a vector cmp -- in the case where a vector op has the same
estimated cost as the scalar op. We want to be more aggressive
here because that can allow other combines based on reduced
instruction count/uses.
We can reverse the transform in DAGCombiner (potentially with a
more accurate cost model) if this causes regressions.
AFAIK, this does not conflict with InstCombine. We have a
scalarize transform there, but it relies on finding a constant
operand or a matching insertelement, so that means it eliminates
an extractelement from the sequence (so we won't have 2 extracts
by the time we get here if InstCombine succeeds).
Differential Revision: https://reviews.llvm.org/D75062
Florian Hahn [Tue, 25 Feb 2020 13:27:22 +0000 (13:27 +0000)]
[DSE,MSSA] Do not attempt to remove un-removable memdefs.
We have to skip MemoryDefs that cannot be removed. This fixes a crash in
the newly added test case and fixes a wrong case in
memset-and-memcpy.ll.
Stephan Herhut [Mon, 24 Feb 2020 15:02:50 +0000 (16:02 +0100)]
[MLIR][GPU] Properly model step in parallel loop to gpu conversion.
Summary:
The original patch had TODOs to add support for step computations,
which this commit addresses. The computations are expressed using
affine expressions so that the affine canonicalizers can simplify
the full bound and index computations.
Also cleans up the code a little and exposes the pass in the
header file.
Differential Revision: https://reviews.llvm.org/D75052
Alex Zinenko [Tue, 25 Feb 2020 13:18:12 +0000 (14:18 +0100)]
[mlir] NFC: move AffineOps tests from test/ to test/Dialect
AffineOps dialect lives under lib/Dialect/AffineOps and so should its
tests.
Jeremy Morse [Tue, 25 Feb 2020 13:12:13 +0000 (13:12 +0000)]
[debuginfo-tests] Warn, not error, if we can't delete working directory
On Windows, an error running the debugger typically leaves a process
hanging around in the working directory. When Dexter exits, it can't then
delete the working directory and produces an exception, masking the problem
in the debugger. (This can be worked around by specifying --save-temps).
Rather than hard-erroring, print a warning when we can't delete the working
directory instead.
It'd be much better to improve our error handling, and make the
WorkingDirectory class aware that something's wrong when it enters exit.
However, this is something that's going to mask genuine errors and make
everyones lives harder right now, so I think this non-ideal fix is
important to get in first.
Differential Revision: https://reviews.llvm.org/D74548
Raphael Isemann [Tue, 25 Feb 2020 12:43:11 +0000 (13:43 +0100)]
[lldb][NFC] Move filling namespace map in ClangASTSource to own function
Raphael Isemann [Tue, 25 Feb 2020 12:11:28 +0000 (13:11 +0100)]
[lldb] Initialize NameSearchContext::m_namespace_map in constructor
This member is for some reason initialized in ClangASTSource::FindExternalVisibleDecls
so all other functions using this member dereference a nullptr unless we
call this function before that. Let's just initialize this in the constructor.
This should be NFC as the only side effect is that we don't reset the namespace map
when calling ClangASTSource::FindExternalVisibleDecls multiple times (and we never
call this function multiple times for one NameSearchContext from what I can see).
Nico Weber [Tue, 25 Feb 2020 12:19:49 +0000 (07:19 -0500)]
[gn build] (manually) merge
fee41517fe0f
whitequark [Tue, 25 Feb 2020 11:59:29 +0000 (11:59 +0000)]
Remove myself from CODE_OWNERS.
Raphael Isemann [Tue, 25 Feb 2020 11:28:48 +0000 (12:28 +0100)]
[lldb][NFC] Make NameSearchContext::m_found members bools instead of bitfields
The size of NameSearchContext isn't important as we never store it and rarely
allocate more than a few. This way we also don't have to use the memset to
initialize these fields to zero.
Raphael Isemann [Tue, 25 Feb 2020 11:05:46 +0000 (12:05 +0100)]
[lldb][NFC] Move NameSearchContext to own header/source files
The class is large enough to be in its own file. This patch also removes the cyclic
dependency between ClangASTSource <-> NameSearchContext.
Kadir Cetinkaya [Mon, 24 Feb 2020 15:38:57 +0000 (16:38 +0100)]
[clangd] Disable ExtractVariable for C
Summary:
Currently extract variable doesn't spell the type explicitly and just
uses an `auto` instead, which is not available in C.
Reviewers: usaxena95
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D75053
Hans Wennborg [Tue, 25 Feb 2020 11:13:09 +0000 (12:13 +0100)]
build_llvm_package.bat: Produce zip files in addition to the installers
Now that the Windows installer no longer does anything besides
self-extract, maybe it would make sense to distribute the toolchain as a
plain zip file in addition to the current installer.
Differential revision: https://reviews.llvm.org/D74896
Stephan Herhut [Tue, 25 Feb 2020 11:05:30 +0000 (12:05 +0100)]
[MLIR][GPU] Fix forward declaration of Region class.
I forward declared mlir::Region as a struct by mistake :(
Andrzej Warzynski [Wed, 19 Feb 2020 12:25:30 +0000 (12:25 +0000)]
[AArch64][SVE] Update names and comments for gathers/scatters (NFC)
Summary:
This patch renames functions and TableGen classes for SVE gathers and
scatters. The original names implied that the corresponding
methods/classes are only suited for regular gathers/scatters (i.e. LD1
and ST1), which is not the case. Indeed, we will be re-using them for
non-temporal and first-faulting gathers/scatters in the forthcoming
patches. The new names also highlight the split into Vector-Scalar (VS)
and Scalar-Vector (SV) cases.
List of changes:
* `performLD1GatherCombine` and `performST1ScatterCombine` are renamed
as `performGatherLoadCombine` and `performScatterStoreCombine`,
respectively.
* Selection DAG types for scatters and gathers from
AArch64SVEInstrInfo.td are renamed. For example, `SDT_AArch64_GLD1` is
renamed as `SDT_AArch64_GATHER_SV`. SV stands for Scalar-Vector, as
opposed to Vector-Scalar (VS).
* The intrinsic classes from IntrinsicsAArch64.td are renamed. For
example, `AdvSIMD_GatherLoad_64bitOffset_Intrinsic` is renamed as
`AdvSIMD_GatherLoad_SV_64b_Offsets_Intrinsic`.
* Updated comments in `performGatherLoadCombine` and
`performScatterStoreCombine`.
Reviewers: sdesmalen, rengolin, efriedma
Reviewed By: sdesmalen
Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75035
Raphael Isemann [Tue, 25 Feb 2020 10:49:36 +0000 (11:49 +0100)]
[lldb][NFC] Modernize logging in ClangASTSource/ExpressionDeclMap
Alex Zinenko [Mon, 24 Feb 2020 16:43:01 +0000 (17:43 +0100)]
[mlir] simplify affine maps and operands in affine.min/max
Affine dialect already has a map+operand simplification infrastructure in
place. Plug the recently added affine.min/max operations into this
infrastructure and add a simple test. More complex behavior of the simplifier
is already tested by other ops.
Addresses https://bugs.llvm.org/show_bug.cgi?id=45008.
Differential Revision: https://reviews.llvm.org/D75058
Alex Zinenko [Fri, 21 Feb 2020 13:46:14 +0000 (14:46 +0100)]
[mlir] Intrinsics generator: use TableGen-defined builder function
Originally, intrinsics generator for the LLVM dialect has been producing
customized code fragments for the translation of MLIR operations to LLVM IR
intrinsics. LLVM dialect ODS now provides a generalized version of the
translation code, parameterizable with the properties of the operation.
Generate ODS that uses this version of the translation code instead of
generating a new version of it for each intrinsic.
Differential Revision: https://reviews.llvm.org/D74893
Alex Zinenko [Fri, 21 Feb 2020 13:45:51 +0000 (14:45 +0100)]
[mlir] Generalize intrinsic builders in the LLVM dialect definition
All LLVM IR intrinsics are constructed in a similar way. The ODS definition of
the LLVM dialect in MLIR also lists multiple intrinsics, many of which
reproduce the same (or similar enough) code stanza to translate the MLIR
operation into the LLVM IR intrinsic. Provide a single base class containing
parameterizable code to build LLVM IR intrinsics given their name and the lists
of overloadable operands and results. Use this class to remove (almost)
duplicate translations for intrinsics defined in LLVMOps.td.
Differential Revision: https://reviews.llvm.org/D74889
Hans Wennborg [Tue, 25 Feb 2020 10:50:03 +0000 (11:50 +0100)]
Don't generate libcalls for wide shift on Windows ARM (PR42711)
The previous patch (
cff90f07cb5cc3c3bc58277926103af31caef308) didn't
cover ARM.
Stephan Herhut [Fri, 21 Feb 2020 15:18:22 +0000 (16:18 +0100)]
[MLIR][GPU] Implement a simple greedy loop mapper.
Summary:
The mapper assigns annotations to loop.parallel operations that
are compatible with the loop to gpu mapping pass. The outermost
loop uses the grid dimensions, followed by block dimensions. All
remaining loops are mapped to sequential loops.
Differential Revision: https://reviews.llvm.org/D74963
Georgii Rymar [Tue, 25 Feb 2020 10:20:08 +0000 (13:20 +0300)]
[yaml2obj] - Address post commit comments for D74764
It removes a stale comment and fixes the comment in the test
and section names related accordingly.
Cullen Rhodes [Tue, 11 Feb 2020 22:43:45 +0000 (22:43 +0000)]
[AArch64][SVE] Add predicate reinterpret intrinsics
Summary:
Implements the following intrinsics:
* llvm.aarch64.sve.convert.to.svbool
* llvm.aarch64.sve.convert.from.svbool
For converting the ACLE svbool_t type (<n x 16 x i1>) to and from the
other predicate types: <n x 8 x i1>, <n x 4 x i1> and <n x 2 x i1>.
Reviewers: sdesmalen, kmclaughlin, efriedma, dancgr, rengolin
Reviewed By: sdesmalen, efriedma
Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D74471
Kristóf Umann [Thu, 26 Sep 2019 11:36:29 +0000 (13:36 +0200)]
[analyzer][MallocChecker][NFC] Communicate the allocation family to auxiliary functions with parameters
The following series of refactoring patches aim to fix the horrible mess that MallocChecker.cpp is.
I genuinely hate this file. It goes completely against how most of the checkers
are implemented, its by far the biggest headache regarding checker dependencies,
checker options, or anything you can imagine. On top of all that, its just bad
code. Its seriously everything that you shouldn't do in C++, or any other
language really. Bad variable/class names, in/out parameters... Apologies, rant
over.
So: there are a variety of memory manipulating function this checker models. One
aspect of these functions is their AllocationFamily, which we use to distinguish
between allocation kinds, like using free() on an object allocated by operator
new. However, since we always know which function we're actually modeling, in
fact we know it compile time, there is no need to use tricks to retrieve this
information out of thin air n+1 function calls down the line. This patch changes
many methods of MallocChecker to take a non-optional AllocationFamily template
parameter (which also makes stack dumps a bit nicer!), and removes some no
longer needed auxiliary functions.
Differential Revision: https://reviews.llvm.org/D68162
Igor Kudrin [Thu, 13 Feb 2020 11:20:14 +0000 (18:20 +0700)]
[DebugInfo] Fix printing CIE offsets in EH FDEs.
While the value of the CIE pointer field in a DWARF FDE record is
an offset to the corresponding CIE record from the beginning of
the section, for EH FDE records it is relative to the current offset.
Previously, we did not make that distinction when dumped both kinds
of FDE records and just printed the same value for the CIE pointer
field and the CIE offset; that was acceptable for DWARF FDEs but was
wrong for EH FDEs.
This patch fixes the issue by explicitly printing the offset of the
linked CIE object.
Differential Revision: https://reviews.llvm.org/D74613
Hans Wennborg [Tue, 25 Feb 2020 09:59:32 +0000 (10:59 +0100)]
Add llvm-cov to LLVM_TOOLCHAIN_TOOLS
See https://github.com/llvm/llvm-project/issues/141
Calixte Denizet [Mon, 24 Feb 2020 22:29:12 +0000 (23:29 +0100)]
[profile] gcov_mutex must be static
Summary: Forget static keyword for gcov_mutex in https://reviews.llvm.org/D74953 and that causes test failure on mac.
Reviewers: erik.pilkington, vsk
Reviewed By: vsk
Subscribers: vsk, dexonsmith, #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D75080
Jay Foad [Tue, 25 Feb 2020 09:42:33 +0000 (09:42 +0000)]
GlobalISel: NFC minor cleanup to avoid a couple of fixed size local arrays
Jay Foad [Mon, 24 Feb 2020 23:21:00 +0000 (23:21 +0000)]
AMDGPU/GlobalISel: add legalize tests for s64 max/min
Jan Vesely [Sat, 15 Feb 2020 03:29:04 +0000 (22:29 -0500)]
libclc: cmake configure should depend on file list
This makes sure targets are rebuilt if a file is added or removed.
Reviewer: tstellar
Differential Revision: https://reviews.llvm.org/D74662
Raphael Isemann [Tue, 25 Feb 2020 07:47:41 +0000 (08:47 +0100)]
[lldb][NFC] Move namespace lookup in ClangASTSource to own function.
Beside being cleaner we can probably reuse that logic elsewhere.
Kang Zhang [Tue, 25 Feb 2020 09:19:27 +0000 (09:19 +0000)]
[NFC][PowerPC] Add a new test case scalar_cmp.ll
Pavel Labath [Tue, 25 Feb 2020 08:57:42 +0000 (09:57 +0100)]
[lldb] s/CHECK-NEXT/CHECK-DAG in dwp-debug-types.s
These can come out nondeterministically for two reasons:
- sorting based on ConstStringified pointer values
- different relative speeds of the indexing threads
Making these nondeterministic without incurring performance penalties is
hard, so I just make the test expect them in any order (the order is not
important in this test anyway.
Raphael Isemann [Tue, 25 Feb 2020 08:11:13 +0000 (09:11 +0100)]
[lldb][NFC] Make ArrayRef initialization more obvious in lldb-test.cpp
Seems like this code raised some alarm bells as it looks like an ArrayRef
to a temporary initializer list, but it's actually just calling the ArrayRef(T*, T*)
constructor. Let's clarify this and directly call the right ArrayRef constructor here.
Fixes rdar://problem/
59176052
Alex Brachet [Tue, 25 Feb 2020 08:46:09 +0000 (03:46 -0500)]
[libc] [UnitTest] Give UnitTest gtest like colors
Summary:
This is a quality of life change to make it a little nicer to look at, NFC.
This patch makes the RUN and OK lines green and FAILED lines red to match gtest's output.
Reviewers: sivachandra, gchatelet, PaulkaToast
Reviewed By: gchatelet
Subscribers: MaskRay, tschuett, libc-commits
Differential Revision: https://reviews.llvm.org/D75103
Craig Topper [Tue, 25 Feb 2020 07:17:48 +0000 (23:17 -0800)]
[X86] Pass parameters into selectVectorAddr to remove dependency on X86MaskedGatherScatterSDNode.
Might be able to get rid of X86ISD::SCATTER and some uses of
X86ISD::GATHER. Which require isel to use ISD::SCATTER and
ISD::GATHER as well.
Craig Topper [Tue, 25 Feb 2020 06:54:20 +0000 (22:54 -0800)]
[X86] Remove mask output from X86 gather/scatter ISD opcodes.
Instead add it when we make the machine nodes during instruction
selections.
This makes this ISD node closer to ISD::MGATHER. Trying to see
if we remove the X86 specific ones.
Nathan James [Tue, 25 Feb 2020 07:51:07 +0000 (07:51 +0000)]
[ASTMatchers] Adds a matcher called `hasAnyOperatorName`
Summary:
Acts on `BinaryOperator` and `UnaryOperator` and functions the same as `anyOf(hasOperatorName(...), hasOperatorName(...), ...)`
Documentation generation isn't perfect but I feel that the python doc script needs updating for that
Reviewers: aaron.ballman, gribozavr2
Reviewed By: aaron.ballman, gribozavr2
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D75040
Nathan James [Tue, 25 Feb 2020 02:07:45 +0000 (02:07 +0000)]
[ASTMatchers] Matcher macros with params move params instead of copying
Summary: Use move semantics instead of copying for AST Matchers with parameters
Reviewers: aaron.ballman, gribozavr2
Reviewed By: gribozavr2
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D75096
Raphael Isemann [Tue, 25 Feb 2020 07:20:41 +0000 (08:20 +0100)]
[lldb] Fix that a crashing test is marked as unsupported when it prints UNSUPPORTED before crashing
Summary:
I added an `abort()` call to some code and noticed that the test suite was still passing and it just marked my test as "UNSUPPORTED".
It seems the reason for that is that we expect failing tests to print "FAIL:" which doesn't happen when we crash. If we then also
have an unsupported because we skipped some debug information in the output, we just mark the test passing because it is unsupported
on the current platform.
This patch marks any test that has a non-zero exit code as failing even if it doesn't print "FAIL:" (e.g., because it crashed).
Reviewers: labath, JDevlieghere
Reviewed By: labath, JDevlieghere
Subscribers: aprantl, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D75031
Pavel Labath [Tue, 25 Feb 2020 07:26:55 +0000 (08:26 +0100)]
[lldb] Mark ObjectFileBreakpad test inputs as non-text
These are technically text files, but the object file layer treats them
as binary, and the relevant tests verify the parsed contents byte for
byte. Git's crlf conversion can make those tests fail. Marking the files
as non-text disables that.
Jim Lin [Tue, 25 Feb 2020 06:37:36 +0000 (14:37 +0800)]
[Sparc][NFC] Remove trailing space