Commit Graph

324377 Commits

Author SHA1 Message Date
John McCall d47801e718 In coro.retcon lowering, don't explode if the optimizer messes around with the linkage of the prototype or the exact types of the yielded values.
llvm-svn: 368793
2019-08-14 03:53:52 +00:00
John McCall ac40483276 Fix a use-after-free in the coro.alloca treatment.
llvm-svn: 368792
2019-08-14 03:53:46 +00:00
John McCall 62a5dde0c2 Add intrinsics for doing frame-bound dynamic allocations within a coroutine.
These rely on having an allocator provided to the coroutine and thus,
for now, only work in retcon lowerings.

llvm-svn: 368791
2019-08-14 03:53:40 +00:00
John McCall 137b50f0c3 Guard dumps in the coro intrinsic validation logic behind NDEBUG checks. dump() is not guaranteed to be defined in all builds.
llvm-svn: 368790
2019-08-14 03:53:31 +00:00
John McCall 3829214185 Generalize llvm.coro.suspend.retcon to allow an arbitrary number of arguments to be passed back to the continuation function.
llvm-svn: 368789
2019-08-14 03:53:26 +00:00
John McCall 94010b2b7f Extend coroutines to support a "returned continuation" lowering.
A quick contrast of this ABI with the currently-implemented ABI:

- Allocation is implicitly managed by the lowering passes, which is fine
  for frontends that are fine with assuming that allocation cannot fail.
  This assumption is necessary to implement dynamic allocas anyway.

- The lowering attempts to fit the coroutine frame into an opaque,
  statically-sized buffer before falling back on allocation; the same
  buffer must be provided to every resume point.  A buffer must be at
  least pointer-sized.

- The resume and destroy functions have been combined; the continuation
  function takes a parameter indicating whether it has succeeded.

- Conversely, every suspend point begins its own continuation function.

- The continuation function pointer is directly returned to the caller
  instead of being stored in the frame.  The continuation can therefore
  directly destroy the frame when exiting the coroutine instead of having
  to leave it in a defunct state.

- Other values can be returned directly to the caller instead of going
  through a promise allocation.  The frontend provides a "prototype"
  function declaration from which the type, calling convention, and
  attributes of the continuation functions are taken.

- On the caller side, the frontend can generate natural IR that directly
  uses the continuation functions as long as it prevents IPO with the
  coroutine until lowering has happened.  In combination with the point
  above, the frontend is almost totally in charge of the ABI of the
  coroutine.

- Unique-yield coroutines are given some special treatment.

llvm-svn: 368788
2019-08-14 03:53:17 +00:00
Joel E. Denny dbb757f462 [FileCheck] Document FILECHECK_OPTS in -help
Reviewed By: thopre

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

llvm-svn: 368787
2019-08-14 02:56:20 +00:00
Joel E. Denny 608f2bfd65 [FileCheck] Move -dump-input diagnostic to first line
Without this patch, `-dump-input` prints a diagnostic at the end of
its marker range.  For example:

```
         1: Start.
check:1     ^~~~~~
         2: Bad.
next:2      X~~~
         3: Many lines
next:2      ~~~~~~~~~~
         4: of input.
next:2      ~~~~~~~~~
         5: End.
next:2      ~~~~ error: no match found
```

This patch moves it to the beginning like this:

```
         1: Start.
check:1     ^~~~~~
         2: Bad.
next:2      X~~~ error: no match found
         3: Many lines
next:2      ~~~~~~~~~~
         4: of input.
next:2      ~~~~~~~~~
         5: End.
next:2      ~~~~
```

The former somehow looks nicer because the diagnostic doesn't appear
to be somewhere within the marker range.  However, the latter is more
practical, especially when the marker range includes the remainder of
a very long dump.  First, in the case of an error, this patch enables
me to search the dump for `error:` and usually immediately land where
the detected error began.  Second, when trying to follow FileCheck's
logic, it's best to read top down, so this patch enables me to see
each diagnostic as soon as I encounter its marker.

Reviewed By: thopre

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

llvm-svn: 368786
2019-08-14 02:56:09 +00:00
Richard Smith dac3ea4eb3 Add __has_builtin support for builtin function-like type traits.
Summary:
Previously __has_builtin(__builtin_*) would return false for
__builtin_*s that we modeled as keywords rather than as functions
(because they take type arguments). With this patch, all builtins
that are called with function-call-like syntax return true from
__has_builtin (covering __builtin_* and also the __is_* and __has_* type
traits and the handful of similar builtins without such a prefix).

Update the documentation on __has_builtin and on type traits to match.
While doing this I noticed the type trait documentation was out of date
and incomplete; that's fixed here too.

Reviewers: aaron.ballman

Subscribers: jfb, kristina, cfe-commits

Tags: #clang

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

llvm-svn: 368785
2019-08-14 02:30:11 +00:00
Fangrui Song f1d538cce5 [ELF] Initialize 2 fields of Symbol in SymbolTable::insert
A new symbol is added to elf::symtab in 3 steps:

1) SymbolTable::insert creates a placeholder.
2) Symbol::mergeProperties
3) Symbol::replace

Fields referenced by steps 2) and 3) should be initialized in
SymbolTable::insert.  `traced` and `referenced` were missed previously.
This did not cause problems because compilers generated code that
initialized them (bit fields) to 0.

Reviewed By: grimar

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

llvm-svn: 368784
2019-08-14 01:52:47 +00:00
Sam Clegg cee41ce223 [libcxxabi] Define _LIBCXXABI_GUARD_ABI_ARM on WebAssembly
This matches ItaniumCXXABI.cpp.

Fixes PR42680

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

llvm-svn: 368783
2019-08-14 01:30:48 +00:00
Jonas Devlieghere b6946a2d12 Fix warning: suggest braces around initialization of subobject
This patch adds braces to the DEFINE_XMM macro.

llvm-svn: 368782
2019-08-14 01:25:10 +00:00
Aditya Nandakumar c65ac865c3 [GlobalISel]: Fix lowering of G_Shuffle_vector where we pick up the wrong source index
https://reviews.llvm.org/D66182

llvm-svn: 368781
2019-08-14 01:23:33 +00:00
Alex Langford 21872bc9bf [analyzer] Don't delete TaintConfig copy constructor
Summary:
Explicitly deleting the copy constructor makes compiling the function
`ento::registerGenericTaintChecker` difficult with some compilers. When we
construct an `llvm::Optional<TaintConfig>`, the optional is constructed with a
const TaintConfig reference which it then uses to invoke the deleted TaintConfig
copy constructor.

I've observered this failing with clang 3.8 on Ubuntu 16.04.

Reviewers: compnerd, Szelethus, boga95, NoQ, alexshap

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, Charusso, llvm-commits, cfe-commits

Tags: #clang

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

llvm-svn: 368779
2019-08-14 01:09:07 +00:00
Douglas Yung 5ee4d7a859 [ORC] Fix clang-interpreter example code broken by r368707.
llvm-svn: 368778
2019-08-14 01:03:35 +00:00
Kristof Umann 3f7c66d551 [analyzer][NFC] Prepare visitors for different tracking kinds
When we're tracking a variable that is responsible for a null pointer
dereference or some other sinister programming error, we of course would like to
gather as much information why we think that the variable has that specific
value as possible. However, the newly introduced condition tracking shows that
tracking all values this thoroughly could easily cause an intolerable growth in
the bug report's length.

There are a variety of heuristics we discussed on the mailing list[1] to combat
this, all of them requiring to differentiate in between tracking a "regular
value" and a "condition".

This patch introduces the new `bugreporter::TrackingKind` enum, adds it to
several visitors as a non-optional argument, and moves some functions around to
make the code a little more coherent.

[1] http://lists.llvm.org/pipermail/cfe-dev/2019-June/062613.html

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

llvm-svn: 368777
2019-08-14 00:48:57 +00:00
Aaron Smith 2a39024ac8 Update Python tests for lldb-server on Windows
Summary: Thanks to Hui Huang and reviewers for all the help with this patch!

Reviewers: labath, jfb, clayborg

Reviewed By: labath

Subscribers: Hui, clayborg, dexonsmith, lldb-commits

Tags: #lldb

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

llvm-svn: 368776
2019-08-14 00:14:15 +00:00
Amara Emerson 2a312fc989 [AArch64][GlobalISel] RBS: Treat s128s like vectors when unmerging.
The destinations should be FPRs (for now).

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

llvm-svn: 368775
2019-08-13 23:51:20 +00:00
Aaron Smith 216944ee03 Enable lldb-server on Windows
Summary:
This commit contains three small changes to enable lldb-server on Windows.

- Add lldb-server for Windows to the build
- Disable pty redirection on Windows for the initial lldb-server bring up
- Add a support to get the parent pid for a process on Windows
- Ifdef some signals which aren't supported on Windows

Thanks to Hui Huang for the help with this patch!

Reviewers: labath

Reviewed By: labath

Subscribers: JDevlieghere, compnerd, Hui, amccarth, xiaobai, srhines, mgorny, lldb-commits

Tags: #lldb

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

llvm-svn: 368774
2019-08-13 23:50:54 +00:00
Kristof Umann 0df9c8c578 [analyzer] Track the right hand side of the last store regardless of its value
Summary:
The following code snippet taken from D64271#1572188 has an issue: namely,
because `flag`'s value isn't undef or a concrete int, it isn't being tracked.

int flag;
bool coin();

void foo() {
  flag = coin();
}

void test() {
  int *x = 0;
  int local_flag;
  flag = 1;

  foo();
  local_flag = flag;
  if (local_flag)
    x = new int;

  foo();
  local_flag = flag;
  if (local_flag)
    *x = 5;
}

This, in my opinion, makes no sense, other values may be interesting too.
Originally added by rC185608.

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

llvm-svn: 368773
2019-08-13 23:48:10 +00:00
Jonas Devlieghere 3cb3aa2ee8 [DebugLine] Be more robust in geussing the path style
My previous change didn't fix the Windows bot. This patch is an attempt
to make guessing the path style more robust by first looking at the
compile dir and falling back to the actual file if that's unsuccessful.

llvm-svn: 368772
2019-08-13 23:30:11 +00:00
Kristof Umann 46929df723 [analyzer] Prune calls to functions with linear CFGs that return a non-zero constrained value
During the evaluation of D62883, I noticed a bunch of totally
meaningless notes with the pattern of "Calling 'A'" -> "Returning value"
-> "Returning from 'A'", which added no value to the report at all.

This patch (not only affecting tracked conditions mind you) prunes
diagnostic messages to functions that return a value not constrained to
be 0, and are also linear.

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

llvm-svn: 368771
2019-08-13 23:22:33 +00:00
Eli Friedman b5eb3e1e82 [AArch64] Remove incorrect usage of MONonTemporal.
This has no effect at the moment, but might matter if we try to
implement non-temporal loads in the future.

llvm-svn: 368770
2019-08-13 23:12:14 +00:00
Artem Dergachev daf41722bd [analyzer] exploded-graph-rewriter: Implement displaying Store pointers.
They're useful when trying to understand what's going on
inside your LazyCompoundValues.

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

llvm-svn: 368769
2019-08-13 23:04:56 +00:00
Artem Dergachev 9289681ea3 [analyzer] exploded-graph-rewriter: Implement manual graph trimming.
When -trim-egraph is unavailable (say, when you're debugging a crash on
a real-world code that takes too long to reduce), it makes sense to view
the untrimmed graph up to the crashing node's predecessor, then dump the ID
(or a pointer) of the node in the attached debugger, and then trim
the dumped graph in order to keep only paths from the root to the node.

The newly added --to flag does exactly that:

$ exploded-graph-rewriter.py ExprEngine.dot --to 0x12229acd0

Multiple nodes can be specified. Stable IDs of nodes can be used
instead of pointers.

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

llvm-svn: 368768
2019-08-13 23:04:53 +00:00
Artem Dergachev 0b26891f3f [analyzer] exploded-graph-rewriter: NFC: Refactor explorers into trimmers.
Explorers aren't the right abstraction. For the purposes of displaying svg files
we don't care in which order do we explore the nodes. We may care about this for
other analyses, but we're not there yet.

The function of cutting out chunks of the graph is performed poorly by
the explorers, because querying predecessors/successors on the explored nodes
yields original successors/predecessors even if they aren't being explored.

Introduce a new entity, "trimmers", that do one thing but to it right: cut out
chunks of the graph. Trimmers mutate the graph, so stale edges aren't even
visible to their consumers in the pipeline. Additionally, trimmers are
intrinsically composable: multiple trimmers can be applied to the graph
sequentially.

Refactor the single-path explorer into the single-path trimmer.
Rename the test file for consistency.

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

llvm-svn: 368767
2019-08-13 23:04:50 +00:00
Artem Dergachev e9e3635453 [analyzer] exploded-graph-rewriter: Open the converted graph immediately.
Change the default behavior: the tool no longer dumps the rewritten .dot file
to stdout, but instead it automatically converts it into an .html file
(which essentially wraps an .svg file) and immediately opens it with
the default web browser.

This means that the tool should now be fairly easy to use:

  $ exploded-graph-rewriter.py /tmp/ExprEngine.dot

The benefits of wrapping the .svg file into an .html file are:

    - It'll open in a web browser, which is the intended behavior.
      An .svg file would be open with an image viewer/editor instead.
    - It avoids the white background around the otherwise dark svg area
      in dark mode.

The feature can be turned off by passing a flag '--rewrite-only'.
The LIT substitution is updated to enforce the old mode because
we don't want web browsers opening on our buildbots.

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

llvm-svn: 368766
2019-08-13 23:04:47 +00:00
Artem Dergachev f5a60e590f [analyzer] Disable the checker-plugins test on Darwin.
Fixes a buildbot.

llvm-svn: 368765
2019-08-13 23:04:44 +00:00
Lang Hames 810b574d77 [ORC] Fix SpeculativeJIT example code broken by r368707.
llvm-svn: 368764
2019-08-13 22:44:54 +00:00
Michael Kruse cc0f0582c8 [Polly-ACC] Fix test after IR-printer change.
After r367755, even unnamed parameters are printed in IR dumps. Change
the test to expect te additional %0 in the line.

llvm-svn: 368763
2019-08-13 22:42:08 +00:00
Jan Korous 9a13852eab [clang][DirectoryWatcher] Fix Windows stub after LLVM change
r367979 changed DirectoryWatcher::Create to return an llvm::Expected.
Adjust the Windows stub accordingly.

(upstreamed from github.com/apple/swift-clang)

llvm-svn: 368762
2019-08-13 22:39:50 +00:00
Jan Korous b724f3d4b3 [clang] DirectoryWatcher for Windows stubs (to fix build break).
This is just a code skeleton for DirectoryWatcher-windows.cpp so the
build on Windows stops breaking.

(upstreamed from github.com/apple/swift-clang)

llvm-svn: 368761
2019-08-13 22:39:26 +00:00
Jessica Paquette b28fa9ec50 Attempt to fix issue with unresolved lit test in TableGen
Build bots are unhappy about the Common directory.

Add an excludes list to lit.local.cfg.

llvm-svn: 368760
2019-08-13 22:32:26 +00:00
Aaron Smith 5146a9ea5d Initial support for native debugging of x86/x64 Windows processes
Summary: Thanks to Hui Huang and the reviewers for all the help with this patch.

Reviewers: labath, Hui, jfb, clayborg, amccarth

Reviewed By: labath

Subscribers: amccarth, compnerd, dexonsmith, mgorny, jfb, teemperor, lldb-commits

Tags: #lldb

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

llvm-svn: 368759
2019-08-13 22:18:01 +00:00
Alex Langford b809187a6b [NFCI] Explicitly provide user-defined constructor for SectionRef
I am changing this to work around an issue that is being hit when
building with clang 3.8. Specifically, clang 3.8 requires that we have a user
defined default constructor for SectionRef for the default initialization of a
const SectionRef.

llvm-svn: 368758
2019-08-13 22:16:18 +00:00
Jessica Paquette f41ce85909 [GlobalISel][NFC] Factor out common target code from GlobalISelEmitterTests
Factor out commonly-used target code from the GlobalISelEmitter tests into
a GlobalISelEmitterCommon.td file. This is tested by the original
GlobalISelEmitter.td test.

This reduces the amount of boilerplate code necessary for tests like this.

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

llvm-svn: 368757
2019-08-13 22:14:37 +00:00
Douglas Yung fb1d803224 Relax opcode checks in test to check for only a number instead of a specific number.
llvm-svn: 368756
2019-08-13 22:05:18 +00:00
Kristof Umann e1117addd6 [analyzer][NFC] Make sure that the BugReport is not modified during the construction of non-visitor pieces
I feel this is kinda important, because in a followup patch I'm adding different
kinds of interestingness, and propagating the correct kind in BugReporter.cpp is
just one less thing to worry about.

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

llvm-svn: 368755
2019-08-13 22:03:08 +00:00
Erik Pilkington 6c97f88986 Add a missing header comment, NFC
llvm-svn: 368754
2019-08-13 22:01:39 +00:00
Aditya Nandakumar 615eee6402 [GlobalISel]: Fix lowering of G_SHUFFLE_VECTOR with scalar sources
https://reviews.llvm.org/D66171

llvm-svn: 368753
2019-08-13 21:49:11 +00:00
Kristof Umann 6c1b19ac9e [analyzer][NFC] Refactoring BugReporter.cpp P6.: Completely get rid of interestingness propagation
Apparently this does literally nothing.

When you think about this, it makes sense. If something is really important,
we're tracking it anyways, and that system is sophisticated enough to mark
actually interesting statements as such. I wouldn't say that it's even likely
that subexpressions are also interesting (array[10 - x + x]), so I guess even
if this produced any effects, its probably undesirable.

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

llvm-svn: 368752
2019-08-13 21:48:17 +00:00
Jon Chesterfield ed3324f6b6 Factor architecture dependent code out of loop.cu
Summary:
[libomptarget] Factor architecture dependent code out of loop.cu

Related to the patch series starting D64217. Added subscribers to said series as reviewers. This effort is smaller in scope.

This patch factors out just enough architecture dependent code from loop.cu to allow the same source to be used with amdgcn, given a different target_impl.h. Testing is that the same bitcode (modulo variable names) is generated for libomptarget before and after the refactor, for nvptx and the out of tree amdgcn.

Reviewers: jdoerfert, ABataev, bollu, jfb, tra, grokos, Hahnfeld, guansong, xtian, gregrodgers, ronlieb, hfinkel, gtbercea, guraypp, arpith-jacob

Reviewed By: jdoerfert, ABataev

Subscribers: dexonsmith, openmp-commits

Tags: #openmp

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

llvm-svn: 368751
2019-08-13 21:41:47 +00:00
Guanzhong Chen 8a503e439d [WebAssembly] Make clang emit correct va_arg code for structs
Summary:
In the WebAssembly backend, when lowering variadic function calls, non-single
member aggregate type arguments are always passed by pointer.

However, when emitting va_arg code in clang, the arguments are instead read as
if they are passed directly. This results in the pointer being read as the
actual structure.

Fixes https://github.com/emscripten-core/emscripten/issues/9042.

Reviewers: tlively, sbc100, kripken, aheejin, dschuff

Reviewed By: dschuff

Subscribers: dschuff, jgravelle-google, sunfish, cfe-commits

Tags: #clang

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

llvm-svn: 368750
2019-08-13 21:41:11 +00:00
Louis Dionne 10f0668b57 [libc++] Mark two <chrono> tests as unsupported on AppleClang 11
The operator""y and operator""d will eventually be supported by
AppleClang, but no released version supports them at the moment.

llvm-svn: 368749
2019-08-13 21:34:49 +00:00
Michael Liao 44e6c6bd2f Remove the extra `;`.
llvm-svn: 368748
2019-08-13 21:26:42 +00:00
Mark Lacey b058249a4b [GISel] Pass MachineRegisterInfo by const reference to matcher.
Summary: NFC.

Reviewers: aditya_nandakumar, volkan

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 368747
2019-08-13 21:17:14 +00:00
Jonas Devlieghere 4d82fa6895 [DWARF] Guess the path style
Try to guess the FileSpec path style before defaulting to native.

llvm-svn: 368746
2019-08-13 21:00:27 +00:00
Kristof Umann edb788592d [analyzer][NFC] Address inlines of D65484
llvm-svn: 368745
2019-08-13 20:42:48 +00:00
Xiangling Liao a8c624a1c4 [AIX]Lowering global address for 32/64bit small/large code models
This patch implements global address lowering for 32/64 bit with small/large code models.
    1.For 32bit large code model on AIX, there are newly added pseudo opcode LWZtocL & ADDIStocHA32, the support of which on MC layer will be
       provided by future patches.
    2.The default code model on AIX should be small code model.
    3.Since AIX does not have medium code model, "report_fatal_error" when users specify it.

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

llvm-svn: 368744
2019-08-13 20:29:01 +00:00
Shaurya Gupta 52d0cfc91e [Refactor] Moving SourceExtraction header from lib to include
Summary:
- Moved the SourceExtraction header from lib to include so that it can be used in clangd.

Reviewers: arphaman

Subscribers: ilya-biryukov, dexonsmith, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 368743
2019-08-13 20:21:00 +00:00