platform/upstream/llvm.git
4 years ago[NFC][Test][PowerPC] Add more tests for 'and mask'
QingShan Zhang [Mon, 23 Dec 2019 06:59:14 +0000 (06:59 +0000)]
[NFC][Test][PowerPC] Add more tests for 'and mask'

4 years ago[Concepts] Constrained partial specializations and function overloads.
Saar Raz [Mon, 23 Dec 2019 06:37:35 +0000 (08:37 +0200)]
[Concepts] Constrained partial specializations and function overloads.

Added support for constraint satisfaction checking and partial ordering of constraints in constrained partial specialization and function template overloads.
Re-commit after fixing another crash (added regression test).

Differential Revision: https://reviews.llvm.org/D41910

4 years ago[lldb/ScriptInterpreter] Remove can_reload which is always true (NFC)
Jonas Devlieghere [Mon, 23 Dec 2019 05:35:05 +0000 (21:35 -0800)]
[lldb/ScriptInterpreter] Remove can_reload which is always true (NFC)

The `-r` option for `command script import` is there for legacy
compatibility, however the can_reload flag is always set to true. This
patch removes the flag and any code that relies on it being false.

4 years agobuild: use `find_package(Python3)` rather than `PYTHON_HOME`
Saleem Abdulrasool [Mon, 23 Dec 2019 04:45:46 +0000 (20:45 -0800)]
build: use `find_package(Python3)` rather than `PYTHON_HOME`

The behaviour of `PYTHON_HOME` can be emulated by setting
`Python3_EXECUTABLE` to the absolute path instead of the custom variable
now that we can find the python interpreter.

4 years ago[AVR] Fix codegen for rotate instructions
Jim Lin [Mon, 23 Dec 2019 03:24:20 +0000 (11:24 +0800)]
[AVR] Fix codegen for rotate instructions

Summary:
    This patch introduces the ROLBRd and RORBRd pseudo-instructions,
    which implemenent the "traditional" rotate operations; instead of
    the AVR rotate instructions that use the carry bit.

    The code is not optimized at all. Especially when dealing with
    loops of rotate instructions, this codegen should be improved some
    day.

Related bug: 41358 <https://bugs.llvm.org/show_bug.cgi?id=41358>

//Note//: This is my first submitted patch.

Reviewers: dylanmckay, Jim

Reviewed By: dylanmckay

Subscribers: hiraditya, llvm-commits, dylanmckay, dsprenkels

Tags: #llvm

Patched by dsprenkels (Daan Sprenkels)

Differential Revision: https://reviews.llvm.org/D60365

4 years ago[PowerPC] Exploit `vrl(b|h|w|d)` to perform vector rotation
Kai Luo [Mon, 23 Dec 2019 02:06:40 +0000 (02:06 +0000)]
[PowerPC] Exploit `vrl(b|h|w|d)` to perform vector rotation

Summary:
Currently, we set legalization action of `ISD::ROTL` vectors as
`Expand` in `PPCISelLowering`. However, we can exploit `vrl(b|h|w|d)`
to lower `ISD::ROTL` directly.

Differential Revision: https://reviews.llvm.org/D71324

4 years ago[AST] Add missing MultiplexConsumer::CompleteExternalDeclaration
Reid Kleckner [Mon, 23 Dec 2019 03:00:48 +0000 (19:00 -0800)]
[AST] Add missing MultiplexConsumer::CompleteExternalDeclaration

4 years agoreland "[DebugInfo] Support to emit debugInfo for extern variables"
Yonghong Song [Fri, 22 Nov 2019 16:45:37 +0000 (08:45 -0800)]
reland "[DebugInfo] Support to emit debugInfo for extern variables"

Commit d77ae1552fc21a9f3877f3ed7e13d631f517c825
("[DebugInfo] Support to emit debugInfo for extern variables")
added deebugInfo for extern variables for BPF target.
The commit is reverted by 891e25b02d760d0de18c7d46947913b3166047e7
as the committed tests using %clang instead of %clang_cc1 causing
test failed in certain scenarios as reported by Reid Kleckner.

This patch fixed the tests by using %clang_cc1.

Differential Revision: https://reviews.llvm.org/D71818

4 years ago[NFC] Remove unnecessary blank and rename align-branch-64-5b.s to align-branch-64...
Shengchen Kan [Mon, 23 Dec 2019 02:22:02 +0000 (10:22 +0800)]
[NFC] Remove unnecessary blank and rename align-branch-64-5b.s to align-branch-64-6a.s

4 years ago[SCEV] add testcase for get accurate range for addrecexpr with nuw flag
czhengsz [Mon, 23 Dec 2019 01:58:19 +0000 (20:58 -0500)]
[SCEV] add testcase for get accurate range for addrecexpr with nuw flag

4 years ago[ELF] Delete a redundant R_HINT check from isStaticLinkTimeConstant(). NFC
Fangrui Song [Mon, 23 Dec 2019 00:55:38 +0000 (16:55 -0800)]
[ELF] Delete a redundant R_HINT check from isStaticLinkTimeConstant(). NFC

scanReloc() returns when it sees an R_HINT.

4 years ago[lldb/ScriptInterpreter] Unify error message for command script import
Jonas Devlieghere [Mon, 23 Dec 2019 00:46:01 +0000 (16:46 -0800)]
[lldb/ScriptInterpreter] Unify error message for command script import

Rather than checking for Python explicitly, let the script interpreter
handle things and print an error if the functionality is not supported.

4 years ago[DAGCombiner] Check term use before applying aggressive FSUB optimisations
Carl Ritson [Fri, 20 Dec 2019 03:51:50 +0000 (12:51 +0900)]
[DAGCombiner] Check term use before applying aggressive FSUB optimisations

Summary:
Without this check unnecessary FMA instructions are generated when the FSUB terms are reused.
This also has the side-effect that the same value is computed to different levels of precision, which can create undesirable effects if the results are used together in subsequent computation.

Reviewers: arsenm, nhaehnle, foad, tpr, dstuttard, spatel

Reviewed By: arsenm

Subscribers: jvesely, wdng, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D71656

4 years agobuild: improve python checks for Windows
Saleem Abdulrasool [Sun, 22 Dec 2019 21:57:46 +0000 (13:57 -0800)]
build: improve python checks for Windows

Require a newer CMake on Windows to use the Python3 support that is
packaged in CMake. This version is able to check both 32-bit and 64-bit
versions and will setup everything properly without the user needing to
specify PYTHON_HOME. This enables building lldb's python bindings on
Windows under Azure's CI again.

4 years agoRevert "[DebugInfo] Support to emit debugInfo for extern variables"
Reid Kleckner [Sun, 22 Dec 2019 20:54:06 +0000 (12:54 -0800)]
Revert "[DebugInfo] Support to emit debugInfo for extern variables"

This reverts commit d77ae1552fc21a9f3877f3ed7e13d631f517c825.

The tests committed along with this change do not pass, and should be
changed to use %clang_cc1.

4 years agoRevert "[Concepts] Constrained partial specializations and function overloads."
Reid Kleckner [Sun, 22 Dec 2019 19:37:54 +0000 (11:37 -0800)]
Revert "[Concepts] Constrained partial specializations and function overloads."

This reverts commit d3f5769d5e93b30d4a8b4696381d5e4a304992fa.

Causes crashes on Chromium. Have reproducer, will reduce and send along.

4 years ago[SelectionDAG] Copy FP flags when visiting a binary instruction.
Valentin Churavy [Sun, 22 Dec 2019 19:25:50 +0000 (14:25 -0500)]
[SelectionDAG] Copy FP flags when visiting a binary instruction.

Summary:
We noticed in Julia that the sequence below no longer turned into
a sequence of FMA instructions in LLVM 7+, but it did in LLVM 6.

```
    %29 = fmul contract <4 x double> %wide.load, %wide.load16
    %30 = fmul contract <4 x double> %wide.load13, %wide.load17
    %31 = fmul contract <4 x double> %wide.load14, %wide.load18
    %32 = fmul contract <4 x double> %wide.load15, %wide.load19
    %33 = fadd fast <4 x double> %vec.phi, %29
    %34 = fadd fast <4 x double> %vec.phi10, %30
    %35 = fadd fast <4 x double> %vec.phi11, %31
    %36 = fadd fast <4 x double> %vec.phi12, %32
```

Unlike Clang, Julia doesn't set the `unsafe-fp-math=true` function
attribute, but rather emits more local instruction flags.

This partially undoes https://reviews.llvm.org/D46854 and if required I can try to minimize the test further.

Reviewers: spatel, mcberg2017

Reviewed By: spatel

Subscribers: chriselrod, merge_guards_bot, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D71495

4 years agoRevert "[ARM][TypePromotion] Enable by default"
Reid Kleckner [Sun, 22 Dec 2019 19:17:23 +0000 (11:17 -0800)]
Revert "[ARM][TypePromotion] Enable by default"

This reverts commit ee7579409b7d940c4e1314d126e900db30c4edff.

It causes crashes during ThinLTO. I suspect the issue is related to
races on the global TypeSize variable, which is 80 at the time of the
crash.

4 years ago[X86] Autogenerate complete checks. NFC
Craig Topper [Sun, 22 Dec 2019 18:56:15 +0000 (10:56 -0800)]
[X86] Autogenerate complete checks. NFC

4 years ago[X86] Fix typo of intrinsic name in test cases. NFC
Craig Topper [Sun, 22 Dec 2019 18:51:55 +0000 (10:51 -0800)]
[X86] Fix typo of intrinsic name in test cases. NFC

These said test_f32_olt_s for the type of an overloaded intrinsic.
But the parser doesn't use that part of the name and just uses
the types of the arguments.

4 years ago[AMDGPU] Fixes -Wrange-loop-analysis warnings
Mark de Wever [Sun, 22 Dec 2019 18:39:28 +0000 (19:39 +0100)]
[AMDGPU] Fixes -Wrange-loop-analysis warnings

This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall.

Differential Revision: https://reviews.llvm.org/D71815

4 years ago[Hexagon] Fixes -Wrange-loop-analysis warnings
Mark de Wever [Sun, 22 Dec 2019 18:35:02 +0000 (19:35 +0100)]
[Hexagon] Fixes -Wrange-loop-analysis warnings

This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall.

Differential Revision: https://reviews.llvm.org/D71814

4 years ago[NVPTX] Fixes -Wrange-loop-analysis warnings
Mark de Wever [Sun, 22 Dec 2019 18:27:44 +0000 (19:27 +0100)]
[NVPTX] Fixes -Wrange-loop-analysis warnings

This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall.

Also removed the top-level const as requested by Aaron Ballman in similar
patches.

Differential Revision: https://reviews.llvm.org/D71812

4 years ago[PowerPC] Fixes -Wrange-loop-analysis warnings
Mark de Wever [Sun, 22 Dec 2019 18:23:57 +0000 (19:23 +0100)]
[PowerPC] Fixes -Wrange-loop-analysis warnings

This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall.

Differential Revision: https://reviews.llvm.org/D71811

4 years ago[Transforms] Fixes -Wrange-loop-analysis warnings
Mark de Wever [Sun, 22 Dec 2019 18:20:17 +0000 (19:20 +0100)]
[Transforms] Fixes -Wrange-loop-analysis warnings

This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall.

Differential Revision: https://reviews.llvm.org/D71810

4 years ago[Analyzer] Fixes -Wrange-loop-analysis warnings
Mark de Wever [Sun, 22 Dec 2019 18:13:34 +0000 (19:13 +0100)]
[Analyzer] Fixes -Wrange-loop-analysis warnings

This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall.

Differential Revision: https://reviews.llvm.org/D71809

4 years ago[Tools] Fixes -Wrange-loop-analysis warnings
Mark de Wever [Sun, 22 Dec 2019 18:11:17 +0000 (19:11 +0100)]
[Tools] Fixes -Wrange-loop-analysis warnings

This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall.

Differential Revision: https://reviews.llvm.org/D71808

4 years ago[TableGen] Fixes -Wrange-loop-analysis warnings
Mark de Wever [Sun, 22 Dec 2019 17:58:32 +0000 (18:58 +0100)]
[TableGen] Fixes -Wrange-loop-analysis warnings

This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall.

Differential Revision: https://reviews.llvm.org/D71807

4 years ago[Test] Add examples of problematic assembler auto-padding
Philip Reames [Sun, 22 Dec 2019 16:59:35 +0000 (08:59 -0800)]
[Test] Add examples of problematic assembler auto-padding

This is in the context of the automatic padding work for the jcc erratum mitigation.  These are example cases we need to *not* pad for correctness.  Exact mechanism to suppress is still TBD, but saving the tests which have come up.

4 years ago[InstCombine] enhance fold for copysign with known sign arg
Sanjay Patel [Sun, 22 Dec 2019 15:05:28 +0000 (10:05 -0500)]
[InstCombine] enhance fold for copysign with known sign arg

This is another optimization suggested in PRPR44153:
https://bugs.llvm.org/show_bug.cgi?id=44153

4 years ago[ms] [X86] Use "P" modifier on operands to call instructions in inline X86 assembly.
Eric Astor [Sun, 22 Dec 2019 05:09:37 +0000 (00:09 -0500)]
[ms] [X86] Use "P" modifier on operands to call instructions in inline X86 assembly.

Summary:
This is documented as the appropriate template modifier for call operands.
Fixes PR44272, and adds a regression test.

Also adds support for operand modifiers in Intel-style inline assembly.

Reviewers: rnk

Reviewed By: rnk

Subscribers: merge_guards_bot, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D71677

4 years ago[AArch64] match splat of bitcasted extract subvector to DUPLANE
Sanjay Patel [Sat, 21 Dec 2019 15:33:58 +0000 (10:33 -0500)]
[AArch64] match splat of bitcasted extract subvector to DUPLANE

This is another potential regression exposed by D63815.

Here we peek through a bitcast to find an extract subvector and
scale the splat offset based on that:
splat (bitcast (extract X, C)), LaneC --> duplane (bitcast X), LaneC'

Differential Revision: https://reviews.llvm.org/D71672

4 years ago[lldb] Remove unused CompilerDeclContext::IsStructUnionOrClass
Raphael Isemann [Sun, 22 Dec 2019 13:00:26 +0000 (14:00 +0100)]
[lldb] Remove unused CompilerDeclContext::IsStructUnionOrClass

4 years ago[Sema] SequenceChecker: C++17 sequencing rules for built-in operators <<, >>, .*...
Bruno Ricci [Sun, 22 Dec 2019 12:41:14 +0000 (12:41 +0000)]
[Sema] SequenceChecker: C++17 sequencing rules for built-in operators <<, >>, .*, ->*, =, op=

Implement the C++17 sequencing rules for the built-in operators <<, >>, .*,
 ->*, = and op=.

Differential Revision: https://reviews.llvm.org/D58297

Reviewed By: rsmith

4 years ago[Sema] SequenceChecker: Fix handling of operator ||, && and ?:
Bruno Ricci [Sun, 22 Dec 2019 12:27:31 +0000 (12:27 +0000)]
[Sema] SequenceChecker: Fix handling of operator ||, && and ?:

The current handling of the operators ||, && and ?: has a number of false
positive and false negative. The issues for operator || and && are:

1. We need to add sequencing regions for the LHS and RHS as is done for the
   comma operator. Not doing so causes false positives in expressions like
   `((a++, false) || (a++, false))` (from PR39779, see PR22197 for another
    example).

2. In the current implementation when the evaluation of the LHS fails, the RHS
   is added to a worklist to be processed later. This results in false negatives
   in expressions like `(a && a++) + a`.

Fix these issues by introducing sequencing regions for the LHS and RHS, and by
not deferring the visitation of the RHS.

The issues with the ternary operator ?: are similar, with the added twist that
we should not warn on expressions like `(x ? y += 1 : y += 2)` since exactly
one of the 2nd and 3rd expression is going to be evaluated, but we should still
warn on expressions like `(x ? y += 1 : y += 2) = y`.

Differential Revision: https://reviews.llvm.org/D57747

Reviewed By: rsmith

4 years ago[Sema] SequenceChecker: Add some comments + related small NFCs
Bruno Ricci [Sun, 22 Dec 2019 12:07:26 +0000 (12:07 +0000)]
[Sema] SequenceChecker: Add some comments + related small NFCs

NFCs factored out of the following patches:
- Change all of the `Expr *` to `const Expr *` in SequenceChecker for
  const-correctness. SequenceChecker should not modify AST nodes.
- Add some comments.
- clang-format

Differential Revision: https://reviews.llvm.org/D57659

Reviewed By: xbolva00

4 years ago[Concepts] Constrained partial specializations and function overloads.
Saar Raz [Sun, 22 Dec 2019 07:35:53 +0000 (09:35 +0200)]
[Concepts] Constrained partial specializations and function overloads.

Added support for constraint satisfaction checking and partial ordering of constraints in constrained partial specialization and function template overloads.
Re-commit after fixing some crashes and warnings.

Differential Revision: https://reviews.llvm.org/D41910

4 years ago[LLDB] Fix building without SWIG
Martin Storsjö [Sun, 22 Dec 2019 08:01:09 +0000 (10:01 +0200)]
[LLDB] Fix building without SWIG

Previously, SWIG was only a hard dependency if python bindings were
enabled.

Since bf03e17c570171c7a52117fe63ace89d58f328d5, scripts/CMakeLists.txt
is included unconditionally, while that file adds the hard dependency
on SWIG.

Instead, only include that file if either python or lua bindings are
enabled.

4 years ago[Driver] Allow -mnop-mcount for SystemZ and -mfentry for X86 and SystemZ
Fangrui Song [Sun, 22 Dec 2019 07:18:24 +0000 (23:18 -0800)]
[Driver] Allow -mnop-mcount for SystemZ and -mfentry for X86 and SystemZ

gcc/config/{i386,s390} support -mnop-mcount. We currently only support
-mnop-mcount for SystemZ. The function attribute "mnop-mcount" is
ignored on other targets.

gcc/config/{i386,s390} support -mfentry. We currently only support
-mfentry for X86 and SystemZ. TargetOpcode::FENTRY_CALL is not handled
on other targets.

  % clang -target aarch64 -pg -mfentry a.c -c
  fatal error: error in backend: Not supported instr: <MCInst 21>

-mfentry, -mrecord-mcount, and -mnop-mcount were invented for Linux
ftrace. Linux uses $(call cc-option-yn,-mrecord-mcount) to detect if the
specific feature is available. Reject unsupported features so that Linux
build system will not wrongly consider them available and cause
build/runtime failures.

Note, GCC has stricter checks that we do not implement, e.g. -fpic/-fpie
-fnop-mcount is not allowed on x86, -fpic/-fpie -mfentry is not allowed
on x86-32.

4 years agoDebugInfo: Remove out of date comment
David Blaikie [Sun, 22 Dec 2019 07:04:45 +0000 (23:04 -0800)]
DebugInfo: Remove out of date comment

4 years ago[Driver] Verify -mrecord-mcount in Driver, instead of CodeGen after D71627
Fangrui Song [Sun, 22 Dec 2019 06:22:59 +0000 (22:22 -0800)]
[Driver] Verify -mrecord-mcount in Driver, instead of CodeGen after D71627

GCC's x86 and s390 ports support -mrecord-mcount. Other ports reject the
option.

  aarch64-linux-gnu-gcc: error: unrecognized command line option ‘-mrecord-mcount’

Allowing this option can cause failures when building Linux kernel for
aarch64, powerpc64, etc, which will think the feature is available if
the clang command returns 0.

4 years ago[lldb/ScriptInterpreter] Fix stale/bogus error messages
Jonas Devlieghere [Sun, 22 Dec 2019 06:33:01 +0000 (22:33 -0800)]
[lldb/ScriptInterpreter] Fix stale/bogus error messages

Fix the nonsensical error messages for when breakpoint and watchpoint
callbacks are not supported.

4 years ago[lldb/Commands] Honor the scripting language passed (2/2)
Jonas Devlieghere [Sun, 22 Dec 2019 06:20:03 +0000 (22:20 -0800)]
[lldb/Commands] Honor the scripting language passed (2/2)

This ensures that watchpoint 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.

4 years ago[lldb/Lua] Add missing boiler plate to ScriptInterpreter.
Jonas Devlieghere [Sun, 22 Dec 2019 05:54:44 +0000 (21:54 -0800)]
[lldb/Lua] Add missing boiler plate to ScriptInterpreter.

 - Fix enum entry order.
 - Fix missing enum case in CommandObjectBreakpointCommand.
 - Add Lua entry to swtich in LanguageToString and simplify the code.

4 years ago[gn build] Port 7376d9eb389
LLVM GN Syncbot [Sun, 22 Dec 2019 02:15:02 +0000 (02:15 +0000)]
[gn build] Port 7376d9eb389

4 years ago[gn build] fixup after c3d13d9c56
Nico Weber [Sun, 22 Dec 2019 02:14:26 +0000 (21:14 -0500)]
[gn build] fixup after c3d13d9c56

4 years ago[lldb/Commands] Use the default scripting langauge for BP functions
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.

4 years ago[gn build] fold Basic:version into Basic
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.

4 years ago[NFC] Separate getLastArgIntValue to Basic
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

4 years ago[lldb/Commands] Honor the scripting language passed
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.

4 years ago[lldb/Commands] Fix bogus enum entry and add Lua (NFC)
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.

4 years ago[lldb/Core] Support asking the debugger for a specific script interpreter
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)

4 years ago[Lldb/Lua] Persist Lua state across script interpreter calls.
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.

4 years ago[lldb] Fix windows build after getASTContext() change
Raphael Isemann [Sat, 21 Dec 2019 22:27:27 +0000 (23:27 +0100)]
[lldb] Fix windows build after getASTContext() change

4 years ago[lldb][NFC] Return a reference from ClangASTContext::getASTContext and remove dead...
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.

4 years ago[Lldb/Lua] Generate Lua Bindings
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

4 years ago[analyzer] exploded-graph-rewriter: Fix string encodings in python3.
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

4 years ago[NFC] test commit reverted
Stepan Dyatkovskiy [Sat, 21 Dec 2019 18:12:07 +0000 (22:12 +0400)]
[NFC] test commit reverted

4 years ago[NFC] test commit
Stepan Dyatkovskiy [Sat, 21 Dec 2019 18:11:34 +0000 (22:11 +0400)]
[NFC] test commit

4 years ago[lld][RISCV] Use an e_flags of 0 if there are only binary input files.
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

4 years agoFix "result of 32-bit shift implicitly converted to 64 bits" warning. NFC.
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.

4 years agoFix Wpedantic 'extra semicolon' warning. NFC.
Simon Pilgrim [Sat, 21 Dec 2019 17:32:00 +0000 (17:32 +0000)]
Fix Wpedantic 'extra semicolon' warning. NFC.

4 years agoFix `-Wunused-variable` warning. NFC.
Michael Liao [Sat, 21 Dec 2019 16:09:30 +0000 (11:09 -0500)]
Fix `-Wunused-variable` warning. NFC.

4 years ago[InstCombine] check alloc size in bitcast of geps fold (PR44321)
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

4 years ago[SimplifyLibCalls] require fast-math-flags for pow(X, -0.5) transforms
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

4 years ago[lldb][NFC] Remove all ASTContext getter wrappers from ClangASTContext
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.

4 years ago[AArch64] Respect reserved registers while renaming in LdSt opt.
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

4 years ago[Analyzer] Use a reference in a range-based for
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

4 years ago[Wdocumentation] Implement \anchor
Mark de Wever [Sat, 21 Dec 2019 13:47:52 +0000 (14:47 +0100)]
[Wdocumentation] Implement \anchor

Differential revision: https://reviews.llvm.org/D69223

4 years ago[lldb] disable thread-step-out-ret-addr-check on windows
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.

4 years ago[lldb] One more attempt to fix thread-step-out-ret-addr-check on windows
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

4 years agoAdd missing `REQUIRES: hexagon-registered-target`
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.

4 years ago[lldb] Force the preprocessor to run in thread-step-out-ret-addr-check.test
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.

4 years agoCustomize simplified dumping and matching of LambdaExpr
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

4 years ago[lldb] Fix -Wstringop-truncation in PythonReadline.cpp
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.

4 years ago[lldb] [testsuite] Fix Linux fail: Unwind/thread-step-out-ret-addr-check.test
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

4 years ago[lldb] Fix ARM32 inferior calls
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

4 years agoAMDGPU: Fix repeated word in comment
Matt Arsenault [Fri, 20 Dec 2019 15:35:51 +0000 (21:05 +0530)]
AMDGPU: Fix repeated word in comment

4 years agoMips: Make test resistant to future changes
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.

4 years agoAMDGPU/GlobalISel: Fix misuse of div_scale intrinsics
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.

4 years agoAMDGPU/GlobalISel: Fix missing scc imp-def on scalar and/or/xor
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

4 years agoAMDGPU/GlobalISel: Simplify code
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.

4 years agofeatures.html: Remove some old info
Sylvestre Ledru [Sat, 21 Dec 2019 09:49:15 +0000 (10:49 +0100)]
features.html: Remove some old info

4 years agoclang is now under the apache2 license
Sylvestre Ledru [Sat, 21 Dec 2019 09:48:16 +0000 (10:48 +0100)]
clang is now under the apache2 license

4 years agoRemove a gcc 4.9 comparison as it doesn't make sense
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

4 years ago[libc++] Fix typo in std::midpoint
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

4 years agoRevert "[msan] Check qsort input." and "[msan] Intercept qsort, qsort_r."
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.

4 years ago[lldb/test] Update !DIModule for isysroot rename
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.

4 years ago[ORC] De-register eh-frames in the RTDyldObjectLinkingLayer destructor.
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.

4 years ago[lldb/test] Skip editline tests when LLDB_ENABLE_LIBEDIT is off.
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.

4 years ago[lldb] Expose more optional dependencies through GetBuildConfiguration()
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().

4 years ago[lldb/CMake] Don't use return() from macro()
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.

4 years agoRe-land "[lldb/CMake] Change how we deal with optional dependencies"
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.

4 years agohopefully last doc typo fix to cycle bots
Nico Weber [Sat, 21 Dec 2019 03:28:21 +0000 (22:28 -0500)]
hopefully last doc typo fix to cycle bots

4 years agofix yet another doc typo to cycle bots
Nico Weber [Sat, 21 Dec 2019 03:25:14 +0000 (22:25 -0500)]
fix yet another doc typo to cycle bots

4 years agofix 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

4 years agofix a 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

4 years agoConstrain the macho-stabs test added in f72d001e099 to run on systems configured...
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

4 years agoAdd a set of tests with basic coverage of the recently added boundary align feature.
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

4 years agogn build: Silence mismatched-new-delete warning in scudo C++ wrapper tests.
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