Andrea Di Biagio [Mon, 2 Sep 2019 12:32:28 +0000 (12:32 +0000)]
[X86][BtVer2] Fix latency and throughput of conditional SIMD store instructions.
On BtVer2 conditional SIMD stores are heavily microcoded.
The latency is directly proportional to the number of packed elements extracted
from the input vector. Also, according to micro-benchmarks, most of the
computation seems to be done in the integer unit.
Only a minority of the uOPs is executed by the FPU. The observed behaviour on
the FPU looks similar to this:
- The input MASK value is moved to the Integer Unit
-- [ a VMOVMSK-like uOP-executed on JFPU0].
- In parallel, each element of the input XMM/YMM is extracted and then sent to
the IntegerUnit through JFPU1.
As expected, a (conditional) store is executed for every extracted element.
Interestingly, a (speculative) load is executed for every extracted element too.
It is as-if a "LOAD - BIT_EXTRACT- CMOV" sequence of uOPs is repeated by the
integer unit for every contionally stored element.
VMASKMOVDQU is a special case: the number of speculative loads is always 2
(presumably, one load per quadword). That means, extra shifts and masking is
performed on (one of) the loaded quadwords before each conditional store (that
also explains the big number of non-FP uOPs retired).
This patch replaces the existing writes for conditional SIMD stores (i.e.
WriteFMaskedStore, and WriteFMaskedStoreY) with the following new writes:
WriteFMaskedStore32 [ XMM Packed Single ]
WriteFMaskedStore32Y [ YMM Packed Single ]
WriteFMaskedStore64 [ XMM Packed Double ]
WriteFMaskedStore64Y [ YMM Packed Double ]
Added a wrapper class named X86SchedWriteMaskMove in X86Schedule.td to describe
both RM and MR variants for conditional SIMD moves in a single tablegen
definition.
Instances of that class are then passed in input to multiclass avx_movmask_rm
when constructing MASKMOVPS/PD definitions.
Since this patch introduces new writes, I had to update all the X86 scheduling
models.
Differential Revision: https://reviews.llvm.org/D66801
llvm-svn: 370649
Jeremy Morse [Mon, 2 Sep 2019 12:28:36 +0000 (12:28 +0000)]
[DebugInfo] LiveDebugValues: correctly discriminate kinds of variable locations
The missing line added by this patch ensures that only spilt variable
locations are candidates for being restored from the stack. Otherwise,
register or constant-value information can be interpreted as a spill
location, through a union.
The added regression test replicates a scenario where this occurs: the
stack load from [rsp] causes the register-location DBG_VALUE to be
"restored" to rsi, when it should be left alone. See PR43058 for details.
Un x-fail a test that was suffering from this from a previous patch.
Differential Revision: https://reviews.llvm.org/D66895
llvm-svn: 370648
Raphael Isemann [Mon, 2 Sep 2019 12:10:16 +0000 (12:10 +0000)]
[lldb][NFC] Add test for invalid gui command
llvm-svn: 370647
Raphael Isemann [Mon, 2 Sep 2019 11:58:03 +0000 (11:58 +0000)]
[lldb][NFC] Remove unused imports from TestIntegerTypesExpr.py
llvm-svn: 370645
Omair Javaid [Mon, 2 Sep 2019 11:53:29 +0000 (11:53 +0000)]
[ARM64] Simplify RegisterInfos_arm64.h with macro based RegisterInfo array
This patches paves way for upcoming SVE RegisterInfo definitions. This is cosmetic change which allows us to define ARM64 RegisterInfo using macros.
In future we ll have define two different RegisterInfos to choose between SVE vs non-SVE RegisterInfo with decision being made at thread creation.
Differential Revision: https://reviews.llvm.org/D66934
llvm-svn: 370644
James Henderson [Mon, 2 Sep 2019 11:42:30 +0000 (11:42 +0000)]
[llvm-strings][test] Merge two closely related tests
This is a follow-up to feedback on D66015.
Reviewed by: grimar
Differential Revision: https://reviews.llvm.org/D67069
llvm-svn: 370643
Nandor Licker [Mon, 2 Sep 2019 11:34:47 +0000 (11:34 +0000)]
Revert [Clang Interpreter] Initial patch for the constexpr interpreter
This reverts r370636 (git commit
8327fed9475a14c3376b4860c75370c730e08f33)
llvm-svn: 370642
Raphael Isemann [Mon, 2 Sep 2019 11:30:00 +0000 (11:30 +0000)]
[lldb][NFC] Remove unused imports from TestIntegerTypes.py
llvm-svn: 370641
Balazs Keri [Mon, 2 Sep 2019 11:01:09 +0000 (11:01 +0000)]
[AST] AST structural equivalence to work internally with pairs.
Summary:
The structural equivalence check stores now pairs of nodes in the
'from' and 'to' context instead of only the node in 'from' context
and a corresponding one in 'to' context. This is needed to handle
cases when a Decl in the 'from' context is to be compared with
multiple Decls in the 'to' context.
Reviewers: martong, a_sidorin
Reviewed By: martong, a_sidorin
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66538
llvm-svn: 370639
Raphael Isemann [Mon, 2 Sep 2019 10:55:52 +0000 (10:55 +0000)]
[lldb][NFC] Add test for source info
llvm-svn: 370638
Simon Pilgrim [Mon, 2 Sep 2019 10:42:48 +0000 (10:42 +0000)]
[X86] combineHorizontalPredicateResult - pull out repeated getTargetLoweringInfo() calls. NFCI.
llvm-svn: 370637
Nandor Licker [Mon, 2 Sep 2019 10:38:08 +0000 (10:38 +0000)]
[Clang Interpreter] Initial patch for the constexpr interpreter
Summary:
This patch introduces the skeleton of the constexpr interpreter,
capable of evaluating a simple constexpr functions consisting of
if statements. The interpreter is described in more detail in the
RFC. Further patches will add more features.
Reviewers: Bigcheese, jfb, rsmith
Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64146
llvm-svn: 370636
Fangrui Song [Mon, 2 Sep 2019 10:33:58 +0000 (10:33 +0000)]
[ELF] Do not ICF two sections with different output sections (by SECTIONS commands)
Fixes PR39418. Complements D47241 (the non-linker-script case).
processSectionCommands() assigns input sections to output sections.
ICF is called before it, so .text.foo and .text.bar may be folded even if
their output sections are made different by SECTIONS commands.
```
markLive<ELFT>()
doIcf<ELFT>() // During ICF, we don't know the output sections
writeResult()
combineEhSections<ELFT>()
script->processSectionCommands() // InputSection -> OutputSection assignment
```
This patch splits processSectionCommands() into processSectionCommands() and
processSymbolAssignments(), and moves processSectionCommands() before ICF:
```
markLive<ELFT>()
combineEhSections<ELFT>()
script->processSectionCommands()
doIcf<ELFT>() // should remove folded input sections
writeResult()
script->processSymbolAssignments()
```
An alternative approach is to unfold a section `sec` in
processSectionCommands() when we find `sec` and `sec->repl` belong to
different output sections. I feel this patch is superior because this
can fold more sections and the decouple of
SectionCommand/SymbolAssignment gives flexibility:
* An ExprValue can't be evaluated before its section is assigned to an
output section -> we can delete getOutputSectionVA and simplify
another place where we had to check if the output section is null.
Moreover, a case in linkerscript/early-assign-symbol.s can be handled
now.
* processSectionCommands/processSymbolAssignments can be freely moved
around.
Reviewed By: ruiu
Differential Revision: https://reviews.llvm.org/D66717
llvm-svn: 370635
Piotr Sobczak [Mon, 2 Sep 2019 10:02:54 +0000 (10:02 +0000)]
[AMDGPU] Add test
Summary:
Add test checking that the redundant immediate MOV instruction
(by-product of handling phi nodes) is not found in the generated code.
Reviewers: arsenm, anton-afanasyev, craig.topper, rtereshin, bogner
Reviewed By: arsenm
Subscribers: kzhuravl, yaxunl, dstuttard, tpr, t-tye, wdng, jvesely, nhaehnle, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D63860
llvm-svn: 370634
George Rimar [Mon, 2 Sep 2019 09:47:17 +0000 (09:47 +0000)]
[yaml2obj] - Allow overriding sh_name fields of the sections.
This is in line with the previous changes which allowed to
override the sh_offset/sh_size and useful for writing test cases.
Differential revision: https://reviews.llvm.org/D66998
llvm-svn: 370633
Djordje Todorovic [Mon, 2 Sep 2019 09:20:46 +0000 (09:20 +0000)]
[DWARFVerifier] Verify GNU extensions of call site DWARF symbols
Verify that the call site DWARF symbols (added during the implementation
of the debug entry values feature) are generated properly.
Differential Revision: https://reviews.llvm.org/D66865
llvm-svn: 370631
Fangrui Song [Mon, 2 Sep 2019 08:49:50 +0000 (08:49 +0000)]
[ELF] Align SHT_LLVM_PART_EHDR to a maximum page size boundary
Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=998712
SHT_LLVM_PART_EHDR marks the start of a partition. The partition
sections will be extracted to a separate file. Align to the next maximum
page size boundary so that we can find the ELF header at the start. We
cannot benefit from overlapping p_offset ranges with the previous
segment anyway.
It seems we lack some llvm-objcopy --extract-main-partition and
--extract-partition sanity checks. It may place EHDR at the start
even if p_offset if non zero. Anyway, the lld change is justified for
the reasons above.
Reviewed By: ruiu
Differential Revision: https://reviews.llvm.org/D67032
llvm-svn: 370629
Raphael Isemann [Mon, 2 Sep 2019 08:34:57 +0000 (08:34 +0000)]
[lldb] Add description to option completions.
Summary:
Right now our argument completions are rather cryptic for command options as they only list the letters:
```
(lldb) breakpoint set -
Available completions:
-G
-C
-c
-d
-i
-o
-q
-t
-x
[...]
```
With the new completion API we can easily extend this with the flag description so that it looks like this now:
```
(lldb) breakpoint set -
Available completions:
-G -- The breakpoint will auto-continue after running its commands.
-C -- A command to run when the breakpoint is hit, can be provided more than once, the commands will get run in order left to right.
-c -- The breakpoint stops only if this condition expression evaluates to true.
-d -- Disable the breakpoint.
-i -- Set the number of times this breakpoint is skipped before stopping.
-o -- The breakpoint is deleted the first time it stop causes a stop.
-q -- The breakpoint stops only for threads in the queue whose name is given by this argument.
-t -- The breakpoint stops only for the thread whose TID matches this argument.
-x -- The breakpoint stops only for the thread whose index matches this argument.
```
The same happens with --long-options now.
Reviewers: #lldb, labath
Reviewed By: labath
Subscribers: labath, JDevlieghere, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D67063
llvm-svn: 370628
Amara Emerson [Mon, 2 Sep 2019 08:18:55 +0000 (08:18 +0000)]
[AArch64][GlobalISel] Fix zext narrowScalar to use the right type when creating
the merges.
Fixes PR43171.
llvm-svn: 370627
Raphael Isemann [Mon, 2 Sep 2019 08:00:59 +0000 (08:00 +0000)]
[lldb][NFC] Add basic test for GUI command
Summary:
This adds a basic test for the GUI command. Just tests that it starts up, that we can quit the gui
and help window, and that the basic UI elements are rendered. Mostly testing the waters how
testing this command will do on the bots or if that will cause some serious issues when we do
fancy ncurses stuff.
Reviewers: labath, clayborg
Reviewed By: labath
Subscribers: JDevlieghere, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D67018
llvm-svn: 370625
Raphael Isemann [Mon, 2 Sep 2019 07:40:06 +0000 (07:40 +0000)]
[lldb][NFC] Remove unnecessary lldb_enable_attach in TestMultilineCompletion
We don't actually need to call this for this test.
llvm-svn: 370623
Balazs Keri [Mon, 2 Sep 2019 07:17:01 +0000 (07:17 +0000)]
[ASTImporter] At import of records re-order indirect fields too.
Summary:
Correct order of fields and indirect fields in imported RecordDecl
is needed for correct work of record layout calculations.
Reviewers: martong, a.sidorin, shafik, a_sidorin
Reviewed By: martong, a_sidorin
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66866
llvm-svn: 370621
Craig Topper [Sun, 1 Sep 2019 22:14:36 +0000 (22:14 +0000)]
[X86] Add initial support for unfolding broadcast loads from arithmetic instructions to enable LICM hoisting of the load
MachineLICM can hoist an invariant load, but if that load is folded it needs to be unfolded. On AVX512 sometimes this load is an broadcast load which we were previously unable to unfold. This patch adds initial support for that with a very basic list of supported instructions as a starting point.
Differential Revision: https://reviews.llvm.org/D67017
llvm-svn: 370620
Raphael Isemann [Sun, 1 Sep 2019 19:29:01 +0000 (19:29 +0000)]
[lldb] Test and fix invalid log command invocations
llvm-svn: 370619
Raphael Isemann [Sun, 1 Sep 2019 18:59:40 +0000 (18:59 +0000)]
[lldb][NFC] Add test for invalid expression command args
llvm-svn: 370618
Sanjay Patel [Sun, 1 Sep 2019 18:38:15 +0000 (18:38 +0000)]
[DAGCombiner] improve throughput of shift+logic+shift
The motivating case for this is a long way from here:
https://bugs.llvm.org/show_bug.cgi?id=43146
...but I think this is where we have to start.
We need to canonicalize/optimize sequences of shift and logic to ease
pattern matching for things like bswap and improve perf in general.
But without the artificial limit of '!LegalTypes' (early combining),
there are a lot of test diffs, and not all are good.
In the minimal tests added for this proposal, x86 should have better
throughput in all cases. AArch64 is neutral for scalar tests because
it can fold shifts into bitwise logic ops.
There are 3 shift opcodes and 3 logic opcodes for a total of 9 possible patterns:
https://rise4fun.com/Alive/VlI
https://rise4fun.com/Alive/n1m
https://rise4fun.com/Alive/1Vn
Differential Revision: https://reviews.llvm.org/D67021
llvm-svn: 370617
Raphael Isemann [Sun, 1 Sep 2019 16:30:06 +0000 (16:30 +0000)]
[lldb][NFC] Fix failing tests on macOS after restructuring test folder
llvm-svn: 370616
Simon Pilgrim [Sun, 1 Sep 2019 16:04:51 +0000 (16:04 +0000)]
Fix MSVC unreferenced formal parameter warning. NFCI.
llvm-svn: 370615
Simon Pilgrim [Sun, 1 Sep 2019 16:04:38 +0000 (16:04 +0000)]
Fix MSVC unreferenced formal parameter warning. NFCI.
llvm-svn: 370614
Simon Pilgrim [Sun, 1 Sep 2019 16:04:28 +0000 (16:04 +0000)]
[X86][AVX] Rename + cleanup lowerShuffleAsLanePermuteAndBlend. NFCI.
Rename to lowerShuffleAsLanePermuteAndShuffle to make it clear that not just blends are performed.
Cleanup the in-lane shuffle mask generation to make it more obvious what's going on.
Some prep work noticed while investigating the poor shuffle code mentioned in D66004.
llvm-svn: 370613
Jan Kratochvil [Sun, 1 Sep 2019 15:08:33 +0000 (15:08 +0000)]
[lldb] Small optimization of FormatMap::Delete
llvm-svn: 370612
Raphael Isemann [Sun, 1 Sep 2019 13:36:44 +0000 (13:36 +0000)]
[lldb][NFC] Fix failing tests after restructuring test folder
Just adjusts all the relative paths in the Makefiles (and
the breakpoint test which seems to rely on the name of its
folder).
llvm-svn: 370611
Simon Pilgrim [Sun, 1 Sep 2019 13:10:18 +0000 (13:10 +0000)]
Fix shadow variable warning. NFCI.
llvm-svn: 370610
Simon Pilgrim [Sun, 1 Sep 2019 13:10:08 +0000 (13:10 +0000)]
Fix variable HasArrayDesignator set but not used warning. NFCI.
llvm-svn: 370609
Roman Lebedev [Sun, 1 Sep 2019 11:56:52 +0000 (11:56 +0000)]
[ConstantFolding] Fix 'undef' folding for @llvm.[us]{add,sub}.with.overflow ops (PR43188)
As we have already established/fixed in
https://bugs.llvm.org/show_bug.cgi?id=42209
https://reviews.llvm.org/D63065
https://reviews.llvm.org/rL363522
the InstSimplify handling for @llvm.with.overflow ops with undefs
is correct. Therefore if ConstantFolding produces different results,
then it is wrong.
This duplication of code hints at the need for some refactoring,
but for now address the brokenness of ConstantFolding by
copying the known-good handling from rL363522.
Fixes https://bugs.llvm.org/show_bug.cgi?id=43188
llvm-svn: 370608
David Green [Sun, 1 Sep 2019 10:11:40 +0000 (10:11 +0000)]
[ARM] Remove MVE masked loads/stores
These were never enabled correctly and are causing other problems. Taking them
out for the moment, whilst we work on the issues.
This reverts r370329.
llvm-svn: 370607
Raphael Isemann [Sun, 1 Sep 2019 09:12:37 +0000 (09:12 +0000)]
[lldb] Restructure test folders to match LLDB command hierarchy
Summary:
As discussed on lldb-dev, this patch moves some LLDB tests into a hierarchy that more closely
resembles the commands we use in the LLDB interpreter. This patch should only move tests
that use the command interpreter and shouldn't touch any tests that primarily test the SB API.
Reviewers: #lldb, jfb, JDevlieghere
Reviewed By: #lldb, JDevlieghere
Subscribers: dexonsmith, arphaman, JDevlieghere, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D67033
llvm-svn: 370605
Shiva Chen [Sun, 1 Sep 2019 04:52:54 +0000 (04:52 +0000)]
[TargetLowering] Fix Bugzilla ID 43183 to avoid soften comparison broken with constant inputs
Summary:
This fixes the bugzilla id 43183 which triggerd by the following commit:
[RISCV] Avoid generating AssertZext for LP64 ABI when lowering floating LibCall
llvm-svn: 370604
Matt Arsenault [Sun, 1 Sep 2019 02:00:08 +0000 (02:00 +0000)]
AMDGPU: Remove unused custom node definition
llvm-svn: 370603
Puyan Lotfi [Sun, 1 Sep 2019 00:45:28 +0000 (00:45 +0000)]
[GlobalISel][NFC] Regression test cases for aarch64 legalizer (s128 sext+icmp).
There were legalizer asserts in aarch64 globalisel (in debug mode) with s128
sext+icmp before r367060 and r366943 landed. These are just a couple reduced
mir and ir regression tests that came from a build where these were encountered.
llvm-svn: 370602
Craig Topper [Sat, 31 Aug 2019 23:52:25 +0000 (23:52 +0000)]
[X86] Replace some COPY_TO_REGCLASS from GR32/GR64 to VR128 in isel patterns with VMOVDI2PDIrr/VMOV64toPQIrr.
This is what the copies will eventually be turned into. We don't
use COPY_TO_REGCLASS for scalar_to_vector patterns. So we should
use the real instruction here too.
llvm-svn: 370601
Craig Topper [Sat, 31 Aug 2019 23:52:21 +0000 (23:52 +0000)]
[X86] Compress the flag bits in the folding tables to make room for more bits in an upcoming patch.
llvm-svn: 370600
Nico Weber [Sat, 31 Aug 2019 23:17:38 +0000 (23:17 +0000)]
[libc++] Fix directory_iterator compilation on Win32
This patch fixes some typos and other small errors in
directory_iterator.cpp that prevented this file from being compiled for
Win32.
Patch by Stefan Schmidt <thrimbor.github@gmail.com>!
Differential Revision: https://reviews.llvm.org/D66986
llvm-svn: 370599
David Bolvansky [Sat, 31 Aug 2019 18:52:44 +0000 (18:52 +0000)]
[clang] Devirtualization for classes with destructors marked as 'final'
A class with a destructor marked final cannot be derived from, so it should afford the same devirtualization opportunities as marking the entire class final.
Patch by logan-5 (Logan Smith)
Reviewed by rsmith
Differential Revision: https://reviews.llvm.org/D66621
llvm-svn: 370597
David Bolvansky [Sat, 31 Aug 2019 18:44:57 +0000 (18:44 +0000)]
[NFC] Fixed -Wdocumentation warning
/srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.src/lib/Target/AMDGPU/AMDGPUGenRegisterBankInfo.def:98:1: warning: not a Doxygen trailing comment [-Wdocumentation]
1 warning generated.
llvm-svn: 370596
David Bolvansky [Sat, 31 Aug 2019 18:35:44 +0000 (18:35 +0000)]
[NFC] Fix for rL370594
llvm-svn: 370595
David Bolvansky [Sat, 31 Aug 2019 18:31:19 +0000 (18:31 +0000)]
[clang] Warning for non-final classes with final destructors
Marking a class' destructor final prevents the class from being inherited from. However, it is a subtle and awkward way to express that at best, and unintended at worst. It may also generate worse code (in other compilers) than marking the class itself final. For these reasons, this revision adds a warning for nonfinal classes with final destructors, with a note to suggest marking the class final to silence the warning.
See https://reviews.llvm.org/D66621 for more background.
Patch by logan-5 (Logan Smith)
Differential Revision: https://reviews.llvm.org/D66711
llvm-svn: 370594
David Bolvansky [Sat, 31 Aug 2019 18:19:05 +0000 (18:19 +0000)]
[InstCombine] mempcpy(d,s,n) to memcpy(d,s,n) + n
Summary:
Back-end currently expands mempcpy, but middle-end should work with memcpy instead of mempcpy to enable more memcpy-optimization.
GCC backend emits mempcpy, so LLVM backend could form it too, if we know mempcpy libcall is better than memcpy + n.
https://godbolt.org/z/dOCG96
Reviewers: efriedma, spatel, craig.topper, RKSimon, jdoerfert
Reviewed By: efriedma
Subscribers: hjl.tools, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65737
llvm-svn: 370593
Simon Pilgrim [Sat, 31 Aug 2019 16:21:31 +0000 (16:21 +0000)]
[X86] EltsFromConsecutiveLoads - Don't confuse elt count with vector element count (PR43170)
EltsFromConsecutiveLoads was assuming that the number of input elts was the same as the number of elements in the output vector type when creating a zeroing shuffle, causing an assert when subvectors were being combined instead of just scalars.
llvm-svn: 370592
Simon Pilgrim [Sat, 31 Aug 2019 16:04:39 +0000 (16:04 +0000)]
[X86][AVX512] Regenerate tests with common prefixes
llvm-svn: 370591
Sanjay Patel [Sat, 31 Aug 2019 15:49:16 +0000 (15:49 +0000)]
[AArch64][x86] increase value type coverage in tests; NFC
This goes with D67021.
llvm-svn: 370590
Simon Pilgrim [Sat, 31 Aug 2019 15:19:59 +0000 (15:19 +0000)]
Fix shadow variable warning by making CondCodes names more explicit. NFCI.
llvm-svn: 370589
Nandor Licker [Sat, 31 Aug 2019 15:15:39 +0000 (15:15 +0000)]
Revert [Clang Interpreter] Initial patch for the constexpr interpreter
This reverts r370584 (git commit
afcb3de117265a69d21e5673356e925a454d7d02)
llvm-svn: 370588
Sanjay Patel [Sat, 31 Aug 2019 15:08:58 +0000 (15:08 +0000)]
[DAGCombiner] clean up code in visitShiftByConstant()
This is not quite NFC because the SDLoc propagation is changed,
but there are no regression test diffs from that.
llvm-svn: 370587
Simon Pilgrim [Sat, 31 Aug 2019 15:01:03 +0000 (15:01 +0000)]
Fix shadow variable warning. NFCI.
llvm-svn: 370585
Nandor Licker [Sat, 31 Aug 2019 15:00:38 +0000 (15:00 +0000)]
[Clang Interpreter] Initial patch for the constexpr interpreter
Summary:
This patch introduces the skeleton of the constexpr interpreter,
capable of evaluating a simple constexpr functions consisting of
if statements. The interpreter is described in more detail in the
RFC. Further patches will add more features.
Reviewers: Bigcheese, jfb, rsmith
Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64146
llvm-svn: 370584
Simon Pilgrim [Sat, 31 Aug 2019 14:18:26 +0000 (14:18 +0000)]
[X86ISelLowering] combineCMov - cleanup CMOV->LEA codegen. NFCI.
Only compute the diff once and we don't need the truncation code (assert the bitwidth is correct just to be safe).
llvm-svn: 370583
Simon Pilgrim [Sat, 31 Aug 2019 13:14:52 +0000 (13:14 +0000)]
[X86ISelLowering] LowerSELECT - remove duplicate value type. NFCI.
VT of SELECT result and selection ops will be the same.
llvm-svn: 370581
Simon Pilgrim [Sat, 31 Aug 2019 12:30:19 +0000 (12:30 +0000)]
Fix cppcheck shadow variable and variable scope warnings. NFCI.
llvm-svn: 370580
Amaury Sechet [Sat, 31 Aug 2019 11:40:02 +0000 (11:40 +0000)]
[DAGCombiner] Match (add X, X) as (shl X, 1) when detecting rotate.
Summary: The combiner transforms (shl X, 1) into (add X, X).
Reviewers: craig.topper, efriedma, RKSimon, lebedev.ri
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66882
llvm-svn: 370578
Fangrui Song [Sat, 31 Aug 2019 10:48:09 +0000 (10:48 +0000)]
[llvm-objcopy] Simplify alignToAddr with llvm::alignTo
llvm-svn: 370577
James Molloy [Sat, 31 Aug 2019 10:46:16 +0000 (10:46 +0000)]
[DAGCombiner] Don't create illegal narrow stores
Narrowing stores when the target doesn't support the narrow version
forces the target to expand into a load-modify-store sequence, which
is highly suboptimal. The information narrowing throws away (legality
of the inverse transform) is hard to re-analyze. If the target doesn't
support a store of the narrow type, don't narrow even in pre-legalize
mode.
No test as this is DAGCombiner and depends on target bits.
llvm-svn: 370576
Nikita Popov [Sat, 31 Aug 2019 09:58:50 +0000 (09:58 +0000)]
[LVI] Extract solveBlockValueExtractValue(); NFC
Extract this method in preparation for additional extractvalue
support.
llvm-svn: 370575
Nikita Popov [Sat, 31 Aug 2019 09:58:42 +0000 (09:58 +0000)]
[CVP] Add tests for simplified with.overflow + icmp; NFC
These tests are based on D19867.
llvm-svn: 370574
Nikita Popov [Sat, 31 Aug 2019 09:58:37 +0000 (09:58 +0000)]
[CVP] Generate simpler code for elided with.overflow intrinsics
Use a { iN undef, i1 false } struct as the base, and only insert
the first operand, instead of using { iN undef, i1 undef } as the
base and inserting both. This is the same as what we do in InstCombine.
Differential Revision: https://reviews.llvm.org/D67034
llvm-svn: 370573
Raphael Isemann [Sat, 31 Aug 2019 09:41:25 +0000 (09:41 +0000)]
[lldb] Unify target checking in CommandObject
Summary:
We currently have several CommandObjects that manually reimplement the checking for a selected target
or a target in the execution context (which is the selected target when they are invoked). This patch removes
all these checks and replaces them by setting the eCommandRequiresTarget flag that Pavel suggested. With
this flag we are doing the same check but without having to duplicate this code in all these CommandObjects.
I also added a `GetSelectedTarget()` variant of the `GetSelectedOrDummyTarget()` function to the
CommandObject that checks that the flag is set and then returns a reference to the target. I didn't rewrite
all the `target` variables from `Target *` to `Target &` in this patch as last time this change caused a lot of merge
conflicts in Swift and I would prefer having that in a separate NFC commit.
Reviewers: labath, clayborg
Reviewed By: labath, clayborg
Subscribers: clayborg, JDevlieghere, jingham, amccarth, abidh, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D66863
llvm-svn: 370571
Raphael Isemann [Sat, 31 Aug 2019 09:40:26 +0000 (09:40 +0000)]
[lldb][NFC] Remove unused prompt variable in TestMultilineCompletion.py
llvm-svn: 370570
Bjorn Pettersson [Sat, 31 Aug 2019 09:28:50 +0000 (09:28 +0000)]
[CodeGen] Refactor DAGTypeLegalizer::ExpandIntRes_MULFIX. NFC
Restructured the code a little bit in preparation for adding
UMULFIXSAT. I think it will be easier to understand the code
if not interleaving the codegen for signed/unsigned/saturated
cases that much.
llvm-svn: 370569
Bjorn Pettersson [Sat, 31 Aug 2019 09:01:16 +0000 (09:01 +0000)]
[LangRef] Update saturating examples for llvm.smul.fix.sat. NFC
Some saturation examples for llvm.smul.fix.sat were not showing
the correct result. I've adjusted the operands to make sure that
we actually trigger overflow in those examples.
llvm-svn: 370566
Wei Mi [Sat, 31 Aug 2019 03:17:49 +0000 (03:17 +0000)]
Fix some errors introduced by rL370563 which were not exposed on my local machine.
1. zlib::compress accept &size_t but the param is an uint64_t.
2. Some systems don't have zlib installed. Don't use compression by default.
llvm-svn: 370564
Wei Mi [Sat, 31 Aug 2019 02:27:26 +0000 (02:27 +0000)]
[SampleFDO] Add profile symbol list section to discriminate function being
cold versus function being newly added.
This is the second half of https://reviews.llvm.org/D66374.
Profile symbol list is the collection of function symbols showing up in
the binary which generates the current profile. It is used to discriminate
function being cold versus function being newly added. Profile symbol list
is only added for profile with ExtBinary format.
During profile use compilation, when profile-sample-accurate is enabled,
a function without profile will be regarded as cold only when it is
contained in that list.
Differential Revision: https://reviews.llvm.org/D66766
llvm-svn: 370563
Alex Lorenz [Sat, 31 Aug 2019 01:26:04 +0000 (01:26 +0000)]
Introduce a DirectoryEntryRef that stores both a reference and an
accessed name to the directory entry
This commit introduces a parallel API that returns a DirectoryEntryRef
to the FileManager, similar to the parallel FileEntryRef API. All
uses will have to be update in follow-up patches. The immediate use of the new API in this
patch fixes the issue where a file manager was reused in clang-scan-deps,
but reported an different file path whenever a framework lookup was done through a symlink.
Differential Revision: https://reviews.llvm.org/D67026
llvm-svn: 370562
David Blaikie [Sat, 31 Aug 2019 01:05:46 +0000 (01:05 +0000)]
llvm-dwarfdump: Cache CU low_pc when computing statistics.
llvm-svn: 370559
Richard Smith [Sat, 31 Aug 2019 01:00:37 +0000 (01:00 +0000)]
[c++20] Add support for designated direct-list-initialization syntax.
This completes the implementation of P0329R4.
llvm-svn: 370558
Thomas Lively [Sat, 31 Aug 2019 00:12:29 +0000 (00:12 +0000)]
[WebAssembly] Add SIMD QFMA/QFMS
Summary:
Adds clang builtins and LLVM intrinsics for these experimental
instructions. They are not implemented in engines yet, but that is ok
because the user must opt into using them by calling the builtins.
Reviewers: aheejin, dschuff
Reviewed By: aheejin
Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D67020
llvm-svn: 370556
Richard Smith [Sat, 31 Aug 2019 00:05:50 +0000 (00:05 +0000)]
[c++20] Disallow template argument deduction from a braced-init-list
containing designators. The C++20 wording doesn't actually say what
happens in this case, but treating this as a non-deduced context seems
like the most natural behavior.
(We might want to consider deducing through array designators as an
extension in the future, but will need to be careful to deduce the array
bound properly if we do so. That's not permitted herein.)
llvm-svn: 370555
Sterling Augustine [Sat, 31 Aug 2019 00:00:34 +0000 (00:00 +0000)]
Revert "Add gdb pretty printers for a wide variety of libc++ data structures."
This reverts commit
d8c9f2f572fe06a34ccfc28ee9223b64d7d275d3.
llvm-svn: 370553
Jonas Devlieghere [Fri, 30 Aug 2019 23:54:13 +0000 (23:54 +0000)]
[test] Make sys.stdout compatible with both Python 2 & 3
This time's the charm.
llvm-svn: 370552
Sterling Augustine [Fri, 30 Aug 2019 23:43:34 +0000 (23:43 +0000)]
Add gdb pretty printers for a wide variety of libc++ data structures.
Summary: Also add a test suite.
Reviewers: EricWF
Subscribers: christof, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65609
Run a pep8 formatter.
Run pep8 formatter.
Convert to PEP8, address other comments from code review.
llvm-svn: 370551
Vlad Tsyrklevich [Fri, 30 Aug 2019 23:24:41 +0000 (23:24 +0000)]
Revert "[lld-link] implement -start-lib and -end-lib"
This reverts commit r370487 as it is causing ASan/MSan failures on
sanitizer-x86_64-linux-fast
llvm-svn: 370550
Jonas Devlieghere [Fri, 30 Aug 2019 23:16:02 +0000 (23:16 +0000)]
[lit] Only set DYLD_LIBRARY_PATH for shared builds
In r370135 I committed a temporary workaround for the sanitized bot to
not set (DY)LD_LIBRARY_PATH when (DY)LD_INSERT_LIBRARIES was set.
Setting (DY)LD_LIBRARY_PATH is only necessary for (standalone)
shared-library builds, so a better solution is to only set the
environment variable when necessary.
Differential revision: https://reviews.llvm.org/D67012
llvm-svn: 370549
Alina Sbirlea [Fri, 30 Aug 2019 23:02:53 +0000 (23:02 +0000)]
[MemorySSA] Rename all phi entries.
When renaming Phis incoming values, there may be multiple edges incoming
from the same block (switch). Rename all.
llvm-svn: 370548
Wei Mi [Fri, 30 Aug 2019 23:01:22 +0000 (23:01 +0000)]
[GVN] Verify value equality before doing phi translation for call instruction
This is an updated version of https://reviews.llvm.org/D66909 to fix PR42605.
Basically, current phi translatation translates an old value number to an new
value number for a call instruction based on the literal equality of call
expression, without verifying there is no clobber in between. This is incorrect.
To get a finegrain check, use MachineDependence analysis to do the job. However,
this is still not ideal. Although given a call instruction,
`MemoryDependenceResults::getCallDependencyFrom` returns identical call
instructions without clobber in between using MemDepResult with its DepType to
be `Def`. However, identical is too strict here and we want it to be relaxed a
little to consider phi-translation -- callee is the same, param operands can be
different. That means changing the semantic of `MemDepResult::Def` and I don't
know the potential impact.
So currently the patch is still conservative to only handle
MemDepResult::NonFuncLocal, which means the current call has no function local
clobber. If there is clobber, even if the clobber doesn't stand in between the
current call and the call with the new value, we won't do phi-translate.
Differential Revision: https://reviews.llvm.org/D67013
llvm-svn: 370547
Duncan P. N. Exon Smith [Fri, 30 Aug 2019 22:59:25 +0000 (22:59 +0000)]
ASTReader: Bypass overridden files when reading PCHs
If contents of a file that is part of a PCM are overridden when reading
it, but weren't overridden when the PCM was being built, the ASTReader
will emit an error. Now it creates a separate FileEntry for recovery,
bypassing the overridden content instead of discarding it. The
pre-existing testcase clang/test/PCH/remap-file-from-pch.cpp confirms
that the new recovery method works correctly.
This resolves a long-standing FIXME to avoid hypothetically invalidating
another precompiled module that's already using the overridden contents.
This also removes ContentCache-related API that would be unsafe to use
across `CompilerInstance`s in an implicit modules build. This helps to
unblock us sinking it from SourceManager into FileManager in the future,
which would allow us to delete `InMemoryModuleCache`.
https://reviews.llvm.org/D66710
llvm-svn: 370546
Jonas Devlieghere [Fri, 30 Aug 2019 22:53:38 +0000 (22:53 +0000)]
[test] Fix 'argument must be str, not bytes' for Python 3.
Use `sys.stdout.buffer` instead of `sys.stdout` in lldbpexpect.py.
llvm-svn: 370545
Richard Smith [Fri, 30 Aug 2019 22:52:55 +0000 (22:52 +0000)]
[c++20] Implement semantic restrictions for C++20 designated
initializers.
This has some interesting interactions with our existing extensions to
support C99 designated initializers as an extension in C++. Those are
resolved as follows:
* We continue to permit the full breadth of C99 designated initializers
in C++, with the exception that we disallow a partial overwrite of an
initializer with a non-trivially-destructible type. (Full overwrite
is OK, because we won't run the first initializer at all.)
* The C99 extensions are disallowed in SFINAE contexts and during
overload resolution, where they could change the meaning of valid
programs.
* C++20 disallows reordering of initializers. We only check for that for
the simple cases that the C++20 rules permit (designators of the form
'.field_name =' and continue to allow reordering in other cases).
It would be nice to improve this behavior in future.
* All C99 designated initializer extensions produce a warning by
default in C++20 mode. People are going to learn the C++ rules based
on what Clang diagnoses, so it's important we diagnose these properly
by default.
* In C++ <= 17, we apply the C++20 rules rather than the C99 rules, and
so still diagnose C99 extensions as described above. We continue to
accept designated C++20-compatible initializers in C++ <= 17 silently
by default (but naturally still reject under -pedantic-errors).
This is not a complete implementation of P0329R4. In particular, that
paper introduces new non-C99-compatible syntax { .field { init } }, and
we do not support that yet.
This is based on a previous patch by Don Hinton, though I've made
substantial changes when addressing the above interactions.
Differential Revision: https://reviews.llvm.org/D59754
llvm-svn: 370544
Reid Kleckner [Fri, 30 Aug 2019 22:40:51 +0000 (22:40 +0000)]
Fix SEH_NoReturn machine verifier error
llvm-svn: 370543
Reid Kleckner [Fri, 30 Aug 2019 22:25:55 +0000 (22:25 +0000)]
[MC] Avoid crashes from improperly nested or wrong target .seh_handlerdata directives
llvm-svn: 370540
Nandor Licker [Fri, 30 Aug 2019 21:32:00 +0000 (21:32 +0000)]
Revert [Clang Interpreter] Initial patch for the constexpr interpreter
This reverts r370531 (git commit
d4c1002e0bbbbab50f6891cdd2f5bd3a8f3a3584)
llvm-svn: 370535
Reid Kleckner [Fri, 30 Aug 2019 21:23:05 +0000 (21:23 +0000)]
[X86] Print register names in .seh_* directives
Also improve assembler parser register validation for .seh_ directives.
This requires moving X86-specific seh directive handling into the x86
backend, which addresses some assembler FIXMEs.
Differential Revision: https://reviews.llvm.org/D66625
llvm-svn: 370533
Nandor Licker [Fri, 30 Aug 2019 21:17:03 +0000 (21:17 +0000)]
[Clang Interpreter] Initial patch for the constexpr interpreter
Summary:
This patch introduces the skeleton of the constexpr interpreter,
capable of evaluating a simple constexpr functions consisting of
if statements. The interpreter is described in more detail in the
RFC. Further patches will add more features.
Reviewers: Bigcheese, jfb, rsmith
Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64146
llvm-svn: 370531
Sanjay Patel [Fri, 30 Aug 2019 20:51:51 +0000 (20:51 +0000)]
[x86] add tests for shift-logic-shift; NFC
llvm-svn: 370529
Sanjay Patel [Fri, 30 Aug 2019 20:48:43 +0000 (20:48 +0000)]
[AArch64] add tests for shift-logic-shift; NFC
llvm-svn: 370528
Daniel Sanders [Fri, 30 Aug 2019 20:47:02 +0000 (20:47 +0000)]
Make add_new_check.py's insertion of registerCheck<> match the sort order
Summary:
Following on from review comments in D65919 about the ordering
of the registerCheck<> calls. Sort based on the check name which might
be on the line after the registerCheck<>
Reviewers: aaron.ballman
Subscribers: cfe-commits, llvm-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66505
llvm-svn: 370527
Jonas Devlieghere [Fri, 30 Aug 2019 20:46:55 +0000 (20:46 +0000)]
[test] Make sure PROMPT is a string
Currently tests using expect_prompt are failing on the Python 3 bot with
an error saying "argument must be str, not bytes". I don't have a Python
3 build handy, but I suspect this might fix that.
llvm-svn: 370526
Reid Kleckner [Fri, 30 Aug 2019 20:46:39 +0000 (20:46 +0000)]
[Windows] Disable TrapUnreachable for Win64, add SEH_NoReturn
Users have complained llvm.trap produce two ud2 instructions on Win64,
one for the trap, and one for unreachable. This change fixes that.
TrapUnreachable was added and enabled for Win64 in r206684 (April 2014)
to avoid poorly understood issues with the Windows unwinder.
There seem to be two major things in play:
- the unwinder
- C++ EH, _CxxFrameHandler3 & co
The unwinder disassembles forward from the return address to scan for
epilogues. Inserting a ud2 had the effect of stopping the unwinder, and
ensuring that it ran the EH personality function for the current frame.
However, it's not clear what the unwinder does when the return address
happens to be the last address of one function and the first address of
the next function.
The Visual C++ EH personality, _CxxFrameHandler3, needs to figure out
what the current EH state number is. It does this by consulting the
ip2state table, which maps from PC to state number. This seems to go
wrong when the return address is the last PC of the function or catch
funclet.
I'm not sure precisely which system is involved here, but in order to
address these real or hypothetical problems, I believe it is enough to
insert int3 after a call site if it would otherwise be the last
instruction in a function or funclet. I was able to reproduce some
similar problems locally by arranging for a noreturn call to appear at
the end of a catch block immediately before an unrelated function, and I
confirmed that the problems go away when an extra trailing int3
instruction is added.
MSVC inserts int3 after every noreturn function call, but I believe it's
only necessary to do it if the call would be the last instruction. This
change inserts a pseudo instruction that expands to int3 if it is in the
last basic block of a function or funclet. I did what I could to run the
Microsoft compiler EH tests, and the ones I was able to run showed no
behavior difference before or after this change.
Differential Revision: https://reviews.llvm.org/D66980
llvm-svn: 370525
Puyan Lotfi [Fri, 30 Aug 2019 20:25:46 +0000 (20:25 +0000)]
[IFS][NFC] llvm-ifs: Fixing build bot build break: revert r370517 and r370510.
llvm-svn: 370522
Sanjay Patel [Fri, 30 Aug 2019 20:15:01 +0000 (20:15 +0000)]
[Thumb2] tighten CHECK lines in test; NFC
The sequence between the function call and the asm start
may change without affecting what this test is looking for,
but we should have a better idea about what that sequence
looks like.
llvm-svn: 370518
Puyan Lotfi [Fri, 30 Aug 2019 20:09:55 +0000 (20:09 +0000)]
[IFS][NFC] llvm-ifs: Fixing build bot error due to commit conflicts.
r370510 and r370504
Again only on gcc.
llvm-svn: 370517
Nico Weber [Fri, 30 Aug 2019 20:06:44 +0000 (20:06 +0000)]
gn build: Merge r370512
llvm-svn: 370516