Kamlesh Kumar [Fri, 20 Dec 2019 19:41:46 +0000 (14:41 -0500)]
Apply the alignment specifier attribute to anonymous unions and structs.
Philip Reames [Fri, 20 Dec 2019 18:51:05 +0000 (10:51 -0800)]
Align branches within 32-Byte boundary (NOP padding)
WARNING: If you're looking at this patch because you're looking for a full
performace mitigation of the Intel JCC Erratum, this is not it!
This is a preliminary patch on the patch towards mitigating the performance
regressions caused by Intel's microcode update for Jump Conditional Code
Erratum. For context, see:
https://www.intel.com/content/www/us/en/support/articles/
000055650.html
The patch adds the required assembler infrastructure and command line options
needed to exercise the logic for INTERNAL TESTING. These are NOT public flags,
and should not be used for anything other than LLVM's own testing/debugging
purposes. They are likely to change both in spelling and meaning.
WARNING: This patch is knowingly incorrect in some cornercases. We need, and
do not yet provide, a mechanism to selective enable/disable the padding.
Conversation on this will continue in parellel with work on extending this
infrastructure to support prefix padding.
The goal here is to have the assembler align specific instructions such that
they neither cross or end at a 32 byte boundary. The impacted instructions are:
a. Conditional jump.
b. Fused conditional jump.
c. Unconditional jump.
d. Indirect jump.
e. Ret.
f. Call.
The new options for llvm-mc are:
-x86-align-branch-boundary=NUM aligns branches within NUM byte boundary.
-x86-align-branch=TYPE[+TYPE...] specifies types of branches to align.
A new MCFragment type, MCBoundaryAlignFragment, is added, which may emit
NOP to align the fused/unfused branch.
alignBranchesBegin inserts MCBoundaryAlignFragment before instructions,
alignBranchesEnd marks the end of the branch to be aligned,
relaxBoundaryAlign grows or shrinks sizes of NOP to align the target branch.
Nop padding is disabled when the instruction may be rewritten by the linker,
such as TLS Call.
Process Note: I am landing a patch by skan as it has been LGTMed, and
continuing to iterate on the review is simply slowing us down at this point.
We can and will continue to iterate in tree.
Patch By: skan
Differential Revision: https://reviews.llvm.org/D70157
Dan Liew [Fri, 20 Dec 2019 19:11:15 +0000 (11:11 -0800)]
[NFC][Driver] Add dummy compiler-rt sanitizer dylibs for Darwin.
This adds dummy files to the test resource directory used by the Clang
driver tests.
rdar://problem/
58118584
Fangrui Song [Wed, 18 Dec 2019 05:35:02 +0000 (21:35 -0800)]
[PPC32] Emit R_PPC_PLTREL24 for calls to dso_local ifunc
static void *ifunc(void) __attribute__((ifunc("resolver")));
void foo() { ifunc(); }
The relocation produced by the ifunc() call:
1. gcc -msecure-plt -fPIC => R_PPC_PLTREL24 r_addend=0x8000
2. gcc -msecure-plt -PIE => R_PPC_PLTREL24 r_addend=0x8000
3. clang -msecure-plt -fPIC => R_PPC_PLTREL24 r_addend=0x8000
4. clang -msecure-plt -fPIE => R_PPC_REL24
4 is incorrect. The R_PPC_REL24 needs a call stub due to ifunc. If this
relocation is mixed with other R_PPC_PLTREL24(r_addend=0x8000) in a
function, both GNU ld and lld (after D71621 fix) may produce a wrong
result.
This patch fixes 4 to use R_PPC_PLTREL24, which matches GCC.
Both GNU ld and lld (after D71621) will be happy.
Reviewed By: sfertile
Differential Revision: https://reviews.llvm.org/D71649
Craig Topper [Fri, 20 Dec 2019 18:52:44 +0000 (10:52 -0800)]
[X86] Fix a KNL miscompile caused by combineSetCC swapping LHS/RHS variables before a later use.
The setcc operands are copied into LHS and RHS variables at the top of the function. We also capture the condition code.
A later piece of code swaps the operands and changing the CC variable as part of a canonicalization to make some other checks simpler. But we might not make the transform we canonicalized for. So we continue on through the function where we can use the swapped LHS/RHS variables and access the original condition code operand instead of the modified CC variable. This leads to a setcc being created with the original condition code, but with swapped operands.
To mitigate this, this patch does a couple things. The LHS/RHS/CC variables are made const to keep them from being modified like this again. The transform that needs the swap now uses temporary copies of the variables. And the transform that used the original condition code operand has been altered to use the CC variable we cached originally. Either of these changes are enough to fix the issue, but doing both to make this code very safe.
I also considered rewriting the swap code in some way to check both permutations without explicitly swapping or needing temporary variables, but held off on that.
Differential Revision: https://reviews.llvm.org/D71736
Jonas Devlieghere [Sun, 8 Dec 2019 01:35:31 +0000 (17:35 -0800)]
[lldb/Lua] Implement a Simple Lua Script Interpreter Prototype
This implements a very elementary Lua script interpreter. It supports
running a single command as well as running interactively. It uses
editline if available. It's still missing a bunch of stuff though. Some
things that I intentionally ingored for now are that I/O isn't properly
hooked up (so every print goes to stdout) and the non-editline support
which is not handling a bunch of corner cases. The latter is a matter of
reusing existing code in the Python interpreter.
Discussion on the mailing list:
http://lists.llvm.org/pipermail/lldb-dev/2019-December/015812.html
Differential revision: https://reviews.llvm.org/D71234
Jim Ingham [Fri, 20 Dec 2019 19:00:11 +0000 (11:00 -0800)]
In 'thread step-out' command, only insert a breakpoint in executable memory.
Previously, if the current function had a nonstandard stack layout/ABI, and had a valid
data pointer in the location where the return address is usually located, data corruption
would occur when the breakpoint was written. This could lead to an incorrectly reported
crash or silent corruption of the program's state. Now, if the above check fails, the command safely aborts.
Differential Revision: https://reviews.llvm.org/D71372
Pierre Habouzit [Thu, 19 Dec 2019 09:25:03 +0000 (01:25 -0800)]
[objc_direct] Tigthen checks for direct methods
Because the name of a direct method must be agreed upon by the caller
and the implementation, certain bad practices that one can get away with
when using dynamism are fatal with direct methods.
To avoid really weird and unscruttable linker error, tighten the
front-end error reporting.
Rule 1:
Direct methods can only have at most one declaration in an @interface
container. Any redeclaration is strictly forbidden.
Today some amount of redeclaration is tolerated between the main
interface and categories for dynamic methods, but we can't have that.
Rule 2:
Direct method implementations can only be declared in a matching
@interface container: when implemented in the primary @implementation
then the declaration must be in the primary @interface or an
extension, and when implemented in a category, the declaration must be
in the @interface for the same category.
Also fix another issue with ObjCMethod::getCanonicalDecl(): when an
implementation lives in the primary @interface, then its canonical
declaration can be in any extension, even when it's not an accessor.
Add Sema tests to cover the new errors, and CG tests to beef up testing
around function names for categories and extensions.
Radar-Id: <rdar://problem/
58054563>
Differential Revision: https://reviews.llvm.org/D71694
Jim Ingham [Fri, 20 Dec 2019 18:56:39 +0000 (10:56 -0800)]
ThreadPlanTracer::TracingStarted can't call virtual methods on Thread.
TracingStarted gets called in the Thread constructor, which means you can't
call a virtual method of the class. So delay setting up the m_register_values
till you need them. NFC as lldb just crashes if you don't do this.
The thread tracing is an only occasionally useful feature, and it only sort
of works. I'm not adding tests etc. at this point, I'm just poking at it a
bit. If I get it working better I'll write tests and so forth.
Danilo Carvalho Grael [Tue, 17 Dec 2019 15:42:52 +0000 (10:42 -0500)]
[AArch64][SVE] Replace integer immediate intrinsics with splat vector variant
Summary: Replace the integer immediate intrisics with splat vector variants so they can be applied as optimizations for the C/C++ intrinsics.
Reviewers: sdesmalen, huntergr, rengolin, efriedma, c-rhodes, mgudim, kmclaughlin
Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits, amehsan
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71614
Jonas Paulsson [Tue, 17 Dec 2019 18:17:59 +0000 (10:17 -0800)]
[SystemZ] Add a mapping from "select register" to "load on condition" (2-addr).
The SELR(Mux) instructions can be converted to two-address form as LOCR(Mux)
instructions whenever one of the sources are the same reg as dest. By adding
this mapping in getTwoOperandOpcode(), we get:
- Two-address hints in getRegAllocationHints() for select register
instructions.
- No need anymore for special handling in SystemZShortenInst.cpp -
shortenSelect() removed.
The two-address hints are now added before the GRX32 hints, which should be
preferred.
Review: Ulrich Weigand
https://reviews.llvm.org/D68870
Raphael Isemann [Fri, 20 Dec 2019 18:38:02 +0000 (19:38 +0100)]
[lldb][NFC] Remove utility methods in TestClangASTImporter
We have a central header for all these methods so we can
just use those for creating ClangASTContexts.
Evgenii Stepanov [Wed, 27 Nov 2019 01:34:04 +0000 (17:34 -0800)]
llvm-symbolizer: support DW_FORM_loclistx locations.
Summary:
With -gdwarf-5 local variable locations are emitted as DW_FORM_loclistx
form instead of the regular DW_FORM_sec_offset. Teach
DWARFDie::getLocations to understand the new format and use it in
llvm-symbolizer "FRAME" command.
Reviewers: pcc, jdoerfert
Subscribers: srhines, aprantl, hiraditya, rupprecht, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70756
Jordan Rupprecht [Fri, 20 Dec 2019 18:25:57 +0000 (10:25 -0800)]
Temporarily revert "Reapply [LVI] Normalize pointer behavior" and "[LVI] Restructure caching"
This reverts commits
7e18aeba5062cd4324a9efb7bc25c9dbc4a34c2c (D70376)
21fbd5587cdfa11dabb3aeb0ead2d3d5fd0b490d (D69914) due to increased memory usage.
Jonas Paulsson [Tue, 17 Dec 2019 18:14:34 +0000 (10:14 -0800)]
[SystemZ] Bugfix and improve the handling of CC values.
It was recently discovered that the handling of CC values was actually broken
since overflow was not properly handled ('nsw' flag not checked for).
Add and sub instructions now have a new target specific instruction flag
named SystemZII::CCIfNoSignedWrap. It means that the CC result can be used
instead of a compare with 0, but only if the instruction has the 'nsw' flag
set.
This patch also adds the improvements of conversion to logical instructions
and the analyzing of add with immediates, to be able to eliminate more
compares.
Review: Ulrich Weigand
https://reviews.llvm.org/D66868
Victor Campos [Fri, 20 Dec 2019 18:08:24 +0000 (18:08 +0000)]
Revert "[ARM] Improve codegen of volatile load/store of i64"
This reverts commit
bbcf1c3496ce2bd1ed87e8fb15ad896e279633ce.
Raphael Isemann [Fri, 20 Dec 2019 17:44:39 +0000 (18:44 +0100)]
[lldb][NFC] Remove redundant ASTContext args to CopyDecl/DeportDecl
We already pass a Decl here and the additional ASTContext needs to
match the Decl. We might as well just pass the Decl and then extract
the ASTContext from that.
mydeveloperday [Fri, 20 Dec 2019 17:04:49 +0000 (17:04 +0000)]
[clang-format] C# formatting a class with inheritance followed by an attribute specifier assume its a braces initializer
Summary:
https://bugs.llvm.org/show_bug.cgi?id=44340
The rule that prevents `... {} [[....]]` being treated as a braced initializer for C++ causes problems for C# with attributes, causing it to be incorrectly classified and then messing up the subsequent formatting. (see bug for details of formatting)
Reviewers: mitchell-stellar, klimek, sammccall
Reviewed By: mitchell-stellar
Subscribers: cfe-commits
Tags: #clang-format, #clang
Differential Revision: https://reviews.llvm.org/D71769
Michał Górny [Sat, 14 Dec 2019 16:03:48 +0000 (17:03 +0100)]
[compiler-rt] [test] Disable MPROTECT on two builtin tests
Introduce a new %run_nomprotect substitution to run tests that do not
work with MPROTECT enabled. This uses paxctl via a wrapper on NetBSD,
and evaluates to plain %run on other systems.
Differential Revision: https://reviews.llvm.org/D71513
Michał Górny [Sat, 14 Dec 2019 13:17:19 +0000 (14:17 +0100)]
[libc++] Update feature list for NetBSD
Add NetBSD to the same feature list as Fuchsia since it matches
in available features, effectively enabling aligned_alloc(),
timespec_get() and C11 features. Remove now-duplicate declaration
of quick_exit() support.
Differential Revision: https://reviews.llvm.org/D71511
Alexey Bataev [Fri, 20 Dec 2019 16:17:55 +0000 (11:17 -0500)]
[OPENMP]Remove unused OPENMP_MATCH_KIND, NFC.
Pavel Labath [Fri, 20 Dec 2019 15:57:24 +0000 (16:57 +0100)]
[lldb/cmake] Delete LLDB_LINKER_SUPPORTS_GROUPS
The variable is unused.
Sanjay Patel [Fri, 20 Dec 2019 15:14:25 +0000 (10:14 -0500)]
[InstCombine] add tests for cast+gep; NFC
PR44321:
https://bugs.llvm.org/show_bug.cgi?id=44321
Pavel Labath [Fri, 20 Dec 2019 15:51:25 +0000 (16:51 +0100)]
[lldb] Fix an unused variable warning
Pavel Labath [Fri, 20 Dec 2019 15:50:06 +0000 (16:50 +0100)]
[lldb/cmake] Remove support for LLDB_DISABLE_CURSES
The buildbot which necessitated this is fixed.
Raphael Isemann [Fri, 20 Dec 2019 14:09:40 +0000 (15:09 +0100)]
[lldb][NFC] Move utility functions from ClangASTImporter and ClangExpressionDeclMap to own header
Kostya Kortchinsky [Thu, 19 Dec 2019 18:37:12 +0000 (10:37 -0800)]
[scudo][standalone] Implement TSD registry disabling
Summary:
In order to implement `malloc_{enable|disable}` we were just disabling
(or really locking) the Primary and the Secondary. That meant that
allocations could still be serviced from the TSD as long as the cache
wouldn't have to be filled from the Primary.
This wasn't working out for Android tests, so this change implements
registry disabling (eg: locking) so that `getTSDAndLock` doesn't
return a TSD if the allocator is disabled. This also means that the
Primary doesn't have to be disabled in this situation.
For the Shared Registry, we loop through all the TSDs and lock them.
For the Exclusive Registry, we add a `Disabled` boolean to the Registry
that forces `getTSDAndLock` to use the Fallback TSD instead of the
thread local one. Disabling the Registry is then done by locking the
Fallback TSD and setting the boolean in question (I don't think this
needed an atomic variable but I might be wrong).
I clang-formatted the whole thing as usual hence the couple of extra
whiteline changes in this CL.
Reviewers: cferris, pcc, hctim, morehouse, eugenis
Subscribers: jfb, #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D71719
Raphael Isemann [Fri, 20 Dec 2019 14:43:53 +0000 (15:43 +0100)]
[lldb] Put the headers in unittests/TestingSupport/ into modules
Ulrich Weigand [Fri, 20 Dec 2019 14:31:16 +0000 (15:31 +0100)]
[SystemZ][FPEnv] Enable strict vector FP extends/truncations
The back-end currently has special DAGCombine code to detect
cases where two floating-point extend or truncate operations
can be combined into a single vector operation.
This patch extends that support to also handle strict FP operations.
Note that currently only the case where both operations have the
same input chain are supported. This already suffices to cover
the common case where the operations result from scalarizing a
non-legal vector type. More general cases can be supported in
the future.
Paul Walker [Thu, 19 Dec 2019 13:34:37 +0000 (13:34 +0000)]
[AArch64][SVE] Correct intrinsics and patterns for logical predicate instructions
In general SVE intrinsics are considered predicated and merging
with everything else having suitable decoration. For predicated
zeroing operations (like the predicate logical instructions) we
use the "_z" suffix. After this change all intrinsics use their
expected names (i.e. orr instead of or and eor instead of xor).
I've removed intrinsics and patterns for condition code setting
instructions as that data is not returned as part of the intrinsic.
The expectation is to ask for a cc flag explicitly.
For example:
a = and_z(pg, p1, p2)
cc = ptest_<flag>(pg, a)
With the code generator expected to use "s" variants of instructions
when available.
Differential Revision: https://reviews.llvm.org/D71715
Pavel Labath [Fri, 20 Dec 2019 14:17:16 +0000 (15:17 +0100)]
[lldb] Fix a -Wreturn-type warning on gcc
Pavel Labath [Fri, 20 Dec 2019 14:11:49 +0000 (15:11 +0100)]
[lldb/pexpect] Force-set the TERM environment variable
In some environments (typically, buildbots), this variable may not be
available. This can cause tests to behave differently.
Explicitly set the variable to "vt100" to ensure consistent test
behavior. It should not matter that we do not inherit the process TERM
variable, as the child process runs in a new virtual terminal anyway.
Tom Weaver [Fri, 20 Dec 2019 14:03:34 +0000 (14:03 +0000)]
[OPT-DBG] Teach DbgEntityHistoryCalculator about meta-instructions.
The calculator was considering instructions such as KILLs as clobbers
of a physical address. This is wrong as meta instructions such as KILLs
produce no output in the final program and thus don't clobber or change
any physical location's value. As a result they're safe to ignore whilst
calculating location list ranges.
reviewers: aprantl, vsk
diff revision: https://reviews.llvm.org/D70497
fixes: https://bugs.llvm.org/show_bug.cgi?id=38753
Sanjay Patel [Thu, 19 Dec 2019 22:12:19 +0000 (17:12 -0500)]
[AArch64] add more tests for extract-bitcast-splat; NFC
Goes with D71672 - we should be able to handle casting to
a wider type as well as casting to a narrower type.
Raphael Isemann [Fri, 20 Dec 2019 13:18:02 +0000 (14:18 +0100)]
[lldb] Add tests for ClangASTImporter's DeportType and DeportDecl methods
Dmitri Gribenko [Fri, 20 Dec 2019 13:35:10 +0000 (14:35 +0100)]
Parenthesized a logical expression.
This change fixes a warning on the ppc64be buildbot.
Dmitri Gribenko [Fri, 20 Dec 2019 13:34:56 +0000 (14:34 +0100)]
Use isa instead of dyn_cast
Ayal Zaks [Thu, 19 Dec 2019 22:04:49 +0000 (00:04 +0200)]
[LV] Strip wrap flags from vectorized reductions
A sequence of additions or multiplications that is known not to wrap, may wrap
if it's order is changed (i.e., reassociated). Therefore when vectorizing
integer sum or product reductions, their no-wrap flags need to be removed.
Fixes PR43828
Patch by Denis Antrushin
Differential Revision: https://reviews.llvm.org/D69563
Johannes Altmanninger [Fri, 20 Dec 2019 12:25:27 +0000 (13:25 +0100)]
[lldb] Fix test using lld on non-linux systems
Cullen Rhodes [Wed, 4 Dec 2019 14:20:33 +0000 (14:20 +0000)]
[AArch64][SVE] Fold constant multiply of element count
Summary:
E.g.
%0 = tail call i64 @llvm.aarch64.sve.cntw(i32 31)
%mul = mul i64 %0, <const>
Should emit:
cntw x0, all, mul #<const>
For <const> in the range 1-16.
Patch by Kerry McLaughlin
Reviewers: sdesmalen, huntergr, dancgr, rengolin, efriedma
Reviewed By: sdesmalen
Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71014
Raphael Isemann [Fri, 20 Dec 2019 11:38:49 +0000 (12:38 +0100)]
[lldb] Make that we can call HostInfo::Initialize and HostInfo::Terminate multiple times
Summary:
HostInfo's state isn't actually fully rested after calling ::Terminate. Currently we only reset the
values of all the `HostInfoBaseFields` but not all the variables with static storage that
keep track of whether the fields need to be initialised. This breaks random unit tests as running
them twice (or running multiple test instances in one run) will cause that the second time
we ask HostInfo for any information we get the default value back for any field.
This patch moves all the once_flag's into the `HostInfoBaseFields` so that they also get reseted
by ::Terminate and removes all the `success` bools. We should also rewrite half this code but
I would prefer if my tests aren't broken over the holidays so let's just put some duct tape on it
for now.
Reviewers: labath
Reviewed By: labath
Subscribers: abidh, JDevlieghere, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D71748
Andrzej Warzynski [Fri, 20 Dec 2019 10:51:25 +0000 (10:51 +0000)]
[AArch64][SVE] Add intrnisics for saturating scalar arithmetic
Summary:
The following intrnisics are added:
* @llvm.aarch64.sve.sqdec{b|h|w|d|p}
* @llvm.aarch64.sve.sqinc{b|h|w|d|p}
* @llvm.aarch64.sve.uqdec{b|h|w|d|p}
* @llvm.aarch64.sve.uqinc{b|h|w|d|p}
For every intrnisic there a scalar variants (with n32 or n64 suffix) and
vector variants (no suffix).
Reviewers: sdesmalen, rengolin, efriedma
Reviewed By: sdesmalen, efriedma
Subscribers: eli.friedman, tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71252
Cullen Rhodes [Wed, 4 Dec 2019 16:33:49 +0000 (16:33 +0000)]
Recommit "[AArch64][SVE] Add permutation and selection intrinsics"
Recommit
23c28c40436143006be740533375c036d11c92cd (reverted in
dcb48f50bdfa0fa47b62d089b6ed999d857fc9f8) with a fix for an assert
"Request for a fixed size on a scalable object" being triggered in
`LowerSVEIntrinsicEXT`. The fix is to call `getKnownMinSize` on the
TypeSize object.
Andrzej Warzynski [Fri, 20 Dec 2019 09:27:10 +0000 (09:27 +0000)]
[AArch64][SVE] Add intrinsics for binary narrowing operations
Summary:
The following intrinsics for binary narrowing shift righ operations are
added:
* @llvm.aarch64.sve.shrnb
* @llvm.aarch64.sve.uqshrnb
* @llvm.aarch64.sve.sqshrnb
* @llvm.aarch64.sve.sqshrunb
* @llvm.aarch64.sve.uqrshrnb
* @llvm.aarch64.sve.sqrshrnb
* @llvm.aarch64.sve.sqrshrunb
* @llvm.aarch64.sve.shrnt
* @llvm.aarch64.sve.uqshrnt
* @llvm.aarch64.sve.sqshrnt
* @llvm.aarch64.sve.sqshrunt
* @llvm.aarch64.sve.uqrshrnt
* @llvm.aarch64.sve.sqrshrnt
* @llvm.aarch64.sve.sqrshrunt
Reviewers: sdesmalen, rengolin, efriedma
Reviewed By: efriedma
Subscribers: tschuett, kristof.beyls, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71552
Kadir Cetinkaya [Thu, 19 Dec 2019 21:22:01 +0000 (22:22 +0100)]
[clang][Tooling] Prefer -x over -std when interpolating
Summary:
Currently interpolation logic prefers -std over -x. But the latter is a
more strong signal, so this patch inverts the order and only makes use of -std
if -x didn't exist.
Fixes https://github.com/clangd/clangd/issues/185
Thanks @sammccall for tracking this down!
Reviewers: sammccall
Subscribers: ilya-biryukov, usaxena95, cfe-commits, sammccall
Tags: #clang
Differential Revision: https://reviews.llvm.org/D71727
Raphael Isemann [Fri, 20 Dec 2019 10:07:27 +0000 (11:07 +0100)]
[lldb] Added test for objc_direct calls with categories
As pointed out in D71694 this wasn't tested before in LLDB.
Sam Parker [Fri, 20 Dec 2019 09:32:36 +0000 (09:32 +0000)]
[ARM][MVE] Fixes for tail predication.
1) Fix an issue with the incorrect value being used for the number of
elements being passed to [d|w]lstp. We were trying to check that
the value was available at LoopStart, but this doesn't consider
that the last instruction in the block could also define the
register. Two helpers have been added to RDA for this.
2) Insert some code to now try to move the element count def or the
insertion point so that we can perform more tail predication.
3) Related to (1), the same off-by-one could prevent us from
generating a low-overhead loop when a mov lr could have been
the last instruction in the block.
4) Fix up some instruction attributes so that not all the
low-overhead loop instructions are labelled as branches and
terminators - as this is not true for dls/dlstp.
Differential Revision: https://reviews.llvm.org/D71609
David Spickett [Fri, 20 Dec 2019 09:11:07 +0000 (09:11 +0000)]
Re-land "[cmake] Add dependency on llvm-dwarfdump to llvm-locstats"
This reverts commit
f8e2ab3cd347cb7fb959ea0ece795f4eb347094c.
Pavel Labath [Fri, 20 Dec 2019 09:03:01 +0000 (10:03 +0100)]
[lldb] Remove XFAIL from TestDeadStrip.py
Fixed by 92211b.
Sam Parker [Fri, 20 Dec 2019 08:42:11 +0000 (08:42 +0000)]
[ARM][MVE] Tail predicate in the presence of vcmp
Record the discovered VPT blocks while checking for validity and, for
now, only handle blocks that begin with VPST and not VPT. We're now
allowing more than one instruction to define vpr, but each block must
somehow be predicated using the vctp. This leaves us with several
scenarios which need fixing up:
1) A VPT block with is only predicated by the vctp and has no
internal vpr defs.
2) A VPT block which is only predicated by the vctp but has an
internal vpr def.
3) A VPT block which is predicated upon the vctp as well as another
vpr def.
4) A VPT block which is not predicated upon a vctp, but contains it
and all instructions within the block are predicated upon in.
The changes needed are, for:
1) The easy one, just remove the vpst and unpredicate the
instructions in the block.
2) Remove the vpst and unpredicate the instructions up to the
internal vpr def. Need insert a new vpst to predicate the
remaining instructions.
3) No nothing.
4) The vctp will be inside a vpt and the instruction will be removed,
so adjust the size of the mask on the vpst.
Differential Revision: https://reviews.llvm.org/D71107
Sam Parker [Fri, 13 Dec 2019 14:41:08 +0000 (14:41 +0000)]
[ARM][MVE] Tail predicate bottom/top muls.
Add VMULL and VQDMULL variants to our tail predication white list.
Differential Revision: https://reviews.llvm.org/D71465
Karl-Johan Karlsson [Fri, 20 Dec 2019 07:07:22 +0000 (08:07 +0100)]
[clang] Fix the canonicalization of paths in -fdiagnostics-absolute-paths
In the current implementation of clang the canonicalization of paths in
diagnostic messages (when using -fdiagnostics-absolute-paths) only works
if the symbolic link is in the directory part of the filename, not if
the file itself is a symbolic link to another file.
This patch adds support to canonicalize the complete path including the
file.
Reviewers: rsmith, hans, rnk, ikudrin
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D70527
Johannes Altmanninger [Wed, 27 Nov 2019 21:48:15 +0000 (22:48 +0100)]
[LLDB] Fix address computation for inline function
Summary:
Fixes PR41237 - SIGSEGV on call expression evaluation when debugging clang
When linking multiple compilation units that define the same functions,
the functions is merged but their debug info is not. This ignores debug
info entries for functions in a non-executable sections; those are
functions that were definitely dropped by the linker.
Reviewers: spyffe, clayborg, jasonmolenda
Reviewed By: clayborg
Subscribers: labath, aprantl, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D71487
Craig Topper [Fri, 20 Dec 2019 06:30:23 +0000 (22:30 -0800)]
[X86] Make EmitCmp into a static function and explicitly return chain result for STRICT_FCMP. NFCI
The only thing its getting from the X86TargetLowering class is
the subtarget which we can easily pass. This function only has
one call site now since this might help the compiler inline it.
Explicitly return both the flag result and the chain result for
STRICT_FCMP nodes. This removes an assumption in the caller that
getValue(1) is the right way to get the chain.
Craig Topper [Fri, 20 Dec 2019 04:41:02 +0000 (20:41 -0800)]
[X86] Directly call EmitTest in two places instead of creating a null constant and calling EmitCmp. NFCI
EmitCmp will just immediately call EmitTest and discard the null
constant only to have EmitTest create it again if it doesn't fold.
So just skip all that and go directly to EmitTest.
Lang Hames [Fri, 20 Dec 2019 04:42:26 +0000 (20:42 -0800)]
[Orc][LLJIT] Re-apply
298e183e813 (use JITLink for LLJIT where supported).
Patch
d9220b580b3 fixed the underlying issue that casued
298e183e813 to fail.
Lang Hames [Fri, 20 Dec 2019 04:41:59 +0000 (20:41 -0800)]
[JITLink][MachO] Fix common symbol size plumbing.
This fixes the underlying bug that was exposed by
298e183e813.
Richard Smith [Thu, 19 Dec 2019 19:15:47 +0000 (11:15 -0800)]
CWG2352: Allow qualification conversions during reference binding.
The language wording change forgot to update overload resolution to rank
implicit conversion sequences based on qualification conversions in
reference bindings. The anticipated resolution for that oversight is
implemented here -- we order candidates based on qualification
conversion, not only on top-level cv-qualifiers.
For OpenCL/C++, this allows reference binding between pointers with
differing (nested) address spaces. This makes the behavior of reference
binding consistent with that of implicit pointer conversions, as is the
purpose of this change, but that pre-existing behavior for pointer
conversions is itself probably not correct. In any case, it's now
consistently the same behavior and implemented in only one place.
River Riddle [Fri, 20 Dec 2019 00:57:03 +0000 (16:57 -0800)]
[CommandLine] Add template instantiations of cl::parser for long and long long.
This allows cl::opt<int64_t>.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D71729
Craig Topper [Fri, 20 Dec 2019 00:03:11 +0000 (16:03 -0800)]
[X86] Add test case for miscompilation of a vector setcc on KNL target. NFC
Jessica Paquette [Thu, 19 Dec 2019 23:59:11 +0000 (15:59 -0800)]
[lit] Add "from .main import main" back into lit/__init__.py
A refactoring commit (
cf252240) removed this line. Removing it broke installing
lit with pip and setup.py.
This adds the line back in so that we can install lit again.
For an example of how this appeared, see:
http://green.lab.llvm.org/green/job/LNT_Tests/5853/
File "/Users/buildslave/jenkins/...s/__init__.py", line 2453, in resolve
raise ImportError(str(exc))
ImportError: 'module' object has no attribute 'main'
Mircea Trofin [Thu, 19 Dec 2019 23:31:50 +0000 (15:31 -0800)]
[NFC][InlineCost] Simplify internal inlining cost interface
Summary:
All the use cases of CallAnalyzer use the same call site parameter to
both construct the CallAnalyzer, and then pass to the analysis member.
This change removes this duplication.
Reviewers: davidxl, eraman, Jim
Reviewed By: davidxl
Subscribers: Jim, hiraditya, haicheng, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71645
Richard Smith [Thu, 19 Dec 2019 23:18:59 +0000 (15:18 -0800)]
Fix crash on init-capture packs where the type of the initializer is non-dependent.
Artem Dergachev [Thu, 19 Dec 2019 22:21:02 +0000 (14:21 -0800)]
[analyzer] Add a syntactic security check for ObjC NSCoder API.
Method '-[NSCoder decodeValueOfObjCType:at:]' is not only deprecated
but also a security hazard, hence a loud check.
Differential Revision: https://reviews.llvm.org/D71728
Roman Lebedev [Wed, 18 Dec 2019 17:24:38 +0000 (20:24 +0300)]
[ValueTracking] isKnownNonZero() should take non-null-ness assumptions into consideration (PR43267)
Summary:
It is pretty common to assume that something is not zero.
Even optimizer itself sometimes emits such assumptions
(e.g. `addAssumeNonNull()` in `PromoteMemoryToRegister.cpp`).
But we currently don't deal with such assumptions :)
The only way `isKnownNonZero()` handles assumptions is
by calling `computeKnownBits()` which calls `computeKnownBitsFromAssume()`.
But `x != 0` does not tell us anything about set bits,
it only says that there are *some* set bits.
So naturally, `KnownBits` does not get populated,
and we fail to make use of this assumption.
I propose to deal with this special case by special-casing it
via adding a `isKnownNonZeroFromAssume()` that returns boolean
when there is an applicable assumption.
While there, we also deal with other predicates,
mainly if the comparison is with constant.
Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=43267 | PR43267 ]].
Differential Revision: https://reviews.llvm.org/D71660
Roman Lebedev [Thu, 19 Dec 2019 21:10:07 +0000 (00:10 +0300)]
[ValueTracking] isValidAssumeForContext(): CxtI itself also must transfer execution to successor
This is a pretty rare case, when CxtI and assume are
in the same basic block, with assume being located later.
We were already checking that assumption was guaranteed to be
executed, but we omitted CxtI itself from consideration,
and as the test (miscompile) shows, that is incorrect.
As noted in D71660 review by @nikic.
Roman Lebedev [Thu, 19 Dec 2019 21:04:31 +0000 (00:04 +0300)]
[NFC][InstCombine] Add a test for assume-induced miscompile
@escape() may throw here, we don't know that assumption, which is located
afterwards in the same block, is executed, therefore %load arg of
call to @escape() can not be marked as non-null.
As noted in D71660 review by @nikic.
Vedant Kumar [Thu, 19 Dec 2019 22:03:22 +0000 (14:03 -0800)]
HotColdSplitting: Do not outline within noreturn functions
A function marked `noreturn` may contain unreachable terminators: these
should not be considered cold, as the function may be a trampoline.
rdar://
58068594
Philip Reames [Thu, 19 Dec 2019 22:03:19 +0000 (14:03 -0800)]
[StackMaps] Be explicit about label formation [NFC] (try 2)
Recommit after making the same API change in non-x86 targets. This has been build for all targets, and tested for effected ones. Why the difference? Because my disk filled up when I tried make check for all.
For auto-padding assembler support, we'll need to bundle the label with the instructions (nops or call sequences) so that they don't get separated. This just rearranges the code to make the upcoming change more obvious.
Tim Northover [Wed, 18 Dec 2019 12:26:02 +0000 (12:26 +0000)]
ConstrainedFP: use API compatible with opaque pointers.
This just updates an IRBuilder interface to take Functions instead of
Values so the type can be derived, and fixes some callsites in Clang to
call the updated API.
LLVM GN Syncbot [Thu, 19 Dec 2019 21:33:15 +0000 (21:33 +0000)]
[gn build] Port
3075cd5c9fc
Sylvestre Ledru [Thu, 19 Dec 2019 21:30:55 +0000 (22:30 +0100)]
Fix the links to clang analyzers checkers
Eric Christopher [Thu, 19 Dec 2019 21:24:54 +0000 (13:24 -0800)]
Temporarily Revert "[Dsymutil][Debuginfo][NFC] Refactor dsymutil to separate DWARF optimizing part 2."
as it causes a layering violation/dependency cycle:
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp -> llvm/DebugInfo/DWARF/DWARFExpression.h
llvm/include/llvm/DebugInfo/DWARF/DWARFOptimizer.h -> llvm/CodeGen/NonRelocatableStringpool.h
This reverts commit
abc7f6800df8a1f40e1e2c9ccce826abb0208284.
Sylvestre Ledru [Thu, 19 Dec 2019 20:54:38 +0000 (21:54 +0100)]
Fix some typos in the clang-tools-extra doc
jasonliu [Thu, 19 Dec 2019 20:30:12 +0000 (20:30 +0000)]
[XCOFF][AIX] Fix for missing of undefined symbols from symbol table
Summary:
When we use undefined symbol with its qualname, we are not able
to generate that symbol because of the logic of early "continue"
that skip the qualname symbol. This patch fixes it.
Differential revision: https://reviews.llvm.org/D71667
Richard Smith [Thu, 19 Dec 2019 20:57:04 +0000 (12:57 -0800)]
Implement latest C++ feature test macro recommendations.
We don't yet advertise init capture packs, because I found some bugs
while testing it. We reject-valid and then crash on both of these:
template<int ...a> auto x = [...y = a] {};
template<int ...a> auto x = [y = a...] {};
Eric Christopher [Thu, 19 Dec 2019 20:52:06 +0000 (12:52 -0800)]
Temporarily Revert "[StackMaps] Be explicit about label formation [NFC]"
as it broke the aarch64 build.
This reverts commit
bc7595d934b958ab481288d7b8e768fe5310be8f.
Kadir Cetinkaya [Thu, 19 Dec 2019 20:50:32 +0000 (21:50 +0100)]
[clangd] Fix write past end pointer
Philip Reames [Thu, 19 Dec 2019 20:24:29 +0000 (12:24 -0800)]
[StackMaps] Be explicit about label formation [NFC]
For auto-padding assembler support, we'll need to bundle the label with the instructions (nops or call sequences) so that they don't get separated. This just rearranges the code to make the upcoming change more obvious.
Philip Reames [Thu, 19 Dec 2019 20:01:51 +0000 (12:01 -0800)]
[FaultMaps] Make label formation a bit more explicit [NFC]
This is in advance of assembler padding directives support where we'll need to bundle the label w/the corresponding faulting instruction to avoid padding being inserted between.
Warren Ristow [Thu, 19 Dec 2019 19:40:50 +0000 (11:40 -0800)]
[X86] Mark various pointer arguments in builtins as const
Enabling `-Wcast-qual` identified many casts in various system headers
that were dropping the `const` qualifier. Fixing those missing
qualifiers pointed out that a few of the definitions of the builtins
did not properly identify their arguments as `const` pointers. This
commit fixes those builtin definitions, and the system header files
so that they no longer drop the qualifier.
Differential Revision: https://reviews.llvm.org/D71718
Craig Topper [Thu, 19 Dec 2019 19:39:17 +0000 (11:39 -0800)]
[LegalizeDAG] Add return to the strict node handling in PromoteLegalINT_TO_FP to prevent an invalid strict fp node from being created by falling into non-strict code path.
Michał Górny [Tue, 17 Dec 2019 20:30:59 +0000 (21:30 +0100)]
[compiler-rt] [test] Add missing %run to fread_fwrite MSAN test
Add a missing %run substitution to fread_fwrite test. This fixes
the test on NetBSD where %run disables ASLR as necessary for MSAN
to function.
Differential Revision: https://reviews.llvm.org/D71623
shafik [Thu, 19 Dec 2019 19:14:39 +0000 (11:14 -0800)]
[ASTImporter][LLDB] Modifying ImportDeclContext(...) to ensure that we complete each FieldDecl of a RecordDecl when we are importing the definiton
This fix was motivated by a crashes in expression parsing during code generation in which we had a RecordDecl that had incomplete FieldDecl. During code generation when computing the layout for the RecordDecl we crash because we have several incomplete FieldDecl.
This fixes the issue by assuring that during ImportDefinition(...) for a RecordDecl we also import the definitions for each FieldDecl.
Differential Revision: https://reviews.llvm.org/D71378
Guillaume Chatelet [Thu, 19 Dec 2019 14:41:05 +0000 (15:41 +0100)]
[Alignment][NFC] Align compatible methods for CreateElementUnorderedAtomicMemSet
Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790
Reviewers: courbet
Subscribers: hiraditya, jfb, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71703
Alexey Bataev [Thu, 19 Dec 2019 18:33:10 +0000 (13:33 -0500)]
[SLP]Fix test arguments, NFC.
Jonas Devlieghere [Sat, 7 Dec 2019 23:49:35 +0000 (15:49 -0800)]
[lldb/Lua] Add Boilerplate for a Lua Script Interpreter
This adds the boilerplate necessary to support the Lua script
interpreter. The interpreter is not functional yet and just reports that
it's not implemented.
Discussion on the mailing list:
http://lists.llvm.org/pipermail/lldb-dev/2019-December/015812.html
Differential revision: https://reviews.llvm.org/D71232
Roman Lebedev [Thu, 19 Dec 2019 17:13:20 +0000 (20:13 +0300)]
[NFC][InstCombine] Add some more non-zero assumption variants (D71660)
https://rise4fun.com/Alive/6yR
Alexey Bataev [Thu, 19 Dec 2019 17:49:01 +0000 (12:49 -0500)]
[SLP]Added test for gathering reused extracts from narrow vector, NFC.
Luís Marques [Thu, 19 Dec 2019 17:20:02 +0000 (17:20 +0000)]
[RISCV] Don't crash on unsupported relocations
Summary: Instead of crashing due to the `llvm_unreachable`, provide a proper
error when invalid fixups/relocations are encountered.
Reviewers: asb, lenary
Reviewed By: asb
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71536
Sanjay Patel [Thu, 19 Dec 2019 17:16:16 +0000 (12:16 -0500)]
[x86] add test for missing FMF propagation; NFC
This is a reduced test for D71495.
David Spickett [Thu, 19 Dec 2019 17:15:33 +0000 (17:15 +0000)]
Revert "[cmake] Add dependency on llvm-dwarfdump to llvm-locstats"
This reverts commit
ba430f503244d1498529d47f31090cdf79b5c231.
Which appears to have caused a failure on the lld-x86_64-ubuntu-fast
buildbot.
Jonas Paulsson [Tue, 17 Dec 2019 21:13:16 +0000 (13:13 -0800)]
[SystemZ] Recognize mrecord-mcount in backend
Emit the __mcount_loc section for all fentry calls.
Review: Ulrich Weigand
https://reviews.llvm.org/D71629
Jon Chesterfield [Thu, 19 Dec 2019 16:54:27 +0000 (16:54 +0000)]
[libomptarget][nfc] Provide target_impl malloc/free
Summary:
[libomptarget][nfc] Provide target_impl malloc/free
Sufficient to build support.cu for amdgcn
Reviewers: jdoerfert, ABataev, grokos
Reviewed By: jdoerfert
Subscribers: jvesely, mgorny, openmp-commits
Tags: #openmp
Differential Revision: https://reviews.llvm.org/D71685
Jonas Paulsson [Tue, 17 Dec 2019 20:00:43 +0000 (12:00 -0800)]
[Clang FE, SystemZ] Recognize -mrecord-mcount CL option.
Recognize -mrecord-mcount from the command line and add a function attribute
"mrecord-mcount" when passed.
Only valid on SystemZ (when used with -mfentry).
Review: Ulrich Weigand
https://reviews.llvm.org/D71627
lewis-revill [Thu, 19 Dec 2019 16:41:53 +0000 (16:41 +0000)]
[RISCV] Enable the machine outliner for RISC-V
This patch enables the machine outliner for RISC-V and adds the
necessary logic for checking whether sequences can be safely outlined,
and describing how they should be outlined. Outlined functions are
called using the register t0 (x5) as the return address register, which
must be available for an occurrence of a sequence to be safely outlined.
Differential Revision: https://reviews.llvm.org/D66210
David Spickett [Thu, 19 Dec 2019 15:00:56 +0000 (15:00 +0000)]
[cmake] Add dependency on llvm-dwarfdump to llvm-locstats
Though llvm-locstat is a "util" it requires llvm-dwarfdump
to be useful. So what happens now is that unless LLVM_BUILD_TOOLS
is ON llvm-locstats won't be part of the "all" target.
However given that it requires llvm-dwarfdump, this is less
confusing/build time consuming than suddenly having llvm-dwarfdump
build when all other tools are disabled.
Differential Revision: https://reviews.llvm.org/D71705
Bardia Mahjour [Thu, 19 Dec 2019 15:56:44 +0000 (10:56 -0500)]
[DDG] Data Dependence Graph - Ordinals
Summary:
This patch associates ordinal numbers to the DDG Nodes allowing
the builder to order nodes within a pi-block in program order. The
algorithm works by simply assuming the order in which the BBList
is fed into the builder. The builder already relies on the blocks being
in program order so that it can compute the dependencies correctly.
Similarly the order of instructions in their parent basic blocks
determine their program order.
Authored By: bmahjour
Reviewer: Meinersbur, fhahn, myhsu, xtian, dmgreen, kbarton, jdoerfert
Reviewed By: Meinersbur
Subscribers: ychen, arphaman, simoll, a.elovikov, mgorny, hiraditya, jfb, wuzish, llvm-commits, jsji, Whitney, etiotto, ppc-slack
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70986
Justin Hibbits [Thu, 21 Nov 2019 22:33:24 +0000 (16:33 -0600)]
[PowerPC] Only use PLT annotations if using PIC relocation model
Summary:
The default static (non-PIC, non-PIE) model for 32-bit powerpc does not
use @PLT annotations and relocations in GCC. LLVM shouldn't use @PLT
annotations either, because it breaks secure-PLT linking with (some
versions of?) GNU LD.
Update the available-externally.ll test to reflect that default mode should be
the same as the static relocation, by using the same check prefix.
Reviewed by: sfertile
Differential Revision: https://reviews.llvm.org/D70570
Cullen Rhodes [Thu, 19 Dec 2019 14:23:00 +0000 (14:23 +0000)]
Revert "[AArch64][SVE] Add permutation and selection intrinsics"
This reverts commit
23c28c40436143006be740533375c036d11c92cd.
It caused build failures in the following expensive checks builders:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-ubuntu/builds/1295
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-debian/builds/700
Reverting for now whilst I figure what the issue is.