Michael Trent [Sat, 21 Dec 2019 01:36:38 +0000 (17:36 -0800)]
Constrain the macho-stabs test added in
f72d001e099 to run on systems configured with an x86 backend.
Summary: This fixes a failure on the Builder clang-cmake-armv7-quick bot.
Reviewers: lhames, jhenderson
Reviewed By: lhames
Subscribers: kristof.beyls, rupprecht, seiya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71792
Philip Reames [Sat, 21 Dec 2019 01:07:37 +0000 (17:07 -0800)]
Add a set of tests with basic coverage of the recently added boundary align feature.
There are tests in the included patch, but the duplication is non obvious, so I'm starting with basic coverage beore cleaning up a few of them
Peter Collingbourne [Fri, 20 Dec 2019 21:17:45 +0000 (13:17 -0800)]
gn build: Silence mismatched-new-delete warning in scudo C++ wrapper tests.
These tests are deliberately mismatching new and delete, so the warnings
are just noise.
Differential Revision: https://reviews.llvm.org/D71783
Jessica Paquette [Fri, 20 Dec 2019 23:57:39 +0000 (15:57 -0800)]
[NFC][MachineOutliner] Rewrite setSuffixIndices to be iterative
Having this function be recursive could use up way too much stack space.
Rewrite it as an iterative traversal in the tree instead to prevent this.
Fixes PR44344.
Craig Topper [Thu, 19 Dec 2019 00:09:38 +0000 (16:09 -0800)]
[X86] Add test cases for missing propagation of fpexcept flag on strict fp operations. NFC
The flag is being lost during type legalization or lowering. This
covers some of the cases. I'm sure there are many missing.
Petr Hosek [Fri, 20 Dec 2019 23:52:14 +0000 (15:52 -0800)]
[llvm-symbolizer] Prefix invocations in test with env
This addresses an issue introduced in dedad08 and is needed to make
sure this test works properly on Windows.
Jonas Devlieghere [Fri, 20 Dec 2019 23:34:51 +0000 (15:34 -0800)]
Revert "[lldb/CMake] Change how we deal with optional dependencies"
This is failing on both the Windows and Debian bot.
Vedant Kumar [Fri, 20 Dec 2019 23:12:18 +0000 (15:12 -0800)]
[DWARF] Defer creating declaration DIEs until we prepare call site info
It isn't necessary to create DIEs for all of the declaration subprograms
in a CU's retainedTypes list. We can defer creating these subprograms
until we need to prepare a call site tag that refers to one.
This cleanup was mentioned in passing in D70350.
Vedant Kumar [Fri, 15 Nov 2019 23:37:29 +0000 (15:37 -0800)]
Reland: [DWARF] Allow cross-CU references of subprogram definitions
This allows a call site tag in CU A to reference a callee DIE in CU B
without resorting to creating an incomplete duplicate DIE for the callee
inside of CU A.
We already allow cross-CU references of subprogram declarations, so it
doesn't seem like definitions ought to be special.
This improves entry value evaluation and tail call frame synthesis in
the LTO setting. During LTO, it's common for cross-module inlining to
produce a call in some CU A where the callee resides in a different CU,
and there is no declaration subprogram for the callee anywhere. In this
case llvm would (unnecessarily, I think) emit an empty DW_TAG_subprogram
in order to fill in the call site tag. That empty 'definition' defeats
entry value evaluation etc., because the debugger can't figure out what
it means.
As a follow-up, maybe we could add a DWARF verifier check that a
DW_TAG_subprogram at least has a DW_AT_name attribute.
Update:
Reland with a fix to create a declaration DIE when the declaration is
missing from the CU's retainedTypes list. The declaration is left out
of the retainedTypes list in two cases:
1) Re-compiling pre-r266445 bitcode (in which declarations weren't added
to the retainedTypes list), and
2) Doing LTO function importing (which doesn't update the retainedTypes
list).
It's possible to handle (1) and (2) by modifying the retainedTypes list
(in AutoUpgrade, or in the LTO importing logic resp.), but I don't see
an advantage to doing it this way, as it would cause more DWARF to be
emitted compared to creating the declaration DIEs lazily.
Tested with a stage2 ThinLTO+RelWithDebInfo build of clang, and with a
ReleaseLTO-g build of the test suite.
rdar://
46577651, rdar://
57855316, rdar://
57840415
Differential Revision: https://reviews.llvm.org/D70350
Michael Trent [Thu, 12 Dec 2019 06:43:46 +0000 (22:43 -0800)]
llvm-objdump should ignore Mach-O stab symbols for disassembly.
Summary:
llvm-objdump will commonly error out when disassembling a Mach-O binary with
stab symbols, or when printing a Mach-O symbol table that includesstab symbols.
That is because the Mach-O N_OSO symbol has been modified to include the
bottom 8-bit value of the Mach-O's cpusubtype value in the section field. In
general, one cannot blindly assume a stab symbol's section field is valid
unless one has actually consulted the specification for the specific stab.
Since objdump mostly just walks the symbol table to get mnemonics for code
disassembly it's best for objdump to just ignore stab symbols. llvm-nm will
do a more complete and correct job of displaying Mach-O symbol table contents.
Reviewers: pete, lhames, ab, thegameg, jhenderson, MaskRay
Reviewed By: thegameg, MaskRay
Subscribers: MaskRay, rupprecht, seiya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71394
Yury Delendik [Fri, 20 Dec 2019 22:31:56 +0000 (14:31 -0800)]
[WebAssembly] Use TargetIndex operands in DbgValue to track WebAssembly operands locations
Extends DWARF expression language to express locals/globals locations. (via
target-index operands atm) (possible variants are: non-virtual registers
or address spaces)
The WebAssemblyExplicitLocals can replace virtual registers to targertindex
operand type at the time when WebAssembly backend introduces
{get,set,tee}_local instead of corresponding virtual registers.
Reviewed By: aprantl, dschuff
Tags: #debug-info, #llvm
Differential Revision: https://reviews.llvm.org/D52634
Sam Clegg [Fri, 20 Dec 2019 21:01:03 +0000 (13:01 -0800)]
Fix name of InitLibcalls() function in comment
Differential Revision: https://reviews.llvm.org/D71781
Jim Ingham [Fri, 20 Dec 2019 22:30:36 +0000 (14:30 -0800)]
Temporarily restrict the test for D71372 to darwin till we fix it on other systems.
Jonas Devlieghere [Wed, 18 Dec 2019 19:19:06 +0000 (11:19 -0800)]
[lldb/CMake] Change how we deal with optional dependencies
Recently there has been some discussion about how we deal with optional
dependencies in LLDB. The approach in LLVM is to make things work out of
the box. If the dependency isn't there, we move on silently.
That's not true for LLDB. Unless you explicitly disable the dependency
with LLDB_ENABLE_*, you'll get a configuration-time error. The
historical reason for this is that LLDB's dependencies have a much
broader impact, think about Python for example which is required to run
the test suite.
The current approach can be frustrating from a user experience
perspective. Sometimes you just want to ensure LLDB builds with a change
in clang.
This patch changes the optional dependencies (with the exception of
Python) to a new scheme. The LLDB_ENABLE_* now takes three values: On,
Off or Auto, with the latter being the default. On and Off behave the
same as today, forcing the dependency to be enabled or disabled. If the
dependency is set to On but is not found, it results in a configuration
time warning. For Auto we detect if the dependency is there and either
enable or disable it depending on whether it's found.
Differential revision: https://reviews.llvm.org/D71306
PS: The reason Python isn't included yet is because it's so pervasive
that I plan on doing that in a separate patch.
Julian Lettner [Mon, 16 Dec 2019 17:33:11 +0000 (09:33 -0800)]
[iOS sim] Ensure simulator device is booted in iossim_prepare.py
Recent versions of the iOS simulator require that a "simulator device"
is booted before we can use `simctl spawn` (see iossim_run.py) to start
processes.
We can use `simctl bootstatus` to ensure that the simulator device
is booted before we run any tests via lit. The `-b` option starts the
device if necessary.
Reviewed By: delcypher
Differential Revision: https://reviews.llvm.org/D71449
Stephen Kelly [Fri, 20 Dec 2019 21:32:43 +0000 (21:32 +0000)]
Revert "Customize simplified dumping and matching of LambdaExpr"
This reverts commit
494b1318ca77927e919bbf9a61749a58553d738c.
Jakub Kuderski [Fri, 20 Dec 2019 21:08:52 +0000 (16:08 -0500)]
[InstCombine] Improve infinite loop detection
Summary:
This patch limits the default number of iterations performed by InstCombine. It also exposes a new option that allows to specify how many iterations is considered getting stuck in an infinite loop.
Based on experiments performed on real-world C++ programs, InstCombine seems to perform at most ~8-20 iterations, so treating 1000 iterations as an infinite loop seems like a safe choice. See D71145 for details.
The two limits can be specified via command line options.
Reviewers: spatel, lebedev.ri, nikic, xbolva00, grosser
Reviewed By: spatel
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71673
Stephen Kelly [Wed, 18 Dec 2019 22:35:46 +0000 (22:35 +0000)]
Customize simplified dumping and matching of LambdaExpr
Reviewers: aaron.ballman
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D71680
Adrian Prantl [Thu, 19 Dec 2019 19:56:56 +0000 (11:56 -0800)]
Rename DW_AT_LLVM_isysroot to DW_AT_LLVM_sysroot
This is a purely cosmetic change that is NFC in terms of the binary
output. I bugs me that I called the attribute DW_AT_LLVM_isysroot
since the "i" is an artifact of GCC command line option syntax
(-isysroot is in the category of -i options) and doesn't carry any
useful information otherwise.
This attribute only appears in Clang module debug info.
Differential Revision: https://reviews.llvm.org/D71722
Michał Górny [Fri, 20 Dec 2019 21:08:01 +0000 (22:08 +0100)]
[compiler-rt] [test] Disable MPROTECT for XRay tests on NetBSD
Kostya Kortchinsky [Fri, 20 Dec 2019 16:23:57 +0000 (08:23 -0800)]
[scudo][standalone] Support __BIONIC__
Summary:
Some Android builds that we are interested in define `__BIONIC__`
but not `__ANDROID__`, so expand `SCUDO_ANDROID` to encompass those.
Reviewers: cferris, hctim, pcc, eugenis, morehouse
Subscribers: krytarowski, #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D71772
Bill Wendling [Fri, 20 Dec 2019 20:47:38 +0000 (12:47 -0800)]
Add parentheses to silence warning
Petr Hosek [Wed, 18 Dec 2019 18:19:47 +0000 (10:19 -0800)]
[llvm-symbolizer] Support reading options from environment
llvm-symbolizer is used by sanitizers to symbolize errors discovered by
sanitizer, but there's no way to pass options to llvm-symbolizer since
the tool is invoked directly by the sanitizer runtime. Therefore, we
don't have a way to pass options needed to find debug symbols such as
-dsym-hint or -debug-file-directory. This change enables reading options
from the LLVM_SYMBOLIZER_OPTS in addition to command line which can be
used to pass those additional options to llvm-symbolizer invocations
made by sanitizer runtime.
Differential Revision: https://reviews.llvm.org/D71668
Evgenii Stepanov [Fri, 20 Dec 2019 20:07:04 +0000 (12:07 -0800)]
[msan] Check qsort input.
Summary:
Qsort interceptor suppresses all checks by unpoisoning the data in the
wrapper of a comparator function, and then unpoisoning the output array
as well.
This change adds an explicit run of the comparator on all elements of
the input array to catch any sanitizer bugs.
Reviewers: vitalybuka
Subscribers: #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D71780
Gabor Horvath [Tue, 26 Nov 2019 17:17:30 +0000 (09:17 -0800)]
[analyzer] Add path notes to FuchsiaHandleCheck.
Differential Revision: https://reviews.llvm.org/D70725
LLVM GN Syncbot [Fri, 20 Dec 2019 20:35:49 +0000 (20:35 +0000)]
[gn build] Port
82923c71efa
Gabor Horvath [Sat, 16 Nov 2019 00:00:46 +0000 (16:00 -0800)]
[analyzer] Add Fuchsia Handle checker
The checker can diagnose handle use after releases, double releases, and
handle leaks.
Differential Revision: https://reviews.llvm.org/D70470
Evgenii Stepanov [Thu, 19 Dec 2019 21:38:59 +0000 (13:38 -0800)]
[msan] Intercept qsort, qsort_r.
Summary:
This fixes qsort-related false positives with glibc-2.27.
I'm not entirely sure why they did not show up with the earlier
versions; the code seems similar enough.
Reviewers: vitalybuka
Subscribers: #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D71740
Philip Reames [Fri, 20 Dec 2019 20:17:30 +0000 (12:17 -0800)]
More style cleanups following rG14fc20ca6282 [NFC]
Demote member functions to static functions where possible
Use early continue/early return to reduce nesting
Clarify comments slightly.
Reuse previously define expression in one case.
Sid Manning [Mon, 2 Dec 2019 20:10:03 +0000 (14:10 -0600)]
Avoid unsupported LLD options
Differential Revision: https://reviews.llvm.org/D70919
Philip Reames [Fri, 20 Dec 2019 20:01:06 +0000 (12:01 -0800)]
Fix a memory leak introduced w/the instruction padding support in rG14fc20ca6282
Should have caught this in review, but only noticed when addressing post commit style items. We were creating a new instance of the X86MCInstrInfo class, and then never reclaiming the memory. This wasn't even conditional on the new off by default flags, so it was an unconditional leak.
Philip Reames [Fri, 20 Dec 2019 19:48:30 +0000 (11:48 -0800)]
Comment and adjust style in the newly introduced MCBoundaryAlignFragment infrastructure. More to follow.
Gabor Horvath [Thu, 5 Dec 2019 00:12:50 +0000 (16:12 -0800)]
[attributes][analyzer] Add annotations for handles.
These annotations will be used in an upcomming static analyzer check
that finds handle leaks, use after releases, and double releases.
Differential Revision: https://reviews.llvm.org/D70469
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.