Alexandre Ganea [Thu, 28 Nov 2019 16:16:55 +0000 (11:16 -0500)]
[LLDB] Fix wrong argument in CommandObjectThreadStepWithTypeAndScope
Differential Revision: https://reviews.llvm.org/D70448
Austin Kerbow [Fri, 22 Nov 2019 20:25:13 +0000 (12:25 -0800)]
AMDGPU: Reuse carry out register during FI elimination
Summary:
Pre gfx9 we need to scavenge a 64-bit SGPR to use as the carry out for an Add.
If only one SGPR was available this crashed when trying to scavenge another
32bit SGPR to materialize the offset.
Instead, reuse a 32-bit SGPR from the carry out as the offset register.
Also prefer to use vcc for the unused carry out when it is available.
Reviewers: arsenm, rampitec
Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70614
Simon Tatham [Thu, 28 Nov 2019 15:31:41 +0000 (15:31 +0000)]
[AArch64][v8.3a] Don't emit LDRA '[xN]!' alias in disassembly.
Summary:
In rG643ac6c0420b, the syntax `ldraa x1, [x0]!` was added as an alias
for `ldraa x1, [x0, #0]!`. That syntax is less obvious in meaning, and
also will not be accepted by assemblers that haven't been updated yet.
So it would be better not to emit it as the preferred disassembly for
that instruction.
This change lowers the EmitPriority of the new alias so that the more
explicit syntax `[x0, #0]!` is preferred by the disassembler. The new
syntax is still accepted by the assembler.
Reviewers: ab, ostannard
Reviewed By: ostannard
Subscribers: kristof.beyls, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70813
Miloš Stojanović [Thu, 28 Nov 2019 15:18:28 +0000 (16:18 +0100)]
[OpenMP][test] Fix test on MIPS-based buildbots
On MIPS `zeroext` or `signext` can appear in the output.
Differential Revision: https://reviews.llvm.org/D70820
Raphael Isemann [Thu, 28 Nov 2019 14:43:26 +0000 (15:43 +0100)]
[lldb][NFC] Remove CompilerDeclContext::IsClang
This method is only used in ClangASTContext.
Also removes the includes we only needed for the ClangASTContext RTTI check
in the CompilerDecl[Context].cpp files.
Raphael Isemann [Thu, 28 Nov 2019 14:29:09 +0000 (15:29 +0100)]
[lldb][NFC] Remove unused variable in ClangASTSource::CompleteType
Now that CompilerDeclContext is a trivial class, Clang started warning
that this unused variable is in fact unused. Let's remove it.
Raphael Isemann [Thu, 28 Nov 2019 14:14:24 +0000 (15:14 +0100)]
[lldb][NFC] Simplify CompilerDecl and CompilerDeclContext initialization
Raphael Isemann [Thu, 28 Nov 2019 14:05:10 +0000 (15:05 +0100)]
[lldb][NFC] Remove unused CompilerDecl::IsClang
Pavel Labath [Thu, 28 Nov 2019 12:48:05 +0000 (13:48 +0100)]
[lldb] refactor FileSpec::Equal
The logic of this function was quite hard to follow. Replace it with a
much simpler, equivalent, implementation.
Pavel Labath [Thu, 28 Nov 2019 12:47:58 +0000 (13:47 +0100)]
[lldb] Add FileSpec::Equal unit tests
this is in preparation of a refactor of this method.
Pavel Labath [Thu, 28 Nov 2019 12:30:39 +0000 (13:30 +0100)]
[lldb] Simplify and improve FileSpecTest
Summary:
A most of these tests create FileSpecs with a hardcoded style. Add
utility functions which create a file spec of a given style to simplify
things.
While in there add SCOPED_TRACE messages to tests which loop over
multiple inputs to ensure it's clear which of the inputs failed.
Reviewers: teemperor
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D70814
Raphael Isemann [Thu, 28 Nov 2019 13:25:46 +0000 (14:25 +0100)]
Revert "[lldb] NFC: refactor CompileUnit::ResolveSymbolContext"
This reverts commit
373e2a4f69d623e59329ff801f261d8b299e12d2.
This broke breakpoint setting.
Benjamin Kramer [Thu, 28 Nov 2019 13:21:33 +0000 (14:21 +0100)]
[include-fixer] Python 3 support for clang-include-fixer.py
Patch by Yannick Brehon!
Raphael Isemann [Thu, 28 Nov 2019 13:07:44 +0000 (14:07 +0100)]
[lldb][NFC] Remove unused STLUtil include and STLUtil.h header
Raphael Isemann [Thu, 28 Nov 2019 12:41:18 +0000 (13:41 +0100)]
[lldb][NFC] Use llvm::StringRef instead of C-strings as multimap key
Konrad Kleine [Wed, 27 Nov 2019 09:57:06 +0000 (10:57 +0100)]
[lldb] NFC: refactor CompileUnit::ResolveSymbolContext
Summary:
I found the above named method hard to read because it had
a) many nested blocks and
b) one return statement at the end with some logic involved.
I decided to refactor this function by employing an early exit strategy.
In order to capture the logic in the return statement and to not have it
repeated more than once I chose to implement a very small lamda function
that captures all the variables it needs.
This is a non-functional change (NFC).
Reviewers: jdoerfert
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D70774
Haojian Wu [Thu, 28 Nov 2019 11:47:32 +0000 (12:47 +0100)]
[clangd] Don't perform rename when the refs result from index is incomplete.
Summary:
Also do an early return if the number of affected files > limit to save
some unnecessary FileURI computations.
Reviewers: ilya-biryukov
Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70811
Raphael Isemann [Thu, 28 Nov 2019 12:27:25 +0000 (13:27 +0100)]
[lldb][NFC] Remove unused CStringToDIEMap typedef
Haojian Wu [Thu, 28 Nov 2019 10:24:04 +0000 (11:24 +0100)]
[clangd] Prefer the left character if the character on the right of the cursor is semicolon.
Summary: This would make go-to-def works on the cases like int A = abc^;
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70807
Haojian Wu [Thu, 28 Nov 2019 10:39:48 +0000 (11:39 +0100)]
[clangd] Tweak the no-index error message for rename, NFC.
Summary: The current error message doesn't fit well for cross-file rename.
Reviewers: ilya-biryukov
Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70809
Raphael Isemann [Thu, 28 Nov 2019 11:45:47 +0000 (12:45 +0100)]
[lldb][NFC] Remove forward declaration of PrivateAutoCompleteMembers
That's declared directly above the actual definition, so it serves no use.
Raphael Isemann [Thu, 28 Nov 2019 11:24:08 +0000 (12:24 +0100)]
[lldb][NFC] Make GetAsCXXRecordDecl static
All other casting functions there are static, so this should
be too.
Martin Storsjö [Thu, 28 Nov 2019 11:18:15 +0000 (13:18 +0200)]
[LLDB] [test] Add a missing "REQUIRES: arm" line
David Stuttard [Thu, 21 Nov 2019 11:31:41 +0000 (11:31 +0000)]
AMDGPU: Fix lit test checks with dag option
Summary:
I was seeing some failures on a test with slightly different instruction
ordering. Adding in some DAG directives solved the issue.
Change-Id: If5a3d3969055fb19279943bd45161bb70a3dabce
Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, tpr, t-tye, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70531
Raphael Isemann [Thu, 28 Nov 2019 09:33:36 +0000 (10:33 +0100)]
[lldb][NFC] Split up DWARFASTParserClang::CompleteTypeFromDWARF
Moving the different parts into their own functions without any additional
cleanup/refactoring, so this is NFC.
Georgii Rymar [Wed, 27 Nov 2019 10:45:04 +0000 (13:45 +0300)]
[llvm-readelf] - Make GNU style dumping of invalid SHT_GNU_verdef be consistent with LLVM style.
When we dump SHT_GNU_verdef section that has sh_link that references a non-existent section,
llvm-readobj reports a warning and continues dump, but llvm-readelf fails with a error.
This patch fixes the issue and opens road for futher follow-ups for
improving the printGNUVersionSectionProlog().
Differential revision: https://reviews.llvm.org/D70776
Martin Storsjö [Tue, 15 Oct 2019 21:05:06 +0000 (00:05 +0300)]
[LLDB] Always interpret arm instructions as thumb on windows
Windows on ARM always uses thumb mode, and doesn't have most of the
mechanisms that are used in e.g. ELF for distinguishing between arm
and thumb.
Differential Revision: https://reviews.llvm.org/D70796
Martin Storsjö [Tue, 15 Oct 2019 21:01:15 +0000 (00:01 +0300)]
[LLDB] [PECOFF] Look for the truncated ".eh_fram" section name
COFF section names can either be stored truncated to 8 chars, in the
section header, or as a longer section name, stored separately in the
string table.
libunwind locates the .eh_frame section by runtime introspection,
which only works for section names stored in the section header (as
the string table isn't mapped at runtime). To support this behaviour,
lld always truncates the section names for sections that will be
mapped, like .eh_frame.
Differential Revision: https://reviews.llvm.org/D70745
Martin Storsjö [Wed, 27 Nov 2019 12:08:01 +0000 (14:08 +0200)]
[LLDB] [PECOFF] Factorize mapping section names to types using StringSwitch. NFCI.
Keep the existing special cases based on combinations of section name,
flags and sizes/offsets.
Differential Revision: https://reviews.llvm.org/D70778
Raphael Isemann [Thu, 28 Nov 2019 09:21:47 +0000 (10:21 +0100)]
[lldb] Remove debugging code used for LLDB_DWARF_DONT_COMPLETE_TYPENAMES
Reviewers: labath, clayborg, shafik
Reviewed By: labath
Subscribers: JDevlieghere, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D70802
Georgii Rymar [Wed, 27 Nov 2019 15:26:54 +0000 (18:26 +0300)]
[llvm-readelf][llvm-readobj][test] - Cleanup test cases for versioning sections.
Currently we have 2 tests for testing versioning sections:
1) elf-versioninfo.test
2) elf-invalid-versioning.test
The first one currently checks how versioning sections are dumped +
how tools dump invalid SHT_GNU_verdef section.
The second despite of its name contains only tests for invalid SHT_GNU_verneed section.
In this patch I`ve renamed elf-invalid-versioning.test->elf-verneed-invalid.test,
and moved a few tests from elf-versioninfo.test to a new elf-verdef-invalid.test.
It will help to maintain these and a new tests for broken versioning sections.
Differential revision:
Wang, Pengfei [Thu, 28 Nov 2019 06:45:39 +0000 (14:45 +0800)]
[X86][NFC] Rename test file for following changes.
Lang Hames [Thu, 28 Nov 2019 06:25:59 +0000 (22:25 -0800)]
[JITLink] Make sure MachO/x86-64 handles 32-bit signed addends correctly.
These need to be sign extended when loading into Edge addends.
Ehud Katz [Thu, 28 Nov 2019 06:27:50 +0000 (08:27 +0200)]
[InlineCost] Fix infinite loop in indirect call evaluation
Currently every time we encounter an indirect call of a known function,
we try to evaluate the inline cost of that function. In case of a
recursion, that evaluation never stops.
The solution I propose is to evaluate only the indirect call of the
function, while any further indirect calls (of a known function) will be
treated just as direct function calls, which, actually, never tries to
evaluate the call.
Fixes PR35469.
Differential Revision: https://reviews.llvm.org/D69349
Craig Topper [Thu, 28 Nov 2019 06:03:40 +0000 (22:03 -0800)]
[LegalizeTypes] Remove dead code related to softening f16 which we no longer do.
f16 is promoted to f32 if it is not legal on the target.
Found while reviewing what else needed to be done for strict FP in
the softening code.
Craig Topper [Thu, 28 Nov 2019 05:15:36 +0000 (21:15 -0800)]
[LegalTypes][X86] Add SoftenFloatOperand support for STRICT_FP_TO_SINT/STRICT_FP_TO_UINT.
Rui Ueyama [Thu, 28 Nov 2019 04:50:35 +0000 (13:50 +0900)]
Use InitLLVM in clang-tidy
Update clang-tidy to use InitLLVM, like several other llvm tools that
were previously updated. On Windows, this allows clang-tidy to operate
on arguments containing characters which cannot be represented in the
system's ANSI code page such as filenames with Unicode characters.
Fixes bugzilla bug 43751.
Patch by Tristan Labelle.
Differential Revision: https://reviews.llvm.org/D70694
Craig Topper [Thu, 28 Nov 2019 01:44:43 +0000 (17:44 -0800)]
[LegalizeTypes][X86] Add ExpandIntegerResult support for STRICT_FP_TO_SINT/STRICT_FP_TO_UINT.
Craig Topper [Thu, 28 Nov 2019 01:25:26 +0000 (17:25 -0800)]
[X86] Add support for STRICT_FP_TO_UINT/SINT from fp128.
Nico Weber [Thu, 28 Nov 2019 02:12:46 +0000 (21:12 -0500)]
Revert "Revert "gn build: (manually) try to merge
1689ad27af""
This reverts commit
88276ddbfea753ac13da5a64c2020b7b0a06617f.
The original change relanded.
Richard Smith [Thu, 28 Nov 2019 01:54:26 +0000 (17:54 -0800)]
Properly disambiguate between array declarators and array subscript expressions.
Yi Kong [Thu, 21 Nov 2019 22:14:33 +0000 (14:14 -0800)]
Revert "Revert
1689ad27af5 "[builtins] Implement rounding mode support for i386/x86_64""
Don't build specilised fp_mode.c on MSVC since it does not support
inline ASM on x86_64.
This reverts commit
a19f0eec94e195cac676d0d473882b48f4fded90.
Johannes Altmanninger [Fri, 15 Nov 2019 01:12:58 +0000 (02:12 +0100)]
[CodeGen] Fix clang crash on aggregate initialization of array of labels
Summary: Fix PR43700
The ConstantEmitter in AggExprEmitter::EmitArrayInit was initialized
with the CodeGenFunction set to null, which caused the crash.
Also simplify another call, and make the CGF member a const pointer
since it is public but only assigned in the constructor.
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70302
Dávid Bolvanský [Wed, 27 Nov 2019 23:49:26 +0000 (00:49 +0100)]
[ADT] Fixed -Wdeprecated-copy warning. NFCI
Craig Topper [Wed, 27 Nov 2019 23:11:43 +0000 (15:11 -0800)]
[X86] Add SSEPackedSingle/Double execution domain to COMI/UCOMI SSE/AVX instructions.
David Tenty [Wed, 27 Nov 2019 22:17:02 +0000 (17:17 -0500)]
[AIX] Emit TOC entries for ASM printing
Summary:
Emit the correct .toc psuedo op when we change to the TOC and emit
TC entries. Make sure TOC psuedos get the right symbols via overriding
getMCSymbolForTOCPseudoMO on AIX. Add a test for TOC assembly writing
and update tests to include TOC entries.
Also make sure external globals have a csect set and handle external function descriptor (originally authored by Jason Liu) so we can emit TOC entries for them.
Reviewers: DiggerLin, sfertile, Xiangling_L, jasonliu, hubert.reinterpretcast
Reviewed By: jasonliu
Subscribers: arphaman, wuzish, nemanjai, hiraditya, kbarton, jsji, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70461
Dávid Bolvanský [Wed, 27 Nov 2019 21:44:43 +0000 (22:44 +0100)]
Revert "[Attributor] Move pass after InstCombine to futher eliminate null pointer checks"
This reverts commit
7ca7d62c6ea1680ec0a1861083669596547fdd6f. Commited accidentally.
Stefan Pintilie [Wed, 27 Nov 2019 21:38:05 +0000 (15:38 -0600)]
[PowerPC] Separate Features that are known to be Power9 specific from Future CPU
The Power 9 CPU has some features that are unlikely to be passed on to future
versions of the CPU. This patch separates this out so that future CPU does not
inherit them.
Differential Revision: https://reviews.llvm.org/D70466
Dávid Bolvanský [Wed, 27 Nov 2019 21:36:29 +0000 (22:36 +0100)]
Try to reenable -Wdeprecated-copy under -Wextra
Dávid Bolvanský [Tue, 26 Nov 2019 19:50:56 +0000 (20:50 +0100)]
[Attributor] Move pass after InstCombine to futher eliminate null pointer checks
Summary: PR44149
Reviewers: jdoerfert
Subscribers: mehdi_amini, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70737
Saleem Abdulrasool [Wed, 27 Nov 2019 20:55:46 +0000 (12:55 -0800)]
build: avoid cached literals being linked against
If the value of the LibXml2 search is cached, it can cause an errant
link against LIBXML2_LIBRARIES-NOTFOUND if libxml2 is not found. Add
a guard against this. Should repair the build bots.
Saleem Abdulrasool [Wed, 27 Nov 2019 20:34:36 +0000 (12:34 -0800)]
build: avoid hardcoding the libxml2 library name
FindLibXml2 will set the LIBXML2_LIBRARIES variable to the libraries that
we must link against. This will be an empty string if libxml2 is not
found. Avoid hardcoding the library name as xml2 in the configuration.
Simplify the usage in the WindowsManifest library.
Stefan Pintilie [Wed, 27 Nov 2019 18:50:23 +0000 (12:50 -0600)]
[PowerPC] Add new Future CPU for PowerPC in LLVM
This is a continuation of D70262
The previous patch as listed above added the future CPU in clang. This patch
adds the future CPU in the PowerPC backend. At this point the patch simply
assumes that a future CPU will have the same characteristics as pwr9. Those
characteristics may change with later patches.
Differential Revision: https://reviews.llvm.org/D70333
Nandor Licker [Mon, 11 Nov 2019 11:13:34 +0000 (11:13 +0000)]
[ConstExprPreter] Removed the flag forcing the use of the interpreter
Summary:
Removed the ```-fforce-experimental-new-constant-interpreter flag```, leaving
only the ```-fexperimental-new-constant-interpreter``` one. The interpreter
now always emits an error on an unsupported feature.
Allowing the interpreter to bail out would require a mapping from APValue to
interpreter memory, which will not be necessary in the final version. It is
more sensible to always emit an error if the interpreter fails.
Reviewers: jfb, Bigcheese, rsmith, dexonsmith
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70071
Craig Topper [Wed, 27 Nov 2019 19:11:41 +0000 (11:11 -0800)]
[CriticalAntiDepBreaker] Teach the regmask clobber check to check if any subregister is preserved before considering the super register clobbered
X86 has some calling conventions where bits 127:0 of a vector register are callee saved, but the upper bits aren't. Previously we could detect that the full ymm register was clobbered when the xmm portion was really preserved. This patch checks the subregisters to make sure they aren't preserved.
Fixes PR44140
Differential Revision: https://reviews.llvm.org/D70699
taewookoh [Wed, 27 Nov 2019 19:17:10 +0000 (11:17 -0800)]
Revert
b19ec1eb3d0c
Summary: This reverts commit
b19ec1eb3d0c as it fails powerpc tests
Subscribers: llvm-commits
Sanjay Patel [Wed, 27 Nov 2019 18:33:11 +0000 (13:33 -0500)]
[x86] make SLM extract vector element more expensive than default
I'm not sure what the effect of this change will be on all of the affected
tests or a larger benchmark, but it fixes the horizontal add/sub problems
noted here:
https://reviews.llvm.org/D59710?vs=227972&id=228095&whitespace=ignore-most#toc
The costs are based on reciprocal throughput numbers in Agner's tables for
PEXTR*; these appear to be very slow ops on Silvermont.
This is a small step towards the larger motivation discussed in PR43605:
https://bugs.llvm.org/show_bug.cgi?id=43605
Also, it seems likely that insert/extract is the source of perf regressions on
other CPUs (up to 30%) that were cited as part of the reason to revert D59710,
so maybe we'll extend the table-based approach to other subtargets.
Differential Revision: https://reviews.llvm.org/D70607
Gabor Horvath [Wed, 27 Nov 2019 18:56:36 +0000 (10:56 -0800)]
[clang-tidy] Fix PR35824
Differential Revision: https://reviews.llvm.org/D46027
Roman Lebedev [Wed, 27 Nov 2019 14:07:06 +0000 (17:07 +0300)]
[clang][CodeGen] Implicit Conversion Sanitizer: handle increment/decrement (PR44054)(take 2)
Summary:
Implicit Conversion Sanitizer is *almost* feature complete.
There aren't *that* much unsanitized things left,
two major ones are increment/decrement (this patch) and bit fields.
As it was discussed in
[[ https://bugs.llvm.org/show_bug.cgi?id=39519 | PR39519 ]],
unlike `CompoundAssignOperator` (which is promoted internally),
or `BinaryOperator` (for which we always have promotion/demotion in AST)
or parts of `UnaryOperator` (we have promotion/demotion but only for
certain operations), for inc/dec, clang omits promotion/demotion
altogether, under as-if rule.
This is technically correct: https://rise4fun.com/Alive/zPgD
As it can be seen in `InstCombineCasts.cpp` `canEvaluateTruncated()`,
`add`/`sub`/`mul`/`and`/`or`/`xor` operators can all arbitrarily
be extended or truncated:
https://github.com/llvm/llvm-project/blob/
901cd3b3f62d0c700e5d2c3f97eff97d634bec5e/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp#L1320-L1334
But that has serious implications:
1. Since we no longer model implicit casts, do we pessimise
their AST representation and everything that uses it?
2. There is no demotion, so lossy demotion sanitizer does not trigger :]
Now, i'm not going to argue about the first problem here,
but the second one **needs** to be addressed. As it was stated
in the report, this is done intentionally, so changing
this in all modes would be considered a penalization/regression.
Which means, the sanitization-less codegen must not be altered.
It was also suggested to not change the sanitized codegen
to the one with demotion, but i quite strongly believe
that will not be the wise choice here:
1. One will need to re-engineer the check that the inc/dec was lossy
in terms of `@llvm.{u,s}{add,sub}.with.overflow` builtins
2. We will still need to compute the result we would lossily demote.
(i.e. the result of wide `add`ition/`sub`traction)
3. I suspect it would need to be done right here, in sanitization.
Which kinda defeats the point of
using `@llvm.{u,s}{add,sub}.with.overflow` builtins:
we'd have two `add`s with basically the same arguments,
one of which is used for check+error-less codepath and other one
for the error reporting. That seems worse than a single wide op+check.
4. OR, we would need to do that in the compiler-rt handler.
Which means we'll need a whole new handler.
But then what about the `CompoundAssignOperator`,
it would also be applicable for it.
So this also doesn't really seem like the right path to me.
5. At least X86 (but likely others) pessimizes all sub-`i32` operations
(due to partial register stalls), so even if we avoid promotion+demotion,
the computations will //likely// be performed in `i32` anyways.
So i'm not really seeing much benefit of
not doing the straight-forward thing.
While looking into this, i have noticed a few more LLVM middle-end
missed canonicalizations, and filed
[[ https://bugs.llvm.org/show_bug.cgi?id=44100 | PR44100 ]],
[[ https://bugs.llvm.org/show_bug.cgi?id=44102 | PR44102 ]].
Those are not specific to inc/dec, we also have them for
`CompoundAssignOperator`, and it can happen for normal arithmetics, too.
But if we take some other path in the patch, it will not be applicable
here, and we will have most likely played ourselves.
TLDR: front-end should emit canonical, easy-to-optimize yet
un-optimized code. It is middle-end's job to make it optimal.
I'm really hoping reviewers agree with my personal assessment
of the path this patch should take..
This originally landed in
9872ea4ed1de4c49300430e4f1f4dfc110a79ab9
but got immediately reverted in
cbfa237892e55b7129a1178c9b03f26683d643af
because the assertion was faulty. That fault ended up being caused
by the enum - while there will be promotion, both types are unsigned,
with same width. So we still don't need to sanitize non-signed cases.
So far. Maybe the assert will tell us this isn't so.
Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=44054 | PR44054 ]].
Refs. https://github.com/google/sanitizers/issues/940
Reviewers: rjmccall, erichkeane, rsmith, vsk
Reviewed By: erichkeane
Subscribers: mehdi_amini, dexonsmith, cfe-commits, #sanitizers, llvm-commits, aaron.ballman, t.p.northover, efriedma, regehr
Tags: #llvm, #clang, #sanitizers
Differential Revision: https://reviews.llvm.org/D70539
Craig Topper [Wed, 27 Nov 2019 00:57:26 +0000 (16:57 -0800)]
[LegalizeTypes][FPEnv][X86] Add initial support for softening strict fp nodes
This is based on what's required for softening fp128 operations on 32-bit X86 assuming f32/f64/f80 are legal. So there could be some things missing.
Differential Revision: https://reviews.llvm.org/D70654
Taewook Oh [Wed, 27 Nov 2019 18:18:01 +0000 (10:18 -0800)]
[BPI] Improve unreachable/ColdCall heurstics to handle loops.
Summary:
While updatePostDominatedByUnreachable attemps to find basic blocks that are post-domianted by unreachable blocks, it currently cannot handle loops precisely, because it doesn't use the actual post dominator tree analysis but relies on heuristics of visiting basic blocks in post-order. More precisely, when the entire loop is post-dominated by the unreachable block, current algorithm fails to detect the entire loop as post-dominated by the unreachable because when the algorithm reaches to the loop latch it fails to tell all its successors (including the loop header) will "eventually" be post-domianted by the unreachable block, because the algorithm hasn't visited the loop header yet. This makes BPI for the loop latch to assume that loop backedges are taken with 100% of probability. And because of this, block frequency info sometimes marks virtually dead loops (which are post dominated by unreachable blocks) super hot, because 100% backedge-taken probability makes the loop iteration count the max value. updatePostDominatedByColdCall has the exact same problem as well.
To address this problem, this patch makes PostDominatedByUnreachable/PostDominatedByColdCall to be computed with the actual post-dominator tree.
Reviewers: skatkov, chandlerc, manmanren
Reviewed By: skatkov
Subscribers: manmanren, vsk, apilipenko, Carrot, qcolombet, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70104
Peter Collingbourne [Wed, 27 Nov 2019 02:18:14 +0000 (18:18 -0800)]
scudo: Limit the number of bytes tested in a realloc test.
This test was previously effectively doing:
P = malloc(X); write X bytes to P; P = realloc(P, X - Y); P = realloc(P, X)
and expecting that all X bytes stored to P would still be identical after
the final realloc.
This happens to be true for the current scudo implementation of realloc,
but is not guaranteed to be true by the C standard ("Any bytes in the new
object beyond the size of the old object have indeterminate values.").
This implementation detail will change with the new memory tagging support,
which unconditionally zeros newly allocated granules when memory tagging
is enabled. Fix this by limiting the number of bytes that we test to the
minimum size that we realloc the allocation to.
Differential Revision: https://reviews.llvm.org/D70761
Peter Collingbourne [Wed, 27 Nov 2019 17:35:47 +0000 (09:35 -0800)]
scudo: Replace a couple of macros with their expansions.
The macros INLINE and COMPILER_CHECK always expand to the same thing (inline
and static_assert respectively). Both expansions are standards compliant C++
and are used consistently in the rest of LLVM, so let's improve consistency
with the rest of LLVM by replacing them with the expansions.
Differential Revision: https://reviews.llvm.org/D70793
Peter Collingbourne [Wed, 27 Nov 2019 03:17:10 +0000 (19:17 -0800)]
scudo: Call setCurrentTSD(nullptr) when bringing down the TSD registry in tests.
Otherwise, we will hit a use-after-free when testing multiple instances of
the same allocator on the same thread. This only recently became a problem
with D70552 which caused us to run both ScudoCombinedTest.BasicCombined and
ScudoCombinedTest.ReleaseToOS on the unit tests' main thread.
Differential Revision: https://reviews.llvm.org/D70760
Martin Liska [Tue, 26 Nov 2019 09:24:38 +0000 (10:24 +0100)]
Make memory dump same as the one in asan.
Shadow memory (and short granules) are not prepended with memory
address and arrow at the end of line is removed.
Differential Revision: https://reviews.llvm.org/D70707
Kostya Kortchinsky [Mon, 25 Nov 2019 18:28:57 +0000 (10:28 -0800)]
[scudo][standalone] Make tests work on Fuchsia
Summary:
This CL makes unit tests compatible with Fuchsia's zxtest. This
required a few changes here and there, but also unearthed some
incompatibilities that had to be addressed.
A header is introduced to allow to account for the zxtest/gtest
differences, some `#if SCUDO_FUCHSIA` are used to disable incompatible
code (the 32-bit primary, or the exclusive TSD).
It also brought to my attention that I was using
`__scudo_default_options` in different tests, which ended up in a
single binary, and I am not sure how that ever worked. So move
this to the main cpp.
Additionally fully disable the secondary freelist on Fuchsia as we do
not track VMOs for secondary allocations, so no release possible.
With some modifications to Scudo's BUILD.gn in Fuchsia:
```
[==========] 79 tests from 23 test cases ran (10280 ms total).
[ PASSED ] 79 tests
```
Reviewers: mcgrathr, phosek, hctim, pcc, eugenis, cferris
Subscribers: srhines, jfb, #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D70682
Gabor Horvath [Wed, 27 Nov 2019 17:08:51 +0000 (09:08 -0800)]
[LifetimeAnalysis] Fix PR44150
References need somewhat special treatment. While copying a gsl::Pointer
will propagate the points-to set, creating an object from a reference
often behaves more like a dereference operation.
Differential Revision: https://reviews.llvm.org/D70755
Fangrui Song [Mon, 25 Nov 2019 19:02:56 +0000 (11:02 -0800)]
[ELF][ARM] Add getPCBias()
ThunkCreator::getThunk and ThunkCreator::normalizeExistingThunk
currently assume that the implicit addends are -8 for ARM and -4 for
Thumb. In D70637, ThunkCreator::getThunk will need to take care of the
relocation addend explicitly.
Add the utility function getPCBias() as a prerequisite so that the getThunk change in D70637
can be more general.
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D70690
Mark Murray [Fri, 15 Nov 2019 11:30:15 +0000 (11:30 +0000)]
[ARM][MVE][Intrinsics] Add MVE VAND/VORR/VORN/VEOR/VBIC intrinsics. Add unit tests.
Summary: Add MVE VAND/VORR/VORN/VEOR/VBIC intrinsics. Add unit tests.
Reviewers: simon_tatham, ostannard, dmgreen
Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D70547
Mark Murray [Mon, 25 Nov 2019 14:10:59 +0000 (14:10 +0000)]
[ARM][MVE][Intrinsics] Add MVE VMUL intrinsics. Remove annoying "t1" from VMUL* instructions. Add unit tests.
Summary: Add MVE VMUL intrinsics. Remove annoying "t1" from VMUL* instructions. Add unit tests.
Reviewers: simon_tatham, ostannard, dmgreen
Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D70546
Mark Murray [Wed, 13 Nov 2019 16:57:28 +0000 (16:57 +0000)]
[ARM][MVE][Intrinsics] Add MVE VABD intrinsics. Add unit tests.
Summary: Add MVE VABD intrinsics. Add unit tests.
Reviewers: simon_tatham, ostannard, dmgreen
Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D70545
Sanjay Patel [Wed, 27 Nov 2019 16:11:28 +0000 (11:11 -0500)]
[InstCombine] add tests for copysign; NFC
Jay Foad [Wed, 27 Nov 2019 16:04:15 +0000 (16:04 +0000)]
Remove a comment obsoleted by r227345.
Haojian Wu [Wed, 27 Nov 2019 15:22:16 +0000 (16:22 +0100)]
[clangd] Handle the missing call expr in targetDecl.
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: merge_guards_bot, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70773
marshall [Wed, 27 Nov 2019 15:13:00 +0000 (07:13 -0800)]
Optimize and fix basic_string move assignment operator. Reviewed as https://reviews.llvm.org/D68623. Thanks to mvels for the patch.
Alexey Bataev [Thu, 21 Nov 2019 15:00:56 +0000 (10:00 -0500)]
[OPENMP50]Add if clause in parallel for simd directive.
According to OpenMP 5.0, if clause can be used in parallel for simd directive. If condition in the if clause if false, the non-vectorized version of the
loop must be executed.
Hans Wennborg [Wed, 27 Nov 2019 14:47:44 +0000 (15:47 +0100)]
[profile] Fix file contention causing dropped counts on Windows under -fprofile-generate
See PR43425:
https://bugs.llvm.org/show_bug.cgi?id=43425
When writing profile data on Windows we were opening profile file with
exclusive read/write access.
In case we are trying to write to the file from multiple processes
simultaneously, subsequent calls to CreateFileA would return
INVALID_HANDLE_VALUE.
To fix this, I changed to open without exclusive access and then take a
lock.
Patch by Michael Holman!
Differential revision: https://reviews.llvm.org/D70330
Hideto Ueno [Wed, 27 Nov 2019 14:41:12 +0000 (14:41 +0000)]
[Attributor] Handle special case when offset equals zero in nonnull deduction
Roman Lebedev [Wed, 27 Nov 2019 14:02:01 +0000 (17:02 +0300)]
Revert "[clang][CodeGen] Implicit Conversion Sanitizer: handle increment/decrement (PR44054)"
The asssertion that was added does not hold,
breaks on test-suite/MultiSource/Applications/SPASS/analyze.c
Will reduce the testcase and revisit.
This reverts commit
9872ea4ed1de4c49300430e4f1f4dfc110a79ab9,
870f3542d3e0d06d208442bdca6482866b59171b.
David Green [Wed, 27 Nov 2019 11:01:27 +0000 (11:01 +0000)]
[ARM] Replace arm_neon_vqadds with sadd_sat
This replaces the A32 NEON vqadds, vqaddu, vqsubs and vqsubu intrinsics
with the target independent sadd_sat, uadd_sat, ssub_sat and usub_sat.
This helps generate vqadds from standard IR nodes, which might be
produced from the vectoriser. The old variants are removed in the
process.
Differential Revision: https://reviews.llvm.org/D69350
John Brawn [Wed, 27 Nov 2019 12:57:29 +0000 (12:57 +0000)]
[ARM] Add constrained FP intrinsics test
Currently XFAILed, as there are various things that need fixing.
Differential Revision: https://reviews.llvm.org/D70599
Roman Lebedev [Wed, 27 Nov 2019 13:05:02 +0000 (16:05 +0300)]
[CodeGen][UBSan] Relax newly-added verbose sanitization tests for inc/dec
In particular, don't hardcode the signature of the handler:
it takes src filepath so the length of buffers will not match,
Anastasia Stulova [Wed, 27 Nov 2019 11:03:11 +0000 (11:03 +0000)]
[OpenCL] Move addr space deduction to Sema.
In order to simplify implementation we are moving add space
deduction into Sema while constructing variable declaration
and on template instantiation. Pointee are deduced to generic
addr space during creation of types.
This commit also
- fixed addr space dedution for auto type;
- factors out in a separate helper function OpenCL specific
logic from type diagnostics in var decl.
Tags: #clang
Differential Revision: https://reviews.llvm.org/D65744
Sam McCall [Wed, 27 Nov 2019 12:44:06 +0000 (13:44 +0100)]
[Frontend] Clean up some dead code in PrecompiledPreamble. NFC
Roman Lebedev [Wed, 27 Nov 2019 10:04:38 +0000 (13:04 +0300)]
[clang][CodeGen] Implicit Conversion Sanitizer: handle increment/decrement (PR44054)
Summary:
Implicit Conversion Sanitizer is *almost* feature complete.
There aren't *that* much unsanitized things left,
two major ones are increment/decrement (this patch) and bit fields.
As it was discussed in
[[ https://bugs.llvm.org/show_bug.cgi?id=39519 | PR39519 ]],
unlike `CompoundAssignOperator` (which is promoted internally),
or `BinaryOperator` (for which we always have promotion/demotion in AST)
or parts of `UnaryOperator` (we have promotion/demotion but only for
certain operations), for inc/dec, clang omits promotion/demotion
altogether, under as-if rule.
This is technically correct: https://rise4fun.com/Alive/zPgD
As it can be seen in `InstCombineCasts.cpp` `canEvaluateTruncated()`,
`add`/`sub`/`mul`/`and`/`or`/`xor` operators can all arbitrarily
be extended or truncated:
https://github.com/llvm/llvm-project/blob/
901cd3b3f62d0c700e5d2c3f97eff97d634bec5e/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp#L1320-L1334
But that has serious implications:
1. Since we no longer model implicit casts, do we pessimise
their AST representation and everything that uses it?
2. There is no demotion, so lossy demotion sanitizer does not trigger :]
Now, i'm not going to argue about the first problem here,
but the second one **needs** to be addressed. As it was stated
in the report, this is done intentionally, so changing
this in all modes would be considered a penalization/regression.
Which means, the sanitization-less codegen must not be altered.
It was also suggested to not change the sanitized codegen
to the one with demotion, but i quite strongly believe
that will not be the wise choice here:
1. One will need to re-engineer the check that the inc/dec was lossy
in terms of `@llvm.{u,s}{add,sub}.with.overflow` builtins
2. We will still need to compute the result we would lossily demote.
(i.e. the result of wide `add`ition/`sub`traction)
3. I suspect it would need to be done right here, in sanitization.
Which kinda defeats the point of
using `@llvm.{u,s}{add,sub}.with.overflow` builtins:
we'd have two `add`s with basically the same arguments,
one of which is used for check+error-less codepath and other one
for the error reporting. That seems worse than a single wide op+check.
4. OR, we would need to do that in the compiler-rt handler.
Which means we'll need a whole new handler.
But then what about the `CompoundAssignOperator`,
it would also be applicable for it.
So this also doesn't really seem like the right path to me.
5. At least X86 (but likely others) pessimizes all sub-`i32` operations
(due to partial register stalls), so even if we avoid promotion+demotion,
the computations will //likely// be performed in `i32` anyways.
So i'm not really seeing much benefit of
not doing the straight-forward thing.
While looking into this, i have noticed a few more LLVM middle-end
missed canonicalizations, and filed
[[ https://bugs.llvm.org/show_bug.cgi?id=44100 | PR44100 ]],
[[ https://bugs.llvm.org/show_bug.cgi?id=44102 | PR44102 ]].
Those are not specific to inc/dec, we also have them for
`CompoundAssignOperator`, and it can happen for normal arithmetics, too.
But if we take some other path in the patch, it will not be applicable
here, and we will have most likely played ourselves.
TLDR: front-end should emit canonical, easy-to-optimize yet
un-optimized code. It is middle-end's job to make it optimal.
I'm really hoping reviewers agree with my personal assessment
of the path this patch should take..
Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=44054 | PR44054 ]].
Reviewers: rjmccall, erichkeane, rsmith, vsk
Reviewed By: erichkeane
Subscribers: mehdi_amini, dexonsmith, cfe-commits, #sanitizers, llvm-commits, aaron.ballman, t.p.northover, efriedma, regehr
Tags: #llvm, #clang, #sanitizers
Differential Revision: https://reviews.llvm.org/D70539
AndreyChurbanov [Wed, 27 Nov 2019 12:26:51 +0000 (15:26 +0300)]
[openmp] Fixed nonmonotonic schedule when #threads > #chunks in a loop.
Differential Revision: https://reviews.llvm.org/D70713
LLVM GN Syncbot [Wed, 27 Nov 2019 11:45:24 +0000 (11:45 +0000)]
gn build: Merge
19ac0eaf07e
Sam McCall [Mon, 25 Nov 2019 18:51:07 +0000 (19:51 +0100)]
[clangd] Shutdown cleanly on signals.
Summary:
This avoids leaking PCH files if editors don't use the LSP shutdown protocol.
This is one fix for https://github.com/clangd/clangd/issues/209
(Though I think we should *also* be unlinking the files)
Reviewers: kadircet, jfb
Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, jfb, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70684
Tim Northover [Wed, 27 Nov 2019 10:50:16 +0000 (10:50 +0000)]
AArch64: support the Apple NEON syntax for v8.2 crypto instructions.
Very simple change, just adding the extra syntax variant.
Georgii Rymar [Tue, 26 Nov 2019 14:47:34 +0000 (17:47 +0300)]
[llvm-readobj] - Always print "Predecessors" for version definition sections.
This is a follow-up discussed in D70495 thread.
The current logic is unusual for llvm-readobj. It doesn't print predecessors
list when it is empty. This is not good for machine parsers.
D70495 had to add this condition during refactoring to reduce amount of changes,
in tests, because the original code also had a similar logic.
Now seems it is time to get rid of it. This patch does it.
Differential revision: https://reviews.llvm.org/D70717
Raphael Isemann [Wed, 27 Nov 2019 09:27:25 +0000 (10:27 +0100)]
[lldb][NFC] Move TypeSystem RTTI to static variable to remove swift reference
Hans Wennborg [Wed, 27 Nov 2019 08:57:32 +0000 (09:57 +0100)]
clang-format-vs : Fix Unicode formatting
Use UTF-8 for communication with clang-format and convert the
replacements offset/length to characters position/count.
Internally VisualStudio.Text.Editor.IWpfTextView use sequence of Unicode
characters encoded using UTF-16 and use characters position/count for
manipulating text.
Resolved "Error while running clang-format: Specified argument was out
of the range of valid values. Parameter name: replaceSpan".
Patch by empty2fill!
Differential revision: https://reviews.llvm.org/D70633
Raphael Isemann [Wed, 27 Nov 2019 08:46:56 +0000 (09:46 +0100)]
[lldb][NFC] Remove unused CompilerType memory functions
Summary:
All these functions are unused from what I can see. Unless I'm missing something here, this code
can go the way of the Dodo.
Reviewers: labath
Reviewed By: labath
Subscribers: abidh, JDevlieghere, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D70770
Martin Storsjö [Mon, 25 Nov 2019 11:59:08 +0000 (13:59 +0200)]
[llvm-objcopy] [COFF] Fix a typo in a comment. NFC.
Martin Storsjö [Fri, 22 Nov 2019 22:46:24 +0000 (00:46 +0200)]
[MC] Produce proper section relative relocations for COFF in .debug_frame
The third parameter to Streamer.EmitSymbolValue() is "bool
IsSectionRelative = false".
For ELF, these debug sections are mapped to address zero, so a normal,
absolute address relocation works just fine, but COFF needs a section
relative relocation, and COFF is the only target where
needsDwarfSectionOffsetDirective() returns true. This matches how
EmitSymbolValue is called elsewhere in the same source file.
Differential Revision: https://reviews.llvm.org/D70661
Martin Storsjö [Tue, 26 Nov 2019 20:41:40 +0000 (22:41 +0200)]
[X86] [Win64] Avoid truncating large (> 32 bit) stack allocations
This fixes PR44129, which was broken in
a7adc3185b (in 7.0.0
and newer).
Differential Revision: https://reviews.llvm.org/D70741
Martin Storsjö [Wed, 16 Oct 2019 08:41:59 +0000 (11:41 +0300)]
[LLDB] Avoid using InitializeContext for zero-initializing a CONTEXT. NFC.
InitializeContext is useful for allocating a (potentially variable
size) CONTEXT struct in an unaligned byte buffer. In this case, we
already have a fixed size CONTEXT we want to initialize, and we only
used this as a very roundabout way of zero initializing it.
Instead just memset the CONTEXT we have, and set the ContextFlags field
manually.
This matches how it is done in NativeRegisterContextWindows_*.cpp.
This also makes LLDB run successfully in Wine (for a trivial tested
case at least), as Wine hasn't implemented the InitializeContext
function.
Differential Revision: https://reviews.llvm.org/D70742
Raphael Isemann [Wed, 27 Nov 2019 07:09:52 +0000 (08:09 +0100)]
[lldb][NFC] Early exit in DWARFASTParserClang::ParseArrayType
Hans Wennborg [Wed, 27 Nov 2019 08:04:04 +0000 (09:04 +0100)]
Update build_llvm_package.bat to build from the monorepo
czhengsz [Tue, 26 Nov 2019 02:18:32 +0000 (21:18 -0500)]
[PowerPC] [NFC] change PPCLoopPreIncPrep class name after D67088.
Afer https://reviews.llvm.org/D67088, PPCLoopPreIncPrep pass can prepare more instruction forms except pre inc form, like DS/DQ forms.
This patch is a follow-up of https://reviews.llvm.org/D67088 to rename the pass name.
Reviewed by: jsji
Differential Revision: https://reviews.llvm.org/D70371