Nico Weber [Sun, 22 Dec 2019 02:14:26 +0000 (21:14 -0500)]
[gn build] fixup after
c3d13d9c56
Jonas Devlieghere [Sun, 22 Dec 2019 02:11:40 +0000 (18:11 -0800)]
[lldb/Commands] Use the default scripting langauge for BP functions
When a function is used as a breakpoint command, use to the debugger's
default scripting language, unless a language is explicitly specified.
Nico Weber [Sun, 22 Dec 2019 02:10:00 +0000 (21:10 -0500)]
[gn build] fold Basic:version into Basic
This now defines HAVE_VCS_VERSION_INC for all files in Basic,
but now the BUILD.gn file has only a single "sources" field again,
and the automerger requires that. Having the automerger work for
clang/lib/Basic is a very nice to have, and the downside seems tiny.
Yaxun (Sam) Liu [Fri, 6 Dec 2019 17:29:31 +0000 (12:29 -0500)]
[NFC] Separate getLastArgIntValue to Basic
getLastArgIntValue is a useful utility function to get command line argument as an integer.
Currently it is in Frontend so that it can only be used by clang -cc1. Move it to basic so
that it can also be used by clang driver.
Differential Revision: https://reviews.llvm.org/D71080
Jonas Devlieghere [Sun, 22 Dec 2019 01:28:36 +0000 (17:28 -0800)]
[lldb/Commands] Honor the scripting language passed
This ensures that breakpoint command honors the scripting language
passed with `-s`. Currently the argument ignores the actual language and
only uses it to differentiate between lldb and script commands.
Jonas Devlieghere [Sun, 22 Dec 2019 01:21:30 +0000 (17:21 -0800)]
[lldb/Commands] Fix bogus enum entry and add Lua (NFC)
Fixes a bogus enum value for the scripting language options, adds an
entry for Lua and refactored the code to use an exhaustive switch.
Jonas Devlieghere [Sun, 22 Dec 2019 01:11:12 +0000 (17:11 -0800)]
[lldb/Core] Support asking the debugger for a specific script interpreter
Rather than holding on to one script interpreter, it should be possible
to request a script interpreter for a specific scripting language. The
GetScriptInterpreter method now takes an optional scripting language
argument.
(NFC)
Jonas Devlieghere [Sat, 21 Dec 2019 22:58:50 +0000 (14:58 -0800)]
[Lldb/Lua] Persist Lua state across script interpreter calls.
Don't create a new lua state on every operation. Share a single state
across the lifetime of the script interpreter. Add simple locking to
prevent two threads from modifying the state concurrently.
Raphael Isemann [Sat, 21 Dec 2019 22:27:27 +0000 (23:27 +0100)]
[lldb] Fix windows build after getASTContext() change
Raphael Isemann [Sat, 21 Dec 2019 21:40:52 +0000 (22:40 +0100)]
[lldb][NFC] Return a reference from ClangASTContext::getASTContext and remove dead nullptr checks
ClangASTContext::getASTContext() currently returns a ptr but we have an assert there since a
while that the ASTContext is not a nullptr. This causes that we still have a lot of code
that is doing nullptr checks on the result of getASTContext() which is all unreachable code.
This patch changes the return value to a reference to make it clear this can't be a nullptr
and deletes all the nullptr checks.
Jonas Devlieghere [Sun, 8 Dec 2019 23:32:57 +0000 (15:32 -0800)]
[Lldb/Lua] Generate Lua Bindings
This patch uses SWIG to generate the Lua bindings for the SB API. It
covers most of the API, but some methods require a type map similar to
Python.
Discussion on the mailing list:
http://lists.llvm.org/pipermail/lldb-dev/2019-December/015812.html
Differential revision: https://reviews.llvm.org/D71235
Artem Dergachev [Sat, 21 Dec 2019 18:57:03 +0000 (10:57 -0800)]
[analyzer] exploded-graph-rewriter: Fix string encodings in python3.
Makes sure that the script works fine both in python2 and python3.
Patch by Pavel Samolysov!
Differential Revision: https://reviews.llvm.org/D71746
Stepan Dyatkovskiy [Sat, 21 Dec 2019 18:12:07 +0000 (22:12 +0400)]
[NFC] test commit reverted
Stepan Dyatkovskiy [Sat, 21 Dec 2019 18:11:34 +0000 (22:11 +0400)]
[NFC] test commit
John Baldwin [Sat, 21 Dec 2019 17:59:37 +0000 (17:59 +0000)]
[lld][RISCV] Use an e_flags of 0 if there are only binary input files.
Summary:
If none of the input files are ELF object files (for example, when
generating an object file from a single binary input file via
"-b binary"), use a fallback value for the ELF header flags instead
of crashing with an assertion failure.
Reviewers: MaskRay, ruiu, espindola
Reviewed By: MaskRay, ruiu
Subscribers: kevans, grimar, emaste, arichardson, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, llvm-commits, jrtc27
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71101
Simon Pilgrim [Sat, 21 Dec 2019 17:45:30 +0000 (17:45 +0000)]
Fix "result of 32-bit shift implicitly converted to 64 bits" warning. NFC.
Simon Pilgrim [Sat, 21 Dec 2019 17:32:00 +0000 (17:32 +0000)]
Fix Wpedantic 'extra semicolon' warning. NFC.
Michael Liao [Sat, 21 Dec 2019 16:09:30 +0000 (11:09 -0500)]
Fix `-Wunused-variable` warning. NFC.
Sanjay Patel [Sat, 21 Dec 2019 15:31:21 +0000 (10:31 -0500)]
[InstCombine] check alloc size in bitcast of geps fold (PR44321)
We missed a constraint in D44833
when folding a bitcast into a GEP with vector/array types.
If the alloc sizes specified by the datalayout don't match,
this could miscompile as shown in:
https://bugs.llvm.org/show_bug.cgi?id=44321
Differential Revision: https://reviews.llvm.org/D71771
Sanjay Patel [Fri, 20 Dec 2019 22:24:53 +0000 (17:24 -0500)]
[SimplifyLibCalls] require fast-math-flags for pow(X, -0.5) transforms
As discussed in PR44330:
https://bugs.llvm.org/show_bug.cgi?id=44330
...the transform from pow(X, -0.5) libcall/intrinsic to
reciprocal square root can result in small deviations from
the expected result due to differences in the pow()
implementation and/or the extra rounding step from the division.
This patch proposes to allow that difference with either the
'approximate functions' or 'reassociate' FMF:
http://llvm.org/docs/LangRef.html#fast-math-flags
In practice, this likely means that the code is compiled with
all of 'fast' (-ffast-math), but I have preserved the existing
specializations for -0.0/-INF that enable generating safe code
if those special values are allowed simultaneously with
allowing approximation/reassociation.
The question about whether a similar restriction is needed for
the non-reciprocal case -- pow(X, 0.5) -- is deferred. That
transform is allowed without FMF currently, and this patch does
not change that behavior.
Differential Revision: https://reviews.llvm.org/D71706
Raphael Isemann [Sat, 21 Dec 2019 14:26:24 +0000 (15:26 +0100)]
[lldb][NFC] Remove all ASTContext getter wrappers from ClangASTContext
Their naming is misleading as they only return the
ClangASTContext-owned variables. For ClangASTContext instances constructed
for a given clang::ASTContext they silently generated duplicated instances
(e.g., a second IdentifierTable) that were essentially unusable.
This removes all these getters as they are anyway not very useful in comparison
to just calling the clang::ASTContext getters. The initialization
code has been moved to the CreateASTContext initialization method so that all
code for making our own clang::ASTContext is in one place.
Florian Hahn [Sat, 21 Dec 2019 13:47:08 +0000 (14:47 +0100)]
[AArch64] Respect reserved registers while renaming in LdSt opt.
We cannot pick reserved registers as rename registers.
Fixes https://bugs.llvm.org/show_bug.cgi?id=44358
Mark de Wever [Sat, 21 Dec 2019 10:20:49 +0000 (11:20 +0100)]
[Analyzer] Use a reference in a range-based for
This avoids unneeded copies when using a range-based for loops.
This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall.
Differential Revision: https://reviews.llvm.org/D70869
Mark de Wever [Sat, 21 Dec 2019 13:47:52 +0000 (14:47 +0100)]
[Wdocumentation] Implement \anchor
Differential revision: https://reviews.llvm.org/D69223
Pavel Labath [Sat, 21 Dec 2019 13:19:49 +0000 (14:19 +0100)]
[lldb] disable thread-step-out-ret-addr-check on windows
I'm unable to get this test working there.
Pavel Labath [Sat, 21 Dec 2019 12:33:09 +0000 (13:33 +0100)]
[lldb] One more attempt to fix thread-step-out-ret-addr-check on windows
David Zarzycki [Sat, 21 Dec 2019 11:34:36 +0000 (06:34 -0500)]
Add missing `REQUIRES: hexagon-registered-target`
After
d567b0ba841d4b6f4b0d906da350a3bb2b2f769f, the test suite no longer
passes if hexagon is disabled.
Pavel Labath [Sat, 21 Dec 2019 11:25:02 +0000 (12:25 +0100)]
[lldb] Force the preprocessor to run in thread-step-out-ret-addr-check.test
It does not seem to run automatically on windows.
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
Pavel Labath [Sat, 21 Dec 2019 10:33:42 +0000 (11:33 +0100)]
[lldb] Fix -Wstringop-truncation in PythonReadline.cpp
The size is known and the truncation is deliberate -- use memcpy instead
of strncpy.
Jan Kratochvil [Sat, 21 Dec 2019 10:27:54 +0000 (11:27 +0100)]
[lldb] [testsuite] Fix Linux fail: Unwind/thread-step-out-ret-addr-check.test
D71372 introduced: `Unwind/thread-step-out-ret-addr-check.test` failing on
Fedora 30 Linux x86_64.
[lldb] Add additional validation on return address in 'thread step-out'
https://reviews.llvm.org/D71372
One problem is the underscored `_nonstandard_stub` in the `.s` file but not in
the LLDB command:
(lldb) breakpoint set -n nonstandard_stub
Breakpoint 1: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.
(lldb) process launch
Process 21919 exited with status = 0 (0x00000000)
Process 21919 launched: '/home/jkratoch/redhat/llvm-monorepo-clangassert/tools/lldb/test/Unwind/Output/thread-step-out-ret-addr-check.test.tmp' (x86_64)
(lldb) thread step-out
error: invalid thread
(lldb) _
Another problem is that Fedora Linux has executable stack by default and all
programs indicate non-executable stack by `PT_GNU_STACK`, after fixing the
underscore I was getting:
(lldb) thread step-out
Process 22294 exited with status = 0 (0x00000000)
(lldb) _
A different approach was tried as:
[lldb] Refactor thread-step-out-ret-addr-check test to use .data instead of stack variable
https://reviews.llvm.org/D71789
Differential revision: https://reviews.llvm.org/D71784
Jan Kratochvil [Sat, 21 Dec 2019 10:12:17 +0000 (11:12 +0100)]
[lldb] Fix ARM32 inferior calls
echo -e '#include <unistd.h>\nint main(void){\nsync();return 0;}'|./bin/clang -g -x c -;./bin/lldb -o 'file ./a.out' -o 'b main' -o r -o 'p (void)sync()'
Actual:
error: Expression can't be run, because there is no JIT compiled function
Expected:
<nothing, sync() has been executed>
This patch has been checked by:
D71707: clang-tidy: new bugprone-pointer-cast-widening
https://reviews.llvm.org/D71707
Casting from 32-bit `void *` to `uint64_t` requires an intermediate `uintptr_t` cast otherwise the pointer gets sign-extended:
echo -e '#include <stdio.h>\n#include <stdint.h>\nint main(void){void *p=(void *)0x80000000;unsigned long long ull=(unsigned long long)p;unsigned long long ull2=(unsigned long
long)(uintptr_t)p;printf("p=%p ull=0x%llx ull2=0x%llx\\n",p,ull,ull2);return 0;}'|gcc -Wall -m32 -x c -;./a.out
<stdin>: In function ‘main’:
<stdin>:3:66: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
p=0x80000000 ull=0xffffffff80000000 ull2=0x80000000
With debug output:
Actual:
IRMemoryMap::WriteMemory (0xb6ff8640, 0xffffffffb6f82158, 0x112) went to [0xb6ff8640..0xb6ff86b3)
Code can be run in the target.
Found function, has local address 0xffffffffb6f84000 and remote address 0xffffffffffffffff
Couldn't disassemble function : Couldn't find code range for function _Z12$__lldb_exprPv
Sections:
[0xb6f84000+0x3c]->0xb6ff9020 (alignment 4, section ID 0, name .text)
...
HandleCommand, command did not succeed
error: Expression can't be run, because there is no JIT compiled function
Expected:
IRMemoryMap::WriteMemory (0xb6ff8640, 0xb6faa15c, 0x128) went to [0xb6ff8640..0xb6ff86c3)
IRExecutionUnit::GetRemoteAddressForLocal() found 0xb6fac000 in [0xb6fac000..0xb6fac040], and returned 0xb6ff9020 from [0xb6ff9020..0xb6ff9060].
Code can be run in the target.
Found function, has local address 0xb6fac000 and remote address 0xb6ff9020
Function's code range is [0xb6ff9020+0x40]
...
Function data has contents:
0xb6ff9020: 10 4c 2d e9 08 b0 8d e2 08 d0 4d e2 00 40 a0 e1
...
Function disassembly:
0xb6ff9020: 0xe92d4c10 push {r4, r10, r11, lr}
Differential revision: https://reviews.llvm.org/D71498
Matt Arsenault [Fri, 20 Dec 2019 15:35:51 +0000 (21:05 +0530)]
AMDGPU: Fix repeated word in comment
Matt Arsenault [Thu, 12 Dec 2019 09:03:10 +0000 (14:33 +0530)]
Mips: Make test resistant to future changes
This seems to have been relying on extra spills being inserted in
these blocks to increase the code size to trigger branch
relaxation. This broke when these spills were avoided. Add some asm to
pad the size of the blocks to make it not matter.
Matt Arsenault [Fri, 20 Dec 2019 16:09:19 +0000 (21:39 +0530)]
AMDGPU/GlobalISel: Fix misuse of div_scale intrinsics
Confusingly, the intrinsic operands do not match the
instruction/custom node. The order is shuffled, and the 3rd operand is
an immediate to select operands.
I'm not 100% sure I did this right, but fdiv still doesn't select end
to end and it will be easier to tell when it does. This at least
avoids an assertion in RegBankSelect and allows hitting the fallback
on selection.
Matt Arsenault [Fri, 20 Dec 2019 11:08:36 +0000 (16:38 +0530)]
AMDGPU/GlobalISel: Fix missing scc imp-def on scalar and/or/xor
Matt Arsenault [Fri, 20 Dec 2019 13:25:41 +0000 (18:55 +0530)]
AMDGPU/GlobalISel: Simplify code
This can directly access the register bank, and doesn't need to get it
through the ID.
Sylvestre Ledru [Sat, 21 Dec 2019 09:49:15 +0000 (10:49 +0100)]
features.html: Remove some old info
Sylvestre Ledru [Sat, 21 Dec 2019 09:48:16 +0000 (10:48 +0100)]
clang is now under the apache2 license
Sylvestre Ledru [Sat, 21 Dec 2019 09:46:45 +0000 (10:46 +0100)]
Remove a gcc 4.9 comparison as it doesn't make sense
Ruslan Baratov [Sat, 21 Dec 2019 09:22:12 +0000 (01:22 -0800)]
[libc++] Fix typo in std::midpoint
Reviewed By: mclow.lists
Differential Revision: https://reviews.llvm.org/D71525
Jonas Devlieghere [Sat, 21 Dec 2019 05:30:35 +0000 (21:30 -0800)]
Revert "[msan] Check qsort input." and "[msan] Intercept qsort, qsort_r."
Temporarily revert the qsort changes because they fail to build on bots
that build with modules:
> error: thread-local storage is not supported for the current
> target (iossim)
http://green.lab.llvm.org/green/job/clang-stage2-Rthinlto/1820/console
http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/4983/console
This reverts commit
ddf897fc80499ece298bc33201db6b697d2af50e.
This reverts commit
07861e955d0095f25639d84c5726c73b528567cb.
Jonas Devlieghere [Sat, 21 Dec 2019 05:10:20 +0000 (21:10 -0800)]
[lldb/test] Update !DIModule for isysroot rename
The isysroot field in DIModule was renamed to sysroot but the test in
LLDB wasn't updated. This fixes that.
Lang Hames [Sat, 21 Dec 2019 05:08:35 +0000 (21:08 -0800)]
[ORC] De-register eh-frames in the RTDyldObjectLinkingLayer destructor.
This matches the behavior of the legacy layer, which automatically deregistered
frames.
Jonas Devlieghere [Sat, 21 Dec 2019 05:01:23 +0000 (21:01 -0800)]
[lldb/test] Skip editline tests when LLDB_ENABLE_LIBEDIT is off.
Add a new decorator that checks if LLDB was build with editline support
and mark the relevant tests as skipped when that's not the case.
Jonas Devlieghere [Sat, 21 Dec 2019 05:01:08 +0000 (21:01 -0800)]
[lldb] Expose more optional dependencies through GetBuildConfiguration()
Expose all the externally-observable optional dependencies through
SBDebugger::GetBuildConfiguration().
Jonas Devlieghere [Sat, 21 Dec 2019 04:53:33 +0000 (20:53 -0800)]
[lldb/CMake] Don't use return() from macro()
> A macro is executed as if the macro body were pasted in place of the
> calling statement. This has the consequence that a return() in a macro
> body does not just terminate execution of the macro
After converting from a function() to a macro(), the return() became
invalid. This modifies the control flow to elude the return.
Jonas Devlieghere [Fri, 20 Dec 2019 23:38:46 +0000 (15:38 -0800)]
Re-land "[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.
Nico Weber [Sat, 21 Dec 2019 03:28:21 +0000 (22:28 -0500)]
hopefully last doc typo fix to cycle bots
Nico Weber [Sat, 21 Dec 2019 03:25:14 +0000 (22:25 -0500)]
fix yet another doc typo to cycle bots
Nico Weber [Sat, 21 Dec 2019 02:59:51 +0000 (21:59 -0500)]
fix another doc typo to cycle bots
Nico Weber [Sat, 21 Dec 2019 02:39:01 +0000 (21:39 -0500)]
fix a doc typo to cycle bots
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