platform/upstream/llvm.git
4 years ago[X86][SSE] Add shufps+shufps test for fold through commutation
Simon Pilgrim [Fri, 24 Jan 2020 11:16:16 +0000 (11:16 +0000)]
[X86][SSE] Add shufps+shufps test for fold through commutation

As mentioned on D73023, lowerShuffleWithSHUFPS should be able to commute the shufps inputs to fold the second arg as it will then permute the shufps result anyway.

4 years ago[lldb/DWARF] Remove a workaround from DebugNamesDWARFIndex
Pavel Labath [Fri, 24 Jan 2020 11:07:00 +0000 (12:07 +0100)]
[lldb/DWARF] Remove a workaround from DebugNamesDWARFIndex

This was needed when asking a compile unit for its dwo component
triggered a infinite recursion if the dwo unit has not been already
parsed.

This has since been fixed.

4 years ago[lldb] Fix nondeterminism in TestCppBitfields
Pavel Labath [Fri, 24 Jan 2020 11:02:43 +0000 (12:02 +0100)]
[lldb] Fix nondeterminism in TestCppBitfields

The test was printing a char[3] variable without a terminating nul. The
memory after that variable (an unnamed bitfield) was not initialized. If
the memory happened to be nonzero, the summary provider for the variable
would run off into the next field.

This is probably not the right behavior (it should stop at the end of
the array), but this is not the purpose of this test. I have filed
pr44649 for this bug, and fixed the test to not depend on this behavior.

4 years ago[NFC][ARM] Add test
Sam Parker [Fri, 24 Jan 2020 10:59:13 +0000 (10:59 +0000)]
[NFC][ARM] Add test

4 years ago[AArch64][SVE] Add intrinsics for FFR manipulation
Kerry McLaughlin [Fri, 24 Jan 2020 09:42:18 +0000 (09:42 +0000)]
[AArch64][SVE] Add intrinsics for FFR manipulation

Summary:
Implements the following intrinsics:
  - llvm.aarch64.sve.setffr
  - llvm.aarch64.sve.rdffr
  - llvm.aarch64.sve.rdffr.z
  - llvm.aarch64.sve.wrffr

Reviewers: sdesmalen, efriedma, dancgr, rengolin

Reviewed By: efriedma

Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, cameron.mcinally, cfe-commits, llvm-commits

Tags: #llvm

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

4 years ago[lldb][NFC] Fix formatting in ASTImporterDelegate::ImportImpl
Raphael Isemann [Fri, 24 Jan 2020 10:57:06 +0000 (11:57 +0100)]
[lldb][NFC] Fix formatting in ASTImporterDelegate::ImportImpl

4 years ago[lldb][NFC] Delete unused ClangASTImporter::CompleteDecl
Raphael Isemann [Fri, 24 Jan 2020 10:50:29 +0000 (11:50 +0100)]
[lldb][NFC] Delete unused ClangASTImporter::CompleteDecl

4 years ago[SelectionDAG] rot(x, y) --> x iff ComputeNumSignBits(x) == BitWidth(x)
Simon Pilgrim [Fri, 24 Jan 2020 10:35:19 +0000 (10:35 +0000)]
[SelectionDAG] rot(x, y) --> x iff ComputeNumSignBits(x) == BitWidth(x)

Rotating an 0/-1 value by any amount will always result in the same 0/-1 value

4 years ago[llvm-libc] Add memory function benchmarks
Guillaume Chatelet [Mon, 6 Jan 2020 12:17:04 +0000 (13:17 +0100)]
[llvm-libc] Add memory function benchmarks

Summary:
This patch adds a benchmarking infrastructure for llvm-libc memory functions.

In a nutshell, the code can benchmark small and large buffers for the memcpy, memset and memcmp functions.
It also produces graphs of size vs latency by running targets of the form `render-libc-{memcpy|memset|memcmp}-benchmark-{small|big}`.

The configurations are provided as JSON files and the benchmark also produces a JSON file.
This file is then parsed and rendered as a PNG file via the `render.py` script (make sure to run `pip3 install matplotlib scipy numpy`).
The script can take several JSON files as input and will superimpose the curves if they are from the same host.

TODO:
 - The code benchmarks whatever is available on the host but should be configured to benchmark the -to be added- llvm-libc memory functions.
 - Add a README file with instructions and rationale.
 - Produce scores to track the performance of the functions over time to allow for regression detection.

Reviewers: sivachandra, ckennelly

Subscribers: mgorny, MaskRay, libc-commits

Tags: #libc-project

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

4 years ago[mlir] Use all_of instead of a manual loop in IntrinsicGen. NFC
Alex Zinenko [Fri, 24 Jan 2020 10:27:17 +0000 (11:27 +0100)]
[mlir] Use all_of instead of a manual loop in IntrinsicGen. NFC

This was suggested in post-commit review of D72926.

4 years ago[doc][llvm-objcopy] Remove redundant COFF-specific sub-heading
James Henderson [Fri, 24 Jan 2020 09:49:55 +0000 (09:49 +0000)]
[doc][llvm-objcopy] Remove redundant COFF-specific sub-heading

The sub-heading used to contain the --only-keep-debug switch as that
switch wasn't implemented for ELF at one point. Since the switch is now
in the generic options section, and there are no other options in this
sub-heading, it is pointless and can be deleted.

4 years ago[NFC][ARM] Make some params members instead.
Sam Parker [Fri, 24 Jan 2020 10:17:43 +0000 (10:17 +0000)]
[NFC][ARM] Make some params members instead.

Add MachineLoopInfo and ReachingDefAnalysis as members of
LowOverheadLoop instead of passing them several times to different
methods.

4 years ago[clangd] Errors in TestTU cause test failures unless suppressed with error-ok.
Sam McCall [Wed, 22 Jan 2020 15:38:41 +0000 (16:38 +0100)]
[clangd] Errors in TestTU cause test failures unless suppressed with error-ok.

Summary:
The historic behavior of TestTU is to gather diagnostics and otherwise ignore
them. So if a test has a syntax error, and doesn't assert diagnostics, it
silently misbehaves.
This can be annoying when developing tests, as evidenced by various tests
gaining "assert no diagnostics" where that's not really the point of the test.

This patch aims to make that default behavior. For the first error
(not warning), TestTU will call ADD_FAILURE().

This can be suppressed with a comment containing "error-ok". For now that will
suppress any errors in the TU. We can make this stricter later -verify style.
(-verify itself is hard to reuse because of DiagnosticConsumer interfaces...)
A magic-comment was chosen over a TestTU option because of table-driven tests.

In addition to the behavior change, this patch:
  - adds //error-ok where we're knowingly testing invalid code
    (e.g. for diagnostics, crash-resilience, or token-level tests)
  - fixes a bunch of errors in the checked-in tests, mostly trivial (missing ;)
  - removes a bunch of now-redundant instances of "assert no diagnostics"

Reviewers: kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[X86] Add test showing failure to remove vector rotate of allsignbits
Simon Pilgrim [Fri, 24 Jan 2020 10:12:34 +0000 (10:12 +0000)]
[X86] Add test showing failure to remove vector rotate of allsignbits

Rotating an 0/-1 value by any amount will always result in the same 0/-1 value

4 years ago[clang][NFC] Remove redundant cast
Raphael Isemann [Fri, 24 Jan 2020 09:42:26 +0000 (10:42 +0100)]
[clang][NFC] Remove redundant cast

This cast just casts Decl* to Decl*.

4 years ago[Format] Fix 'auto x(T&&, T &&)->F' with PAS_Left.
Sam McCall [Fri, 24 Jan 2020 09:12:25 +0000 (10:12 +0100)]
[Format] Fix 'auto x(T&&, T &&)->F' with PAS_Left.

Summary:
An heuristic targetting `x && x->foo` was targed overly broadly and caused the
last T&& to be treated as a binary operator.

Reviewers: hokein

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[DWARF][test] Test all the call-site realted attrs
Djordje Todorovic [Thu, 23 Jan 2020 13:20:19 +0000 (14:20 +0100)]
[DWARF][test] Test all the call-site realted attrs

Adding the test for the call site encoding in DWARF5 vs GNU extensions.
Some of the attributes were not covered by any test.

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

4 years agoRecommit "[DWARF5][clang]: Added support for DebugInfo generation for auto return...
Awanish Pandey [Thu, 23 Jan 2020 10:36:52 +0000 (16:06 +0530)]
Recommit "[DWARF5][clang]: Added support for DebugInfo generation for auto return type for C++ member functions."

Summary:
This was reverted in e45fcfc3aa57bb237fd4fd694d0c257be66d5482 due to
libcxx build failure. This revision addresses that case.

Original commit message:
    This patch will provide support for auto return type for the C++ member
    functions.

    This patch includes clang side implementation of this feature.

    Patch by: Awanish Pandey <Awanish.Pandey@amd.com>

    Reviewers: dblaikie, aprantl, shafik, alok, SouraVX, jini.susan.george
    Reviewed by: dblaikie

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

4 years ago[WholeProgramDevirt][test] Fix test after D73094
Fangrui Song [Fri, 24 Jan 2020 08:46:18 +0000 (00:46 -0800)]
[WholeProgramDevirt][test] Fix test after D73094

4 years ago[WPD] Allow load/save bitcoded index when running opt -wholeprogramdevirt
Evgeny Leviant [Fri, 24 Jan 2020 08:31:39 +0000 (00:31 -0800)]
[WPD] Allow load/save bitcoded index when running opt -wholeprogramdevirt

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

4 years ago[lldb] Fix file header of Host/posix/FileSystemPosix.cpp
Fangrui Song [Fri, 24 Jan 2020 08:29:43 +0000 (00:29 -0800)]
[lldb] Fix file header of Host/posix/FileSystemPosix.cpp

4 years ago[PowerPC] Delete IsDarwin from AsmPrinter functions
Fangrui Song [Fri, 24 Jan 2020 08:14:40 +0000 (00:14 -0800)]
[PowerPC] Delete IsDarwin from AsmPrinter functions

4 years ago[lldb][NFC] Fix all formatting errors in .cpp file headers
Raphael Isemann [Fri, 24 Jan 2020 07:23:27 +0000 (08:23 +0100)]
[lldb][NFC] Fix all formatting errors in .cpp file headers

Summary:
A *.cpp file header in LLDB (and in LLDB) should like this:
```
//===-- TestUtilities.cpp -------------------------------------------------===//
```
However in LLDB most of our source files have arbitrary changes to this format and
these changes are spreading through LLDB as folks usually just use the existing
source files as templates for their new files (most notably the unnecessary
editor language indicator `-*- C++ -*-` is spreading and in every review
someone is pointing out that this is wrong, resulting in people pointing out that this
is done in the same way in other files).

This patch removes most of these inconsistencies including the editor language indicators,
all the different missing/additional '-' characters, files that center the file name, missing
trailing `===//` (mostly caused by clang-format breaking the line).

Reviewers: aprantl, espindola, jfb, shafik, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: dexonsmith, wuzish, emaste, sdardis, nemanjai, kbarton, MaskRay, atanasyan, arphaman, jfb, abidh, jsji, JDevlieghere, usaxena95, lldb-commits

Tags: #lldb

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

4 years ago[llvm][TextAPI/MachO] Extend TBD_V3 unittest to verify writing
Jonas Devlieghere [Fri, 24 Jan 2020 07:18:10 +0000 (23:18 -0800)]
[llvm][TextAPI/MachO] Extend TBD_V3 unittest to verify writing

The existing unit tests cover a wide variety of reading TBD files but
lack coverages on the writing side. Case in point is the macCatalyst
case which we're able to read, but not write.

This patch extends the unit test dealing with valid input to write their
content again to verify the writer.

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

4 years ago[llvm][TextAPI/MachO] Update variable names in unit tests. (NFC)
Jonas Devlieghere [Fri, 24 Jan 2020 06:48:29 +0000 (22:48 -0800)]
[llvm][TextAPI/MachO] Update variable names in unit tests. (NFC)

This changes the variables names to match the TBD version.

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

4 years ago[objc_direct] do not add direct properties to the serialization array
Pierre Habouzit [Wed, 22 Jan 2020 20:08:19 +0000 (12:08 -0800)]
[objc_direct] do not add direct properties to the serialization array

If we do, then the property_list_t length is wrong
and class_getProperty gets very sad.

Signed-off-by: Pierre Habouzit <phabouzit@apple.com>
Radar-Id: rdar://problem/58804805
Differential Revision: https://reviews.llvm.org/D73219

4 years ago[objc_direct] Allow for direct messages be sent to `self` when it is a Class
Pierre Habouzit [Wed, 15 Jan 2020 03:51:08 +0000 (19:51 -0800)]
[objc_direct] Allow for direct messages be sent to `self` when it is a Class

Sending a message to `self` when it is const and within a class method
is safe because we know that `self` is the Class itself.

We can only relax this warning in ARC.

Signed-off-by: Pierre Habouzit <phabouzit@apple.com>
Radar-Id: rdar://problem/58581965
Differential Revision: https://reviews.llvm.org/D72747

4 years ago[PowerPC][MC] Delete PPCMCExpr::IsDarwin
Fangrui Song [Fri, 24 Jan 2020 06:15:28 +0000 (22:15 -0800)]
[PowerPC][MC] Delete PPCMCExpr::IsDarwin

4 years ago[Frontend] Delete some unneeded CC1 options
Fangrui Song [Fri, 24 Jan 2020 05:29:09 +0000 (21:29 -0800)]
[Frontend] Delete some unneeded CC1 options

4 years ago[lldb/Util] Remove reproducers after replay
Jonas Devlieghere [Fri, 24 Jan 2020 05:46:47 +0000 (21:46 -0800)]
[lldb/Util] Remove reproducers after replay

Except for debugging purposes there's no point in leaving the reproducer
behind on disk after replay. This patch adds a cleanup in the replay
case.

4 years ago[lldb/Util] Fix Python 3 incompatibility in lldb-repro
Jonas Devlieghere [Fri, 24 Jan 2020 05:41:46 +0000 (21:41 -0800)]
[lldb/Util] Fix Python 3 incompatibility in lldb-repro

This fixes: TypeError: Unicode-objects must be encoded before hashing

4 years ago[X86] Add -flax-vector-conversions=none to all of the x86 vector intrinsic header...
Craig Topper [Thu, 23 Jan 2020 02:13:16 +0000 (20:13 -0600)]
[X86] Add -flax-vector-conversions=none to all of the x86 vector intrinsic header tests.

4 years ago[examples][ORC] Add an example of how to use a custom ObjectLinkingLayer plugin.
Lang Hames [Fri, 24 Jan 2020 03:15:27 +0000 (19:15 -0800)]
[examples][ORC] Add an example of how to use a custom ObjectLinkingLayer plugin.

ObjectLinkingLayer::Plugin instances can be used to receive events from
ObjectLinkingLayer, and to inspect/modify JITLink linker graphs. This example
shows how to write and set up a plugin to dump the linker graph at various
points in the linking process.

4 years ago[examples][ORC] Fix program names in calls to parse cl opt in examples.
Lang Hames [Fri, 24 Jan 2020 02:22:50 +0000 (18:22 -0800)]
[examples][ORC] Fix program names in calls to parse cl opt in examples.

These examples were all copied and adapted from the original HowToUseLLJIT
example code, however the calls to cl::ParseCommandLineOptions were not
updated.

4 years ago[examples][ORC] Remove an unused parameter from IR in an LLJIT example.
Lang Hames [Fri, 24 Jan 2020 02:09:29 +0000 (18:09 -0800)]
[examples][ORC] Remove an unused parameter from IR in an LLJIT example.

4 years agoFix assert that doesn't check anything.
Weverything [Fri, 24 Jan 2020 00:03:31 +0000 (16:03 -0800)]
Fix assert that doesn't check anything.

Move the assert that checks for the end iterator inside the loop which
actually moves over the elements.  This allows it to check that the
iteration stays within the range.

4 years ago[WinEH] Ignore lifetime.end PHI nodes in empty cleanuppads
Andy Kaylor [Fri, 24 Jan 2020 00:37:24 +0000 (16:37 -0800)]
[WinEH] Ignore lifetime.end PHI nodes in empty cleanuppads

This fixes a bug where a PHI node that is only referenced by a lifetime.end intrinsic in an otherwise empty cleanuppad can cause SimplyCFG to create an SSA violation while removing the empty cleanuppad. Theoretically the same problem can occur with debug intrinsics.

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

4 years ago[WebAssembly] Fix resume-only case in Emscripten EH
Heejin Ahn [Fri, 24 Jan 2020 00:39:32 +0000 (16:39 -0800)]
[WebAssembly] Fix resume-only case in Emscripten EH

Summary:
D72308 incorrectly assumed `resume` cannot exist without a `landingpad`,
which is not true. This sets `Changed` to true whenever we make changes
to a function, including creating a call to `__resumeException` within a
function without a landing pad.

Reviewers: tlively

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

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

4 years ago[RISCV] Scheduler description for the Rocket core
Kai Wang [Thu, 23 Jan 2020 20:51:04 +0000 (14:51 -0600)]
[RISCV] Scheduler description for the Rocket core

Pipeline scheduler model for the RISC-V Rocket micro-architecture using the
MIScheduler interface.  Support for both 32 and 64-bit Rocket cores is
implemented.

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

4 years agoRevert "[LTO/WPD] Enable aggressive WPD under LTO option"
Teresa Johnson [Fri, 24 Jan 2020 01:26:51 +0000 (17:26 -0800)]
Revert "[LTO/WPD] Enable aggressive WPD under LTO option"

This reverts commit 59733525d37cf9ad88b5021b33ecdbaf2e18911c.

There is a windows sanitizer bot failure in one of the cfi tests
that I will need some time to figure out:
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/57155/steps/stage%201%20check/logs/stdio

4 years ago[Driver][CodeGen] Support -fpatchable-function-entry=N,M and __attribute__((patchable...
Fangrui Song [Mon, 20 Jan 2020 22:30:06 +0000 (14:30 -0800)]
[Driver][CodeGen] Support -fpatchable-function-entry=N,M and __attribute__((patchable_function_entry(N,M))) where M>0

Reviewed By: nickdesaulniers

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

4 years ago[X86][test] Add tests for -fpatchable-function-entry=N,M (where M>0) and its interact...
Fangrui Song [Mon, 20 Jan 2020 22:57:59 +0000 (14:57 -0800)]
[X86][test] Add tests for -fpatchable-function-entry=N,M (where M>0) and its interaction with -fcf-protection=branch

Reviewed By: nickdesaulniers

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

4 years agoAdd function attribute "patchable-function-prefix" to support -fpatchable-function...
Fangrui Song [Mon, 20 Jan 2020 22:57:11 +0000 (14:57 -0800)]
Add function attribute "patchable-function-prefix" to support -fpatchable-function-entry=N,M where M>0

Similar to the function attribute `prefix` (prefix data),
"patchable-function-prefix" inserts data (M NOPs) before the function
entry label.

-fpatchable-function-entry=2,1 (1 NOP before entry, 1 NOP after entry)
will look like:

```
  .type foo,@function
.Ltmp0:               # @foo
  nop
foo:
.Lfunc_begin0:
  # optional `bti c` (AArch64 Branch Target Identification) or
  # `endbr64` (Intel Indirect Branch Tracking)
  nop

  .section  __patchable_function_entries,"awo",@progbits,get,unique,0
  .p2align  3
  .quad .Ltmp0
```

-fpatchable-function-entry=N,0 + -mbranch-protection=bti/-fcf-protection=branch has two reasonable
placements (https://gcc.gnu.org/ml/gcc-patches/2020-01/msg01185.html):

```
(a)         (b)

func:       func:
.Ltmp0:     bti c
  bti c     .Ltmp0:
  nop       nop
```

(a) needs no additional code. If the consensus is to go for (b), we will
need more code in AArch64BranchTargets.cpp / X86IndirectBranchTracking.cpp .

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

4 years ago[Concepts] Update cxx_status.html with Concepts support status
Saar Raz [Fri, 24 Jan 2020 00:59:14 +0000 (02:59 +0200)]
[Concepts] Update cxx_status.html with Concepts support status

Concepts will be available with Clang 10 - update cxx_status.html to reflect
the papers that have been implemented.

4 years ago[clang][clang-scan-deps] Aggregate the full dependency information.
Michael Spencer [Mon, 28 Oct 2019 21:26:45 +0000 (14:26 -0700)]
[clang][clang-scan-deps] Aggregate the full dependency information.

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

This is a recommit of f978ea498309 with a fix for the PowerPC failure.

The issue was that:
* `CompilerInstance::ExecuteAction` calls
  `getTarget().adjust(getLangOpts());`.
* `PPCTargetInfo::adjust` changes `LangOptions::HasAltivec`.
* This happens after the first few calls to `getModuleHash`.

There’s even a FIXME saying:
```
  // FIXME: We shouldn't need to do this, the target should be immutable once
  // created. This complexity should be lifted elsewhere.
```

This only showed up on PowerPC because it's one of the few targets that
almost always changes a hashed langopt.

I looked into addressing the fixme, but that would be a much larger
change, and it's not the only thing that happens in `ExecuteAction` that
can change the module context hash. Instead I changed the code to not
call `getModuleHash` until after it has been modified in `ExecuteAction`.

4 years agoAMDGPU: Implement FDIV optimizations in AMDGPUCodeGenPrepare
Changpeng Fang [Fri, 24 Jan 2020 00:57:43 +0000 (16:57 -0800)]
AMDGPU: Implement FDIV optimizations in AMDGPUCodeGenPrepare

    Summary:
      RCP has the accuracy limit. If FDIV fpmath require high accuracy rcp may not
    meet the requirement. However, in DAG lowering, fpmath information gets lost,
    and thus we may generate either inaccurate rcp related computation or slow code
    for fdiv.

    In patch implements fdiv optimizations in the AMDGPUCodeGenPrepare, which could
    exactly know !fpmath.

     FastUnsafeRcpLegal: We determine whether it is legal to use rcp based on
                         unsafe-fp-math, fast math flags, denormals and fpmath
                         accuracy request.

     RCP Optimizations:
       1/x -> rcp(x) when fast unsafe rcp is legal or fpmath >= 2.5ULP with
                                                      denormals flushed.
       a/b -> a*rcp(b) when fast unsafe rcp is legal.

     Use fdiv.fast:
       a/b -> fdiv.fast(a, b) when RCP optimization is not performed and
                              fpmath >= 2.5ULP with denormals flushed.

       1/x -> fdiv.fast(1,x)  when RCP optimization is not performed and
                              fpmath >= 2.5ULP with denormals.

    Reviewers:
      arsenm

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

4 years ago[Attributor] Avoid REQUIRED dependences in favor of OPTIONAL ones
Johannes Doerfert [Sun, 12 Jan 2020 06:11:56 +0000 (00:11 -0600)]
[Attributor] Avoid REQUIRED dependences in favor of OPTIONAL ones

When we use information only to short-cut deduction or improve it, we
can use OPTIONAL dependences instead of REQUIRED ones to avoid cascading
pessimistic fixpoints.

We also need to track dependences only when we use assumed information,
e.g., we act on assumed liveness information.

4 years ago[Attributor] Record dependences only when necessary
Johannes Doerfert [Sun, 12 Jan 2020 05:35:45 +0000 (23:35 -0600)]
[Attributor] Record dependences only when necessary

If we use assumed information from AAValueSimplify we need to record
an OPTIONAL dependence, otherwise we do not.

4 years ago[Attributor][FIX] Avoid dangling pointers during code deletion
Johannes Doerfert [Sun, 12 Jan 2020 05:30:36 +0000 (23:30 -0600)]
[Attributor][FIX] Avoid dangling pointers during code deletion

It can happen that we have instructions in the ToBeDeletedInsts set
which are deleted earlier already. To avoid dangling pointers we use
weak tracking handles.

4 years ago[Attributor][FIX] Handle non-pointers when following uses
Johannes Doerfert [Fri, 10 Jan 2020 18:32:24 +0000 (12:32 -0600)]
[Attributor][FIX] Handle non-pointers when following uses

When we follow uses, e.g., in AAMemoryBehavior or AANoCapture, we need
to make sure the value is a pointer before we ask for abstract
attributes only valid for pointers. This happens because we follow
pointers through calls that do not capture but may return the value.

4 years ago[Attributor][NFC] Do not (try to) simplify void values
Johannes Doerfert [Sun, 12 Jan 2020 05:59:36 +0000 (23:59 -0600)]
[Attributor][NFC] Do not (try to) simplify void values

We might accidentally ask AAValueSimplify to simplify a void value. That
can lead to very interesting, and very wrong, results. We now handle
this case gracefully.

4 years ago[lldb/Util] Use md5 instead of python's hash function.
Jonas Devlieghere [Fri, 24 Jan 2020 00:35:42 +0000 (16:35 -0800)]
[lldb/Util] Use md5 instead of python's hash function.

Because of the way the Python hash function works, it's not guaranteed
to be the same. This was causing a lot of reproducers to be generated
for the same tests, even though the CWD or arguments didn't change.
Switching to an MD5 hash should fix that.

4 years agoFix bot failure from 59733525d37cf9ad88b5021b33ecdbaf2e18911c
Teresa Johnson [Fri, 24 Jan 2020 00:33:35 +0000 (16:33 -0800)]
Fix bot failure from 59733525d37cf9ad88b5021b33ecdbaf2e18911c

Fix bot failure by loosening up the register matching on new test:
http://lab.llvm.org:8011/builders/clang-x86_64-debian-new-pass-manager-fast/builds/2423

4 years ago[clang-tidy] Add clang-tidy headers to clang distribution
Dmitry Polukhin [Thu, 23 Jan 2020 23:57:45 +0000 (15:57 -0800)]
[clang-tidy] Add clang-tidy headers to clang distribution

Summary:
Clang releases include static libraries for clang-tidy but corresponding
headers are missing in the tarball so these libraries are almost useless.
Clang-tidy libraries can be useful for build custom clang-tidy with
custom checks outside of llvm repo.

List of clang-tidy libraries included in clang 9.0.1 release:
    lib/libclangTidyMPIModule.a
    lib/libclangTidyPlugin.a
    lib/libclangTidyBoostModule.a
    lib/libclangTidyCERTModule.a
    lib/libclangTidyAndroidModule.a
    lib/libclangTidyPortabilityModule.a
    lib/libclangTidyPerformanceModule.a
    lib/libclangTidyOpenMPModule.a
    lib/libclangTidyBugproneModule.a
    lib/libclangTidyZirconModule.a
    lib/libclangTidyCppCoreGuidelinesModule.a
    lib/libclangTidyGoogleModule.a
    lib/libclangTidyUtils.a
    lib/libclangTidyHICPPModule.a
    lib/libclangTidyModernizeModule.a
    lib/libclangTidyLLVMModule.a
    lib/libclangTidyAbseilModule.a
    lib/libclangTidyReadabilityModule.a
    lib/libclangTidyFuchsiaModule.a
    lib/libclangTidyMiscModule.a
    lib/libclangTidy.a
    lib/libclangTidyObjCModule.a

Reviewers: smeenai, jdoerfert, alexfh, hokein, aaron.ballman

Subscribers: mgehre, mgorny, xazax.hun, cfe-commits

Tags: #clang-tools-extra, #clang

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

4 years ago[LoopStrengthReduce] Reuse utility method to clean dead instructions. [NFCI]
Alina Sbirlea [Thu, 23 Jan 2020 23:45:37 +0000 (15:45 -0800)]
[LoopStrengthReduce] Reuse utility method to clean dead instructions. [NFCI]

Create a utility wrapper for the RecursivelyDeleteTriviallyDeadInstructions utility
method, which sets to nullptr the instructions that are not trivially
dead. Use the new method in LoopStrengthReduce.
Alternative: add a bool to the same method; this option adds a marginal
amount of overhead to the other callers, and the method needs to be
updated to return a bool status when it removes/doesn't remove
instructions.

4 years ago[Concepts] Make constraint expressions unevaluated until satisfaction checking
Saar Raz [Fri, 24 Jan 2020 00:22:17 +0000 (02:22 +0200)]
[Concepts] Make constraint expressions unevaluated until satisfaction checking

As per P1980R0, constraint expressions are unevaluated operands, and their constituent atomic
constraints only become constant evaluated during satisfaction checking.

Change the evaluation context during parsing and instantiation of constraints to unevaluated.

4 years ago[Attributor][FIX][Alignment] Do not report a change if there was none
Johannes Doerfert [Sun, 12 Jan 2020 06:25:45 +0000 (00:25 -0600)]
[Attributor][FIX][Alignment] Do not report a change if there was none

If alignment was manifested but it is actually only as good as the
data-layout provided one we should not report it as a change.

For testing purposes we still manifest the information.

4 years ago[Attributor][NFC] Add an assertion
Johannes Doerfert [Sun, 12 Jan 2020 06:13:03 +0000 (00:13 -0600)]
[Attributor][NFC] Add an assertion

4 years ago[Attributor][NFC] Fix spelling
Johannes Doerfert [Sun, 12 Jan 2020 06:00:33 +0000 (00:00 -0600)]
[Attributor][NFC] Fix spelling

4 years ago[Attributor] `byval` arguments are always `noalias`
Johannes Doerfert [Sun, 12 Jan 2020 06:18:07 +0000 (00:18 -0600)]
[Attributor] `byval` arguments are always `noalias`

`byval` introduces a local copy of the argument. That copy cannot alias
anything.

4 years ago[Attributor][FIX] Store alignment only holds for the pointer value
Johannes Doerfert [Fri, 10 Jan 2020 18:13:10 +0000 (12:13 -0600)]
[Attributor][FIX] Store alignment only holds for the pointer value

We accidentally used the store alignment for the value operand as well,
which is incorrect and crashed the SPASS application in the test suite.

4 years ago[LTO/WPD] Enable aggressive WPD under LTO option
Teresa Johnson [Thu, 26 Dec 2019 19:40:18 +0000 (11:40 -0800)]
[LTO/WPD] Enable aggressive WPD under LTO option

Summary:
Third part in series to support Safe Whole Program Devirtualization
Enablement, see RFC here:
http://lists.llvm.org/pipermail/llvm-dev/2019-December/137543.html

This patch adds type test metadata under -fwhole-program-vtables,
even for classes without hidden visibility. It then changes WPD to skip
devirtualization for a virtual function call when any of the compatible
vtables has public vcall visibility.

Additionally, internal LLVM options as well as lld and gold-plugin
options are added which enable upgrading all public vcall visibility
to linkage unit (hidden) visibility during LTO. This enables the more
aggressive WPD to kick in based on LTO time knowledge of the visibility
guarantees.

Support was added to all flavors of LTO WPD (regular, hybrid and
index-only), and to both the new and old LTO APIs.

Unfortunately it was not simple to split the first and second parts of
this part of the change (the unconditional emission of type tests and
the upgrading of the vcall visiblity) as I needed a way to upgrade the
public visibility on legacy WPD llvm assembly tests that don't include
linkage unit vcall visibility specifiers, to avoid a lot of test churn.

I also added a mechanism to LowerTypeTests that allows dropping type
test assume sequences we now aggressively insert when we invoke
distributed ThinLTO backends with null indexes, which is used in testing
mode, and which doesn't invoke the normal ThinLTO backend pipeline.

Depends on D71907 and D71911.

Reviewers: pcc, evgeny777, steven_wu, espindola

Subscribers: emaste, Prazek, inglorion, arichardson, hiraditya, MaskRay, dexonsmith, dang, davidxl, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years ago[Utils] Use WeakTrackingVH in vector used as scratch storage.
Alina Sbirlea [Thu, 23 Jan 2020 22:21:08 +0000 (14:21 -0800)]
[Utils] Use WeakTrackingVH in vector used as scratch storage.

The utility method RecursivelyDeleteTriviallyDeadInstructions receives
as input a vector of Instructions, where all inputs are valid
instructions. This same vector is used as a scratch storage (per the
header comment) to recursively delete instructions. If an instruction is
added as an operand of multiple other instructions, it may be added twice,
then deleted once, then the second reference in the vector is invalid.
Switch to using a Vector<WeakTrackingVH>.
This change facilitates a clean-up in LoopStrengthReduction.

4 years ago[MS] Overhaul how clang passes overaligned args on x86_32
Reid Kleckner [Tue, 31 Dec 2019 00:15:54 +0000 (16:15 -0800)]
[MS] Overhaul how clang passes overaligned args on x86_32

MSVC 2013 would refuse to pass highly aligned things (typically vectors
and aggregates) by value. Users would receive this error:
  t.cpp(11) : error C2719: 'w': formal parameter with __declspec(align('32')) won't be aligned
  t.cpp(11) : error C2719: 'q': formal parameter with __declspec(align('32')) won't be aligned

However, in MSVC 2015, this behavior was changed, and highly aligned
things are now passed indirectly. To avoid breaking backwards
incompatibility, objects that do not have a *required* high alignment
(i.e. double) are still passed directly, even though they are not
naturally aligned. This change implements the new behavior of passing
things indirectly.

The new behavior is:
- up to three vector parameters can be passed in [XYZ]MM0-2
- remaining arguments with required alignment greater than 4 bytes are
  passed indirectly

Previously, MSVC never passed things truly indirectly, meaning clang
would always apply the byval attribute to indirect arguments. We had to
go to the trouble of adding inalloca so that non-trivially copyable C++
types could be passed in place without copying the object
representation. When inalloca was added, we asserted that all arguments
passed indirectly must use byval. With this change, that assert no
longer holds, and I had to update inalloca to handle that case. The
implicit sret pointer parameter was already handled this way, and this
change generalizes some of that logic to arguments.

There are two cases that this change leaves unfixed:
1. objects that are non-trivially copyable *and* overaligned
2. vectorcall + inalloca + vectors

For case 1, I need to touch C++ ABI code in MicrosoftCXXABI.cpp, so I
want to do it in a follow-up.

For case 2, my fix is one line, but it will require updating IR tests to
use lots of inreg, so I wanted to separate it out.

Related to D71915 and D72110

Fixes most of PR44395

Reviewed By: rjmccall, craig.topper, erichkeane

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

4 years ago[AArch64][GlobalISel] Remove duplicate attribute lookup code that was supposed to...
Amara Emerson [Thu, 23 Jan 2020 22:46:15 +0000 (14:46 -0800)]
[AArch64][GlobalISel] Remove duplicate attribute lookup code that was supposed to be cached. NFC.

When I cached this a long time ago it seems I forgot to remove the locally
declared variable of the same name in select(), so the caching wasn't having
any compile time benefit. Doh.

4 years ago[mlir] [VectorOps] fixed minor typos in vector ops doc
aartbik [Thu, 23 Jan 2020 21:40:58 +0000 (13:40 -0800)]
[mlir] [VectorOps] fixed minor typos in vector ops doc

Summary:
Rationale:
Some examples were using "offsets : [0, 2]" syntax which
should use a "=" instead. The same examples were referring
to the integer attribute array as k-dimensional, which is
a bit confusing (it is 1-dimensional, with k elements).
Changed to "k-sized".

Reviewers: nicolasvasilache, andydavis1, ftynse

Reviewed By: nicolasvasilache

Subscribers: merge_guards_bot, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, liufengdb, llvm-commits

Tags: #llvm

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

4 years ago[NFC][ScopBuilder] Move RecordedAssumptions vector to ScopBuilder
Dominik Adamski [Sun, 19 Jan 2020 22:50:01 +0000 (23:50 +0100)]
[NFC][ScopBuilder] Move RecordedAssumptions vector to ScopBuilder

Scope of changes:

1) Moved RecordedAssumptions vector to ScopBuilder. RecordedAssumptions are used only for Scop constructions.
2) Moved definition of RecordedAssumptionsTy to ScopHelper. It is required both by ScopBuilder and SCEVAffinator.
3) Add new function recordAssumption to ScopHelper. One of its argument is a reference to RecordedAssumption vector. This function is used by ScopBuilder and SCEVAffinator.
4) All RecordedAssumptions are created by ScopBuilder. isl::pw_aff
objects for corresponding SCEVs are created inside ScopBuilder. Scop
functions do not record any assumptions. Scop can use isl::pw_aff
objects which were created by ScopBuilder.
5) Removed functions for handling RecordedAssumptions from Scop class.
6) Removed constness from getScopArrayInfo functions.
7) Replaced SCEVVisitor struct from SCEVAffinator with taylored version, which allow to pass pointer to RecordedAssumptions as function argument.

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

4 years ago[tests] Use host-based XFAIL for test/MC/AMDGPU/hsa-gfx10-v3.s
Hubert Tong [Thu, 23 Jan 2020 22:55:32 +0000 (17:55 -0500)]
[tests] Use host-based XFAIL for test/MC/AMDGPU/hsa-gfx10-v3.s

Summary:
This patch applies D60551 to an additional file. In particular, the test
is currently marked XFAIL for a number of big-endian targets; however,
the failure is actually dependent on the host endianness instead. The
test actually specifies a specific target triple.

Reviewers: rampitec, xingxue, daltenty

Reviewed By: rampitec

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, fedor.sergeev, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[Concepts] Deprecate -fconcepts-ts, enable Concepts under -std=c++2a
Saar Raz [Thu, 23 Jan 2020 22:43:22 +0000 (00:43 +0200)]
[Concepts] Deprecate -fconcepts-ts, enable Concepts under -std=c++2a

Now with concepts support merged and mostly complete, we do not need -fconcepts-ts
(which was also misleading as we were not implementing the TS) and can enable
concepts features under C++2a. A warning will be generated if users still attempt
to use -fconcepts-ts.

4 years ago[LLDB] Fix the handling of unnamed bit-fields when parsing DWARF
shafik [Thu, 23 Jan 2020 22:42:12 +0000 (14:42 -0800)]
[LLDB] Fix the handling of unnamed bit-fields when parsing DWARF

We ran into an assert when debugging clang and performing an expression on a class derived from DeclContext. The assert was indicating we were getting the offsets wrong for RecordDeclBitfields. We were getting both the size and offset of unnamed bit-field members wrong. We could fix this case with a quick change but as I extended the test suite to include more combinations we kept finding more cases that were being handled incorrectly. A fix that handled all the new cases as well as the cases already covered required a refactor of the existing technique.

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

4 years ago[AArch64][GlobalISel] Fallback if the +strict-align target feature is given.
Amara Emerson [Thu, 23 Jan 2020 22:43:19 +0000 (14:43 -0800)]
[AArch64][GlobalISel] Fallback if the +strict-align target feature is given.

Works around PR44246.

4 years ago[lldb/Test] Disallow using substituted binaries in shell test.
Jonas Devlieghere [Thu, 23 Jan 2020 22:23:01 +0000 (14:23 -0800)]
[lldb/Test] Disallow using substituted binaries in shell test.

Explicitly disallow using lldb instead of %lldb in the shell tests. This
is a clever trick that is used by Swift to achieve the same results.

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

4 years ago[Clang][IFS][Test] Work around in-process cc1 ASAN issues #2.
Mitch Phillips [Thu, 23 Jan 2020 22:23:38 +0000 (14:23 -0800)]
[Clang][IFS][Test] Work around in-process cc1 ASAN issues #2.

Using the same strategy as c38e42527b21.

D69825 revealed (introduced?) a problem when building with ASan, and
some memory leaks somewhere. More details are available in the original
patch.

Looks like we missed one failing tests, this patch adds the workaround
to this test as well.

4 years ago[lldb/Test] Disable command-breakpoint-col.test on Windows
Jonas Devlieghere [Thu, 23 Jan 2020 22:17:48 +0000 (14:17 -0800)]
[lldb/Test] Disable command-breakpoint-col.test on Windows

I guess PDB doesn't have column information?

4 years ago[mlir] [VectorOps] Implement vector tuple get folding
aartbik [Thu, 23 Jan 2020 22:11:36 +0000 (14:11 -0800)]
[mlir] [VectorOps] Implement vector tuple get folding

Summary: Rewrites get-i tup<a1,...,an> into ai

Reviewers: nicolasvasilache, rriddle, andydavis1

Reviewed By: nicolasvasilache, rriddle, andydavis1

Subscribers: merge_guards_bot, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, liufengdb, llvm-commits

Tags: #llvm

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

4 years ago[IPSCCP] Use ParamState for arguments at call sites.
Florian Hahn [Thu, 23 Jan 2020 19:17:47 +0000 (11:17 -0800)]
[IPSCCP] Use ParamState for arguments at call sites.

We currently use integer ranges to merge concrete function arguments.
We use the ParamState range for those, but we only look up concrete
values in the regular state. For concrete function arguments that are
themselves arguments of the containing function, we can use the param
state directly and improve the precision in some cases.

Besides improving the results in some cases, this is also a small step towards
switching to ValueLatticeElement, by allowing D60582 to be a NFC.

Reviewers: efriedma, davide

Reviewed By: efriedma

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

4 years ago[Concepts] Implement P1616R1 - Using unconstrained template template parameters with...
Saar Raz [Wed, 22 Jan 2020 02:21:09 +0000 (04:21 +0200)]
[Concepts] Implement P1616R1 - Using unconstrained template template parameters with constrained templates

Summary: Allow unconstrained template template parameters to accept constrainted templates as arguments.

Reviewers: rsmith

Subscribers: cfe-commits

Tags: #clang

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

4 years agoGlobalISel: Add MIPatternMatch for G_ICMP/G_FCMP
Matt Arsenault [Thu, 23 Jan 2020 13:45:40 +0000 (08:45 -0500)]
GlobalISel: Add MIPatternMatch for G_ICMP/G_FCMP

4 years agoAMDGPU/GlobalISel: Fix RegBanKSelect for llvm.amdgcn.exp.compr
Matt Arsenault [Thu, 23 Jan 2020 20:52:21 +0000 (15:52 -0500)]
AMDGPU/GlobalISel: Fix RegBanKSelect for llvm.amdgcn.exp.compr

This wasn't updated for the immarg handling change. We really need a
verifier for this.

4 years ago[Concepts] Add ExpressionEvaluationContexts to instantiation of constraints
Saar Raz [Thu, 23 Jan 2020 21:24:56 +0000 (23:24 +0200)]
[Concepts] Add ExpressionEvaluationContexts to instantiation of constraints

Proper ExpressionEvaluationContext were not being entered when instantiating constraint
expressions, which caused assertion failures in certain cases, including bug #44614.

4 years ago[ThinLTO] Summarize vcall_visibility metadata
Teresa Johnson [Thu, 26 Dec 2019 17:31:43 +0000 (09:31 -0800)]
[ThinLTO] Summarize vcall_visibility metadata

Summary:
Second patch in series to support Safe Whole Program Devirtualization
Enablement, see RFC here:
http://lists.llvm.org/pipermail/llvm-dev/2019-December/137543.html

Summarize vcall_visibility metadata in ThinLTO global variable summary.

Depends on D71907.

Reviewers: pcc, evgeny777, steven_wu

Subscribers: mehdi_amini, Prazek, inglorion, hiraditya, dexonsmith, arphaman, ostannard, llvm-commits, cfe-commits, davidxl

Tags: #clang, #llvm

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

4 years ago[CUDA] Fix order of memcpy arguments in __shfl_*(<64-bit type>).
Artem Belevich [Wed, 22 Jan 2020 23:12:49 +0000 (15:12 -0800)]
[CUDA] Fix order of memcpy arguments in __shfl_*(<64-bit type>).

Wrong argument order resulted in broken shfl ops for 64-bit types.

4 years agoChange internal_start_thread arguments to match pthread_create.
Evgenii Stepanov [Thu, 23 Jan 2020 21:01:08 +0000 (13:01 -0800)]
Change internal_start_thread arguments to match pthread_create.

This avoids a CFI-unfriendly function pointer type cast in
internal_start_thread.

4 years ago[CMake] Refactor iOS simulator/device test configuration generation code for LibFuzzer.
Dan Liew [Thu, 23 Jan 2020 00:26:45 +0000 (16:26 -0800)]
[CMake] Refactor iOS simulator/device test configuration generation code for LibFuzzer.

Summary:
In order to do this `FUZZER_SUPPORTED_OS` had to be pulled out of
`lib/fuzzer/CMakeLists.txt` and into the main config so we can use it
from the `test/fuzzer/CMakeList.txt`. `FUZZER_SUPPORTED_OS` currently
has the same value of `SANITIZER_COMMON_SUPPORTED_OS` which preserves
the existing behaviour but this allows us in the future to adjust the
supported platforms independent of `SANITIZER_COMMON_SUPPORTED_OS`. This
mirrors the other sanitizers.

For non-Apple platforms `FUZZER_SUPPORTED_OS` is not defined and
surprisingly this was the behaviour before this patch because
`SANITIZER_COMMON_SUPPORTED_OS` was actually empty. This appears to
not matter right now because the functions that take an `OS` as an
argument seem to ignore it on non-Apple platforms.

While this change tries to be NFC it is technically not because we
now generate an iossim config whereas previously we didn't. This seems
like the right thing to do because the build system was configured to
compile LibFuzzer for iossim but previously we weren't generating a lit
test config for it. The device/simulator testing configs don't run by
default anyway so this shouldn't break testing.

This change relies on the get_capitalized_apple_platform() function
added in a previous commit.

rdar://problem/58798733

Reviewers: kubamracek, yln

Subscribers: mgorny, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years ago[CMake][NFC] Refactor iOS simulator/device test configuration generation code for...
Dan Liew [Wed, 22 Jan 2020 23:15:21 +0000 (15:15 -0800)]
[CMake][NFC] Refactor iOS simulator/device test configuration generation code for TSan.

Summary:
The previous code hard-coded platform names but compiler-rt's CMake
build system actually already knows which Apple platforms TSan supports.

This change uses this information to enumerate the different Apple
platforms.

This change relies on the `get_capitalized_apple_platform()` function
added in a previous commit.

rdar://problem/58798733

Reviewers: kubamracek, yln

Subscribers: mgorny, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years ago[CMake][NFC] Refactor iOS simulator/device test configuration generation code for...
Dan Liew [Wed, 22 Jan 2020 22:11:17 +0000 (14:11 -0800)]
[CMake][NFC] Refactor iOS simulator/device test configuration generation code for ASan.

Summary:
The previous code hard-coded platform names but compiler-rt's CMake
build system actually already knows which Apple platforms ASan supports.

This change uses this information to enumerate the different Apple
platforms.

rdar://problem/58798733

Reviewers: kubamracek, yln

Subscribers: mgorny, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years agoClang added a new feature to the ObjC compiler that will translate method
Jim Ingham [Thu, 23 Jan 2020 20:35:25 +0000 (12:35 -0800)]
Clang added a new feature to the ObjC compiler that will translate method
calls to commonly un-overridden methods into a function that checks whether
the method is overridden anywhere and if not directly dispatches to the
NSObject implementation.

That means if you do override any of these methods, "step-in" will not step
into your code, since we hit the wrapper function, which has no debug info,
and immediately step out again.

Add code to recognize these functions as "trampolines" and a thread plan that
will get us from the function to the user code, if overridden.

<rdar://problem/54404114>

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

4 years ago[lldb/Commands] Fix, rename and document column number arg to breakpoint set.
Jonas Devlieghere [Thu, 23 Jan 2020 19:25:16 +0000 (11:25 -0800)]
[lldb/Commands] Fix, rename and document column number arg to breakpoint set.

We were incorrectly parsing the -C argument to breakpoint set as the
column breakpoint, even though according to the help this should be the
breakpoint command. This fixes that by renaming the option to -u, adding
it to help, and adding a test case.

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

4 years agoPartially revert "[IR] Attribute/AttrBuilder: use Value::MaximumAlignment magic constant"
Roman Lebedev [Thu, 23 Jan 2020 20:30:09 +0000 (23:30 +0300)]
Partially revert "[IR] Attribute/AttrBuilder: use Value::MaximumAlignment magic constant"

Apparently makes bots angry.

This reverts commit d096f8d306b2b16a25f65ffb70849ca7963a0dac.

4 years agoRe-add documentation for -flax-vector-conversions= removed in
Richard Smith [Thu, 23 Jan 2020 20:28:03 +0000 (12:28 -0800)]
Re-add documentation for -flax-vector-conversions= removed in
edd4398f4cd33a305afbca76ac4e6590e9337f4d.

The documentation remains correct despite the revert of the patch.

4 years ago[ELF] --no-dynamic-linker: don't emit undefined weak symbols to .dynsym
Fangrui Song [Thu, 23 Jan 2020 19:52:03 +0000 (11:52 -0800)]
[ELF] --no-dynamic-linker: don't emit undefined weak symbols to .dynsym

I felt really sad to push this commit for my selfish purpose to make
glibc -static-pie build with lld. Some code constructs in glibc require
R_X86_64_GOTPCREL/R_X86_64_REX_GOTPCRELX referencing undefined weak to
be resolved to a GOT entry not relocated by R_X86_64_GLOB_DAT (GNU ld
behavior), e.g.

csu/libc-start.c
  if (__pthread_initialize_minimal != NULL)
    __pthread_initialize_minimal ();

elf/dl-object.c
  void
  _dl_add_to_namespace_list (struct link_map *new, Lmid_t nsid)
  {
    /* We modify the list of loaded objects.  */
    __rtld_lock_lock_recursive (GL(dl_load_write_lock));

Emitting a GLOB_DAT will make the address equal &__ehdr_start (true
value) and cause elf/ldconfig to segfault. glibc really should move away
from weak references, which do not have defined semantics.

Temporarily special case --no-dynamic-linker.

4 years ago[PDB] Simplify API for making section map, NFC
Reid Kleckner [Thu, 23 Jan 2020 20:11:50 +0000 (12:11 -0800)]
[PDB] Simplify API for making section map, NFC

Prevents API misuse described in PR44495

4 years ago[clangd] Add C++20 concepts support to TargetFinder
Nathan Ridge [Tue, 21 Jan 2020 21:55:43 +0000 (16:55 -0500)]
[clangd] Add C++20 concepts support to TargetFinder

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[clangd] Add C++20 concepts support to findExplicitReferences() and semantic highlighting
Nathan Ridge [Tue, 21 Jan 2020 18:21:08 +0000 (13:21 -0500)]
[clangd] Add C++20 concepts support to findExplicitReferences() and semantic highlighting

Summary: Fixes https://github.com/clangd/clangd/issues/259

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years agoRevert "[Sema] Sanity-check alignment requested via `__attribute__((assume_aligned...
Roman Lebedev [Thu, 23 Jan 2020 20:10:02 +0000 (23:10 +0300)]
Revert "[Sema] Sanity-check alignment requested via `__attribute__((assume_aligned(imm)))`"

Likely makes bots angry.

This reverts commit a4cfb15d15a8a353fe316f2a9fe1c8c6a6740ef1.

# Conflicts:
# clang/lib/Sema/SemaDeclAttr.cpp

4 years agoRevert "[Sema] Attempt to perform call-size-specific `__attribute__((alloc_align...
Roman Lebedev [Thu, 23 Jan 2020 20:07:58 +0000 (23:07 +0300)]
Revert "[Sema] Attempt to perform call-size-specific `__attribute__((alloc_align(param_idx)))` validation"

Likely makes bots angry.

This reverts commit c2a9061ac5166e48fe85ea2b6dbce9457c964958.

4 years agoAMDGPU: Fix ubsan error
Matt Arsenault [Thu, 23 Jan 2020 19:10:04 +0000 (14:10 -0500)]
AMDGPU: Fix ubsan error

Since register classes go up to 1024, 32 elements, all masks bits are
needed and a 32-bit shift by 32 is illegal. We didn't have any
instructions theoretically using a 32 element VGPR before
d1dbb5e4718a8f845abf0783513a33a55429470b

4 years ago[Sema] Don't disallow placing `__attribute__((alloc_align(param_idx)))` on `std:...
Roman Lebedev [Thu, 23 Jan 2020 19:50:34 +0000 (22:50 +0300)]
[Sema] Don't disallow placing `__attribute__((alloc_align(param_idx)))` on `std::align_val_t`-typed parameters

Summary:
I kind-of understand why it is restricted to integer-typed arguments,
for general enum's the value passed is not nessesairly the alignment implied,
although one might say that user would know best.

But we clearly should whitelist `std::align_val_t`,
which is just a thin wrapper over `std::size_t`,
and is the C++ standard way of specifying alignment.

Reviewers: erichkeane, rsmith, aaron.ballman, jdoerfert

Reviewed By: erichkeane

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[Codegen] If reasonable, materialize clang's `AllocAlignAttr` as llvm's Alignment...
Roman Lebedev [Thu, 23 Jan 2020 19:50:24 +0000 (22:50 +0300)]
[Codegen] If reasonable, materialize clang's `AllocAlignAttr` as llvm's Alignment Attribute on call-site function return value

Summary:
Much like with the previous patch (D73005) with `AssumeAlignedAttr`
handling, results in mildly more readable IR,
and will improve test coverage in upcoming patch.

Note that in `AllocAlignAttr`'s case, there is no requirement
for that alignment parameter to end up being an I-C-E.

Reviewers: erichkeane, jdoerfert, hfinkel, aaron.ballman, rsmith

Reviewed By: erichkeane

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[Codegen] If reasonable, materialize clang's `AssumeAlignedAttr` as llvm's Alignment...
Roman Lebedev [Thu, 23 Jan 2020 19:50:15 +0000 (22:50 +0300)]
[Codegen] If reasonable, materialize clang's `AssumeAlignedAttr` as llvm's Alignment Attribute on call-site function return value

Summary:
This should be mostly NFC - we still lower the same alignment
knowledge to the IR. The main reasoning here is that
this somewhat improves readability of IR like this,
and will improve test coverage in upcoming patch.

Even though the alignment is guaranteed to always be an I-C-E,
we don't always materialize it as llvm's Alignment Attribute because:
1. There may be a non-zero offset
2. We may be sanitizing for alignment

Note that if there already was an IR alignment attribute
on return value, we union them, and thus the alignment
only ever rises.

Also, there is a second relevant clang attribute `AllocAlignAttr`,
so that is why `AbstractAssumeAlignedAttrEmitter` is templated.

Reviewers: erichkeane, jdoerfert, hfinkel, aaron.ballman, rsmith

Reviewed By: erichkeane

Subscribers: cfe-commits

Tags: #clang

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