Commit Graph

402977 Commits

Author SHA1 Message Date
Shoaib Meenai ba94b8bdff [clangd] Attempt to fix buildbots
http://45.33.8.238/win/47615/step_4.txt is a sample error; I believe it
just needs the right header to be included.
2021-10-25 20:16:59 -07:00
Vy Nguyen e5fb79b314 [lld-macho] Make test produce the dead.o and live.o that are used below.
Follow up fix to breakages in D112485
2021-10-25 22:10:24 -04:00
Vy Nguyen 46ef187dcc [lld-macho] Fix incremental build (again) from D112485 2021-10-25 21:51:34 -04:00
Jez Ng d3ddd569eb [lld-macho] Fix incremental builds 2021-10-25 20:51:05 -04:00
Fangrui Song 3b42fc8a07 [ELF] Simplify sortSection. NFC 2021-10-25 16:57:46 -07:00
Dave Lee 65dae8b2f2 [lldb] Configure CMake policy CMP0116 for standalone builds
Using CMake >=3.20 results in many warnings about this new policy. This change silences the warnings by explicitly declaring use of the "OLD" behavior.

This applies D101083 to LLDBStandalone.cmake.

Differential Revision: https://reviews.llvm.org/D112497
2021-10-25 16:29:36 -07:00
Sam McCall aa1ac2ae45 [clangd] Flush stderr after signal handlers run, so we always get the full stack/crash info 2021-10-26 01:08:36 +02:00
Jez Ng 413e249a47 [lld-macho][nfc] Test that we don't emit undef symbol errors for dead code
This is what ld64 does too, so we have parity here (though I think ld64
still removes dead code more effectively than we do...)

Reviewed By: #lld-macho, thakis

Differential Revision: https://reviews.llvm.org/D112485
2021-10-25 19:05:39 -04:00
Duncan P. N. Exon Smith b12a864c29 Bitcode: Use Expected<T>::takeError() and moveInto() more, NFC
Avoid naming some Expected<T> values in the Bitcode reader by using
takeError() and moveInto() more often. This follows the smaller set of
changes included in 2410fb4616.
2021-10-25 16:03:40 -07:00
LLVM GN Syncbot df05babc96 [gn build] Port 045695f85c 2021-10-25 22:58:46 +00:00
Emma Blink 045695f85c [clangd] Print current request context along with the stack trace
Motivation:

At the moment it is hard to attribute a clangd crash to a specific request out of all in-flight requests that might be processed concurrently. So before we can act on production clangd crashes, we have to do quite some digging through the log tables populated by our in-house VSCode extension or sometimes even directly reach out to the affected developer. Having all the details needed to reproduce a crash printed alongside its stack trace has a potential to save us quite some time, that could better be spent on fixing the actual problems.

Implementation approach:

* introduce `ThreadCrashReporter` class that allows to set a temporary signal handler for the current thread
* follow RAII pattern to simplify printing context for crashes occurring within a particular scope
* hold `std::function` as a handler to allow capturing context to print
* set local `ThreadCrashReporter` within `JSONTransport::loop()` to print request JSON for main thread crashes, and in `ASTWorker::run()` to print the file paths, arguments and contents for worker thread crashes

`ThreadCrashReporter` currently allows only one active handler per thread, but the approach can be extended to support stacked handlers printing context incrementally.

Example output for main thread crashes:

  ```
  ...
  #15 0x00007f7ddc819493 __libc_start_main (/lib64/libc.so.6+0x23493)
  #16 0x000000000249775e _start (/home/emmablink/local/llvm-project/build/bin/clangd+0x249775e)
  Signalled while processing message:
  {"jsonrpc": "2.0", "method": "textDocument/didOpen", "params": {"textDocument": {"uri": "file:///home/emmablink/test.cpp", "languageId": "cpp", "version": 1, "text": "template <typename>\nclass Bar {\n  Bar<int> *variables_to_modify;\n  foo() {\n    for (auto *c : *variables_to_modify)\n      delete c;\n  }\n};\n"}}}
  ```

Example output for AST worker crashes:

  ```
  ...
  #41 0x00007fb18304c14a start_thread pthread_create.c:0:0
  #42 0x00007fb181bfcdc3 clone (/lib64/libc.so.6+0xfcdc3)
  Signalled during AST action:
  Filename: test.cpp
  Directory: /home/emmablink
  Command Line: /usr/bin/clang -resource-dir=/data/users/emmablink/llvm-project/build/lib/clang/14.0.0 -- /home/emmablink/test.cpp
  Version: 1
  Contents:
  template <typename>
  class Bar {
    Bar<int> *variables_to_modify;
    foo() {
      for (auto *c : *variables_to_modify)
        delete c;
    }
  };
  ```

Testing:

The unit test covers the thread-localitity and nesting aspects of `ThreadCrashReporter`. There might be way to set up a lit-based integration test that would spawn clangd, send a message to it, signal it immediately and check the standard output, but this might be prone to raceconditions.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D109506
2021-10-26 00:58:09 +02:00
Fangrui Song 4d9f6caee3 [ELF] Change SharedFile::soName from std::string to StringRef 2021-10-25 15:54:04 -07:00
Matthias Kramm 16e530d43b When generating C++ code, use C++ string escaping.
Reviewed By: Mogball

Differential Revision: https://reviews.llvm.org/D112468
2021-10-25 22:53:44 +00:00
Haowei Wu 07bed3ae52 [clang][Fuchsia] Add additional unit test for availability attr
This change adds additional unit tests for availability attribute
support for Fuchsia platform.

Differential Revision: https://reviews.llvm.org/D112271
2021-10-25 15:40:30 -07:00
Zarko Todorovski e9163660b1 [PPC][LLVM] Inclusive terms: remove references to sanity check in lib/Target/PowerPC
Removed references to `sanity check` in `PPCBranchCoalescing.cpp` code comments.
No word substitution made in this case, as the comments and code following illustrated are
sufficient IMO.

Reviewed By: quinnp

Differential Revision: https://reviews.llvm.org/D112452
2021-10-25 18:13:54 -04:00
Alina Sbirlea 3850cba7cc [bazel build] (manually) port da47ec3ca0 2021-10-25 15:10:38 -07:00
Fangrui Song 25da870057 [ELF] Remove irrelevant group signature hack working around old gold -r 2021-10-25 15:09:08 -07:00
Michael Jones 53804d4eb2 [libc] fix strtol returning the wrong length
Previously, strtol/ll/ul/ull would return a pointer to the end of its
parsing, regardless of if it detected a number. Now it will return a
length of 0 when it doesn't find a number.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D112176
2021-10-25 15:00:45 -07:00
Georgios Rokos 2feafa2e46 [libomptarget][NFC] Add comment explaining why we pass argument bases and
offsets as two separate entities to the plugins.
2021-10-25 14:51:14 -07:00
Nico Weber d2c133286a [gn build] (manually) port da47ec3ca0 2021-10-25 17:48:52 -04:00
Julian Lettner b3980b5b68 [Sanitizer] Strip PAC from PC in StackTrace::GetNextInstructionPc()
In TSan, we use the a function reference (`__tsan_stack_initialization`)
in a call to `StackTrace::GetNextInstructionPc(uptr pc)`.  We sign
function pointers, so we need to strip the signature from this function
pointer.

Caused by: https://reviews.llvm.org/D111147

Radar-Id: rdar://problem/83940546
2021-10-25 14:48:09 -07:00
Robert Suderman 58901a5a29 [mlir][tosa] Correct tosa.avg_pool2d for specification error
Specification specified the output type for quantized average pool should be
an i32. Only accumulator should be an i32, result type should match the input
type.

Caused in https://reviews.llvm.org/D111590

Reviewed By: sjarus, GMNGeoffrey

Differential Revision: https://reviews.llvm.org/D112484
2021-10-25 14:41:16 -07:00
Nathan Ridge e6a971b1ba [clangd] Respect diagnostic suppression during preamble build
Fixes https://github.com/clangd/clangd/issues/906

Differential Revision: https://reviews.llvm.org/D112403
2021-10-25 17:39:32 -04:00
Fangrui Song 43753f8f9d [ELF] Remove irrelevant SHT_INIT_ARRAY/SHT_FINI_ARRAY hack
The hack is irrelevant for two reasons:

* binutils 2.24 is quite old and cannot handle R_X86_64_REX_GOTPCRELX from 2016 onwards anyway
* `canMergeToProgbits` allows combining SHT_INIT_ARRAY/SHT_FINI_ARRAY into SHT_PROGBITS
2021-10-25 14:23:05 -07:00
Shilei Tian 2a30c03c62 [OpenMP][Offloading] Only get trip count if team construct
Reviewed By: grokos

Differential Revision: https://reviews.llvm.org/D112475
2021-10-25 17:16:14 -04:00
Arthur Eubanks 544a21566d [test] Make test added in D112473 check the IR
The test was intended to also check the IR to be empty.
2021-10-25 14:10:58 -07:00
Craig Topper d51e3a2139 [LegalizeTypes][TargetLowering] Merge getShiftAmountTyForConstant into TargetLowering::getShiftAmountTy.
getShiftAmountTyForConstant is a special helper that changes the
shift amount to i32 if the type chosen by
TargetLowering::getShiftAmountTy can't represent all possible values.
This is needed to satisfy an assert in SelectionDAG::getNode.

It requires additional consideration to know when this helper should be used.
I'm not sure that we are always using it when we should.

This patch merges the getShiftAmountTyForConstant handling into
TargetLowering::getShiftAmountTy so we don't need to think about it
anymore.

Technically this may slightly increase compile times since the majority
of callers of getShiftAmountTy won't need this. Hopefully, this isn't
an issue in practice.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D112469
2021-10-25 14:06:53 -07:00
Fangrui Song 6506907a0a [ELF] Update comments/diagnostics for -defsym and -image-base to use the canonical two-dash form 2021-10-25 14:01:36 -07:00
Duncan P. N. Exon Smith da47ec3ca0 Basic: Stop using expectedToOptional() in FileManagerTest, NFC
Remove a couple of uses of expectedToOptional() in FileManagerTest,
using Expected<T>::moveInto() to extract the value instead instead.
2021-10-25 13:44:45 -07:00
Nikita Popov 3a995c918e [SCEV] Move SCEVLostPoisonFlags() check into SCEVExpander
Always insert values into ExprValueMap, and instead skip using them
in SCEVExpander if poison-generating flags have been lost. This
ensures that all values that are in ValueExprMap are also in
ExprValueMap, so we can use the latter to invalidate the former.

This change is probably not entirely NFC for the case where
originally the SCEV had no nowrap flags but they were inferred
later, in which case that would now allow reusing the existing
value for expansion.

Differential Revision: https://reviews.llvm.org/D112389
2021-10-25 22:37:20 +02:00
Arthur Eubanks 4a9db7367d [AlwaysInliner] Invalidate analyses when we delete functions
Fixes PR52292.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D112473
2021-10-25 13:36:32 -07:00
Arthur Eubanks 882df21a1b [gn build] Add missing CodeGenTests dependency
Fixes link errors.
2021-10-25 13:34:06 -07:00
Joe Loser 59cf6a7403
[libc][NFC] Remove extra space in libc/CMakeLists.txt 2021-10-25 16:29:14 -04:00
Joe Loser 46c82753f6
[libc][NFC] Remove extra slash in path in libc/CMakeLists.txt
Remove extra `/` in path to match the include filepath from the previous
line.

Differential Revision: https://reviews.llvm.org/D112476
2021-10-25 16:26:49 -04:00
Arthur Eubanks ce304a452a [docs][NewPM] Add example C++ code on how to actually use the new PM
Differential Revision: https://reviews.llvm.org/D112477
2021-10-25 13:24:20 -07:00
Zarko Todorovski 9769e97c35 [LLVM] Inclusive terms: remove/replace references to sanity in RewriteStatepointsForGC.cpp and test
Part of work to have the LLVM backend to use more inclusive terms.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D112461
2021-10-25 16:17:41 -04:00
Nikita Popov 721569cc36 [BasicAA] Add test for benign range overflow (NFC) 2021-10-25 22:09:39 +02:00
Jakub Kuderski 763ae1d2c6 [DomTree][NFC] Clean up nits in DomTree code
Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D112482
2021-10-25 16:05:34 -04:00
Fangrui Song ca8105b76c [ELF][X86] Support R_X86_64_PLTOFF64
For a function call (using the default `-fplt`), GCC `-mcmodel=large` generates an assembly modifier which
leads to an R_X86_64_PLTOFF64 relocation. In real world,
http://git.ageinghacker.net/jitter (used by GNU poke) uses `-mcmodel=large`.

R_X86_64_PLTOFF64's formula is (if preemptible) `L - GOT + A` or (if non-preemptible) `S - GOT + A`
where `GOT` is (confusingly) the address of `.got.plt`

Reviewed By: peter.smith

Differential Revision: https://reviews.llvm.org/D112386
2021-10-25 13:05:17 -07:00
Fangrui Song a14ccaf509 [ELF] Support 128-bit bitmask in oneof(RelExpr)
Taken from Chih-Mao Chen's D100835.

RelExpr has 64 bits now and needs the extension to support new members
(`R_PLT_GOTPLT` for `R_X86_64_PLTOFF64` support).

Note: RelExpr needs to have at least a member >=64 to prevent
-Wtautological-constant-out-of-range-compare for `if (expr >= 64)`.

Reviewed By: arichardson, peter.smith

Differential Revision: https://reviews.llvm.org/D112385
2021-10-25 13:05:17 -07:00
Kirill Bobyrev 593814a10c [clangd] IncludeCleaner: Complicated rules for enum usage
Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D112209
2021-10-25 22:04:22 +02:00
Fangrui Song bf6e259b21 [ELF] Update comments/diagnostics for some long options to use the canonical two-dash form
Rewrite some comments as appropriate.
2021-10-25 12:52:06 -07:00
MaheshRavishankar 2f572818b0 [mlir][Linalg] Allow comprehensive bufferization to use callbacks for alloc/dealloc.
Using callbacks for allocation/deallocation allows users to override
the default.
Also add an option to comprehensive bufferization pass to use `alloca`
instead of `alloc`s. Note that this option is just for testing. The
option to use `alloca` does not work well with the option to allow for
returning memrefs.
2021-10-25 12:43:10 -07:00
Sanjay Patel d74630e114 [x86] add tests for vector -1 constant materialization; NFC 2021-10-25 15:00:36 -04:00
Fangrui Song 4ae1c2c6f1 [ELF] Delete unneeded hack for discarding empty name local symbol
This actually improves GNU ld compatibility.
Correct assemblers don't create such symbols.

Also simplify the code.
2021-10-25 11:55:31 -07:00
Greg Clayton c571988e9d Add modules stats into the "statistics dump" command.
The new module stats adds the ability to measure the time it takes to parse and index the symbol tables for each module, and reports modules statistics in the output of "statistics dump" along with the path, UUID and triple of the module. The time it takes to parse and index the symbol tables are also aggregated into new top level key/value pairs at the target level.

Differential Revision: https://reviews.llvm.org/D112279
2021-10-25 11:50:02 -07:00
Stefan Gränitz cdb335ffaf [JITLink] Fix warning 'shift count exceeds width' in AArch64 backend 2021-10-25 20:44:07 +02:00
Boian Petkantchin f1b922188e [MLIR][Math] Add erf to math dialect
Add math.erf lowering to libm call.
Add math.erf polynomial approximation.

Reviewed By: silvas, ezhulenev

Differential Revision: https://reviews.llvm.org/D112200
2021-10-25 18:30:17 +00:00
Wei Wang b283d55c90 [openmp] Emit deferred diag only when device compilation presents
There is no need to check for deferred diag when device compilation or target is
not given. This results in considerable build time improvement in some cases.

Differential Revision: https://reviews.llvm.org/D109175
2021-10-25 11:19:18 -07:00
AndreyChurbanov e38a1deb66 [OpenMP] libomp: disable definitions of 5.1 atomics for non-x86 arch.
Declarations of 5.1 atomic entries were added under
"#if KMP_ARCH_X86 || KMP_ARCH_X86_64" in kmp_atomic.h,
but definitions of the functions missed architecture guard in kmp_atomic.cpp.
As a result mangled symbols were available on non-x86 architecture.
The patch eliminates these unexpected symbols from the library.

Differential Revision: https://reviews.llvm.org/D112261
2021-10-25 21:17:26 +03:00