platform/upstream/llvm.git
2 years ago[LLDB] Fix LLDB buildbots break due to --image-base
Muhammad Omair Javaid [Tue, 26 Oct 2021 07:07:11 +0000 (12:07 +0500)]
[LLDB] Fix LLDB buildbots break due to --image-base

LLDB build were failing due to following two test failures:
lldb-shell :: ObjectFile/ELF/basic-info.yaml
lldb-shell :: SymbolFile/DWARF/x86/debug-types-address-ranges.s

There were caused by commit 6506907a0a1a8a789ad7036ef911f7e31213c9a5

2 years ago[llvm-profgen] Allow unsymbolized profile as perf input
wlei [Fri, 15 Oct 2021 03:18:53 +0000 (20:18 -0700)]
[llvm-profgen] Allow unsymbolized profile as perf input

This change allows the unsymbolized profile as input. The unsymbolized profile is created by `llvm-profgen` with `--skip-symbolization` and it's after the sample aggregation but before symbolization , so it has much small file size. It can be used for sample merging and trimming,  also is useful for debugging or adding test cases. A switch `--unsymbolized-profile=file-patch` is added for this.

Format of unsymbolized profile:
```

   [context stack1]    # If it's a CS profile
      number of entries in RangeCounter
      from_1-to_1:count_1
      from_2-to_2:count_2
      ......
      from_n-to_n:count_n
      number of entries in BranchCounter
      src_1->dst_1:count_1
      src_2->dst_2:count_2
      ......
      src_n->dst_n:count_n
    [context stack2]
      ......
```

Reviewed By: hoy, wenlei

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

2 years ago[NFC] Remove obsolete simplifyOnceImpl function
Max Kazantsev [Tue, 26 Oct 2021 06:38:03 +0000 (13:38 +0700)]
[NFC] Remove obsolete simplifyOnceImpl function

The function simplifyOnce only calls simplifyOnceImpl and does nothing else.
Having this separate helper makes no sense. Removing it.

Patch by Dmitry Bakunevich!

Differential Revision: https://reviews.llvm.org/D112517
Reviewed By: mkazantsev

2 years agollvm pretty printers: Fix StringRef and workaround StringMap in Python 2
David Blaikie [Tue, 26 Oct 2021 06:48:09 +0000 (23:48 -0700)]
llvm pretty printers: Fix StringRef and workaround StringMap in Python 2

2 years ago[NFC] [LoopPeel] Update IDoms of non-loop blocks dominated by the loop
Max Kazantsev [Tue, 26 Oct 2021 06:09:07 +0000 (13:09 +0700)]
[NFC] [LoopPeel] Update IDoms of non-loop blocks dominated by the loop

When peeling a loop, we assume that the latch has a `br` terminator and that
all loop exits are either terminated with an `unreachable` or have a terminating
deoptimize call. So when we peel off the 1st iteration, we change the IDom of
all loop exits to the peeled copy of `NCD(IDom(Exit), Latch)`. This works now,
but if we add logic to support loops with exits that are followed by a block
with an `unreachable` or a terminating deoptimize call, changing the exit's idom
wouldn't be enough and DT would be broken.

For example, let `Exit1` and `Exit2` are loop exits, and each of them
unconditionally branches to the same `unreachable` terminated block. So neither
of the exits dominates this unreachable block. If we change the IDoms of the
exits to some peeled loop block, we don't update the dominators of the unreachable
block. Currently we just don't get to the peeling logic, saying that we can't peel
such loops.

Previously we stored exits' IDoms in a map before peeling a loop and then, after
peeling off one iteration, we changed their IDoms.
Now we use the same logic not only for exits but for all non-loop blocks dominated
by the loop.
So when we add logic to support peeling loops with exits which branch, for example,
to an unreachable-terminated block, we would update the IDoms not only for exits,
but for their successors.

Patch by Dmitry Makogon!

Differential Revision: https://reviews.llvm.org/D111611
Reviewed By: mkazantsev, nikic

2 years ago[clang-tidy] Suppress readability-static-access-through-instance for CUDA built-in...
Carlos Galvez [Fri, 22 Oct 2021 17:38:34 +0000 (17:38 +0000)]
[clang-tidy] Suppress readability-static-access-through-instance for CUDA built-in variables

clang-tidy can be used to statically analyze CUDA code,
thanks to clang being able to compile CUDA code natively.
This makes clang-tidy the one and only open-source
static analyzer for CUDA.

However it currently warns for native CUDA built-in
variables, like threadIdx, due to the way they
are implemented in clang.

Users don't need to know the details of the clang
implementation, and they should continue to write
idiomatic code. Therefore, suppress the warning
if a CUDA built-in variable is encountered.

Fixes https://bugs.llvm.org/show_bug.cgi?id=48758

2 years ago[X86] Move splat addends from the gather/scatter index operand to the base address
Phoebe Wang [Tue, 26 Oct 2021 03:56:15 +0000 (11:56 +0800)]
[X86] Move splat addends from the gather/scatter index operand to the base address

This can avoid a vector add and a constant pool load. Or an explicit broadcast in case of non-constant.

Also reverse the transform any time we encounter a constant index addend that can't be moved to base. In that case pull the constant from base into the index. This reduces code size needed for the displacement since we needed the index add anyway. Limit this to scale of 1 to avoid divisibility and wrap issues.

Authored by Craig.

Reviewed By: craig.topper

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

2 years ago[mlir-c] Avoid compiler warning
Jacques Pienaar [Tue, 26 Oct 2021 04:11:50 +0000 (21:11 -0700)]
[mlir-c] Avoid compiler warning

Setting visibility & static leads to warning about attribute being
ignored.

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

2 years ago[TableGen] Fix codgen of InstrMapping with multiple columns and values
Jyun-Yan You [Tue, 26 Oct 2021 04:00:23 +0000 (21:00 -0700)]
[TableGen] Fix codgen of InstrMapping with multiple columns and values

This patch fixes invalid syntax of generated code for InstrMapping
that has multiple columns and values.

Reviewed By: craig.topper

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

2 years ago[lldb] Skip tests for target var without a proc on both arm64 & arm64e
Jonas Devlieghere [Tue, 26 Oct 2021 03:44:59 +0000 (20:44 -0700)]
[lldb] Skip tests for target var without a proc on both arm64 & arm64e

LLDB needs to be taught about chained fixups.

<rdar://problem/37773624>

2 years ago[AIX][ZOS] Disable tests due to lack of Objective-C support
Jake Egan [Tue, 26 Oct 2021 03:32:02 +0000 (23:32 -0400)]
[AIX][ZOS] Disable tests due to lack of Objective-C support

AIX and z/OS lack Objective-C support, so mark these tests as unsupported for AIX and z/OS.

This patch follows the same reasoning as D109060.

Reviewed By: jsji

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

2 years ago[clangd] Attempt to fix buildbots
Shoaib Meenai [Tue, 26 Oct 2021 03:16:59 +0000 (20:16 -0700)]
[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.

2 years ago[lld-macho] Make test produce the dead.o and live.o that are used below.
Vy Nguyen [Tue, 26 Oct 2021 02:10:24 +0000 (22:10 -0400)]
[lld-macho] Make test produce the dead.o and live.o that are used below.
Follow up fix to breakages in D112485

2 years ago[lld-macho] Fix incremental build (again) from D112485
Vy Nguyen [Tue, 26 Oct 2021 01:51:34 +0000 (21:51 -0400)]
[lld-macho] Fix incremental build (again) from D112485

2 years ago[lld-macho] Fix incremental builds
Jez Ng [Tue, 26 Oct 2021 00:50:35 +0000 (20:50 -0400)]
[lld-macho] Fix incremental builds

2 years ago[ELF] Simplify sortSection. NFC
Fangrui Song [Mon, 25 Oct 2021 23:57:46 +0000 (16:57 -0700)]
[ELF] Simplify sortSection. NFC

2 years ago[lldb] Configure CMake policy CMP0116 for standalone builds
Dave Lee [Mon, 25 Oct 2021 22:49:46 +0000 (15:49 -0700)]
[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

2 years ago[clangd] Flush stderr after signal handlers run, so we always get the full stack...
Sam McCall [Mon, 25 Oct 2021 23:08:28 +0000 (01:08 +0200)]
[clangd] Flush stderr after signal handlers run, so we always get the full stack/crash info

2 years ago[lld-macho][nfc] Test that we don't emit undef symbol errors for dead code
Jez Ng [Mon, 25 Oct 2021 20:21:08 +0000 (16:21 -0400)]
[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

2 years agoBitcode: Use Expected<T>::takeError() and moveInto() more, NFC
Duncan P. N. Exon Smith [Mon, 25 Oct 2021 20:56:43 +0000 (13:56 -0700)]
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 2410fb4616b2c08bbaddd44e6c11da8285fbd1d3.

2 years ago[gn build] Port 045695f85cb8
LLVM GN Syncbot [Mon, 25 Oct 2021 22:58:46 +0000 (22:58 +0000)]
[gn build] Port 045695f85cb8

2 years ago[clangd] Print current request context along with the stack trace
Emma Blink [Mon, 25 Oct 2021 15:18:48 +0000 (17:18 +0200)]
[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

2 years ago[ELF] Change SharedFile::soName from std::string to StringRef
Fangrui Song [Mon, 25 Oct 2021 22:54:04 +0000 (15:54 -0700)]
[ELF] Change SharedFile::soName from std::string to StringRef

2 years agoWhen generating C++ code, use C++ string escaping.
Matthias Kramm [Mon, 25 Oct 2021 22:53:08 +0000 (22:53 +0000)]
When generating C++ code, use C++ string escaping.

Reviewed By: Mogball

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

2 years ago[clang][Fuchsia] Add additional unit test for availability attr
Haowei Wu [Thu, 21 Oct 2021 20:56:09 +0000 (13:56 -0700)]
[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

2 years ago[PPC][LLVM] Inclusive terms: remove references to sanity check in lib/Target/PowerPC
Zarko Todorovski [Mon, 25 Oct 2021 20:18:26 +0000 (16:18 -0400)]
[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

2 years ago[bazel build] (manually) port da47ec3ca076
Alina Sbirlea [Mon, 25 Oct 2021 22:07:32 +0000 (15:07 -0700)]
[bazel build] (manually) port da47ec3ca076

2 years ago[ELF] Remove irrelevant group signature hack working around old gold -r
Fangrui Song [Mon, 25 Oct 2021 22:09:08 +0000 (15:09 -0700)]
[ELF] Remove irrelevant group signature hack working around old gold -r

2 years ago[libc] fix strtol returning the wrong length
Michael Jones [Wed, 20 Oct 2021 20:08:46 +0000 (13:08 -0700)]
[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

2 years ago[libomptarget][NFC] Add comment explaining why we pass argument bases and
Georgios Rokos [Mon, 25 Oct 2021 21:48:53 +0000 (14:48 -0700)]
[libomptarget][NFC] Add comment explaining why we pass argument bases and
offsets as two separate entities to the plugins.

2 years ago[gn build] (manually) port da47ec3ca076
Nico Weber [Mon, 25 Oct 2021 21:48:35 +0000 (17:48 -0400)]
[gn build] (manually) port da47ec3ca076

2 years ago[Sanitizer] Strip PAC from PC in StackTrace::GetNextInstructionPc()
Julian Lettner [Mon, 25 Oct 2021 19:49:41 +0000 (12:49 -0700)]
[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

2 years ago[mlir][tosa] Correct tosa.avg_pool2d for specification error
Robert Suderman [Mon, 25 Oct 2021 21:30:06 +0000 (14:30 -0700)]
[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

2 years ago[clangd] Respect diagnostic suppression during preamble build
Nathan Ridge [Mon, 25 Oct 2021 06:42:11 +0000 (02:42 -0400)]
[clangd] Respect diagnostic suppression during preamble build

Fixes https://github.com/clangd/clangd/issues/906

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

2 years ago[ELF] Remove irrelevant SHT_INIT_ARRAY/SHT_FINI_ARRAY hack
Fangrui Song [Mon, 25 Oct 2021 21:23:05 +0000 (14:23 -0700)]
[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

2 years ago[OpenMP][Offloading] Only get trip count if team construct
Shilei Tian [Mon, 25 Oct 2021 21:15:56 +0000 (17:15 -0400)]
[OpenMP][Offloading] Only get trip count if team construct

Reviewed By: grokos

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

2 years ago[test] Make test added in D112473 check the IR
Arthur Eubanks [Mon, 25 Oct 2021 21:04:18 +0000 (14:04 -0700)]
[test] Make test added in D112473 check the IR

The test was intended to also check the IR to be empty.

2 years ago[LegalizeTypes][TargetLowering] Merge getShiftAmountTyForConstant into TargetLowering...
Craig Topper [Mon, 25 Oct 2021 21:06:52 +0000 (14:06 -0700)]
[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

2 years ago[ELF] Update comments/diagnostics for -defsym and -image-base to use the canonical...
Fangrui Song [Mon, 25 Oct 2021 21:01:36 +0000 (14:01 -0700)]
[ELF] Update comments/diagnostics for -defsym and -image-base to use the canonical two-dash form

2 years agoBasic: Stop using expectedToOptional() in FileManagerTest, NFC
Duncan P. N. Exon Smith [Mon, 25 Oct 2021 20:37:45 +0000 (13:37 -0700)]
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.

2 years ago[SCEV] Move SCEVLostPoisonFlags() check into SCEVExpander
Nikita Popov [Sun, 24 Oct 2021 21:42:23 +0000 (23:42 +0200)]
[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

2 years ago[AlwaysInliner] Invalidate analyses when we delete functions
Arthur Eubanks [Mon, 25 Oct 2021 17:52:30 +0000 (10:52 -0700)]
[AlwaysInliner] Invalidate analyses when we delete functions

Fixes PR52292.

Reviewed By: asbirlea

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

2 years ago[gn build] Add missing CodeGenTests dependency
Arthur Eubanks [Mon, 25 Oct 2021 20:33:28 +0000 (13:33 -0700)]
[gn build] Add missing CodeGenTests dependency

Fixes link errors.

2 years ago[libc][NFC] Remove extra space in libc/CMakeLists.txt
Joe Loser [Mon, 25 Oct 2021 20:29:14 +0000 (16:29 -0400)]
[libc][NFC] Remove extra space in libc/CMakeLists.txt

2 years ago[libc][NFC] Remove extra slash in path in libc/CMakeLists.txt
Joe Loser [Mon, 25 Oct 2021 20:26:20 +0000 (16:26 -0400)]
[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

2 years ago[docs][NewPM] Add example C++ code on how to actually use the new PM
Arthur Eubanks [Mon, 25 Oct 2021 18:46:17 +0000 (11:46 -0700)]
[docs][NewPM] Add example C++ code on how to actually use the new PM

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

2 years ago[LLVM] Inclusive terms: remove/replace references to sanity in RewriteStatepointsForG...
Zarko Todorovski [Mon, 25 Oct 2021 20:05:39 +0000 (16:05 -0400)]
[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

2 years ago[BasicAA] Add test for benign range overflow (NFC)
Nikita Popov [Mon, 25 Oct 2021 20:08:56 +0000 (22:08 +0200)]
[BasicAA] Add test for benign range overflow (NFC)

2 years ago[DomTree][NFC] Clean up nits in DomTree code
Jakub Kuderski [Mon, 25 Oct 2021 20:04:42 +0000 (16:04 -0400)]
[DomTree][NFC] Clean up nits in DomTree code

Reviewed By: nikic

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

2 years ago[ELF][X86] Support R_X86_64_PLTOFF64
Fangrui Song [Mon, 25 Oct 2021 20:05:17 +0000 (13:05 -0700)]
[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

2 years ago[ELF] Support 128-bit bitmask in oneof(RelExpr)
Fangrui Song [Mon, 25 Oct 2021 19:59:20 +0000 (12:59 -0700)]
[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

2 years ago[clangd] IncludeCleaner: Complicated rules for enum usage
Kirill Bobyrev [Mon, 25 Oct 2021 19:26:37 +0000 (21:26 +0200)]
[clangd] IncludeCleaner: Complicated rules for enum usage

Reviewed By: sammccall

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

2 years ago[ELF] Update comments/diagnostics for some long options to use the canonical two...
Fangrui Song [Mon, 25 Oct 2021 19:52:06 +0000 (12:52 -0700)]
[ELF] Update comments/diagnostics for some long options to use the canonical two-dash form

Rewrite some comments as appropriate.

2 years ago[mlir][Linalg] Allow comprehensive bufferization to use callbacks for alloc/dealloc.
MaheshRavishankar [Mon, 25 Oct 2021 16:00:05 +0000 (09:00 -0700)]
[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.

2 years ago[x86] add tests for vector -1 constant materialization; NFC
Sanjay Patel [Mon, 25 Oct 2021 14:43:04 +0000 (10:43 -0400)]
[x86] add tests for vector -1 constant materialization; NFC

2 years ago[ELF] Delete unneeded hack for discarding empty name local symbol
Fangrui Song [Mon, 25 Oct 2021 18:55:31 +0000 (11:55 -0700)]
[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.

2 years agoAdd modules stats into the "statistics dump" command.
Greg Clayton [Thu, 21 Oct 2021 23:01:00 +0000 (16:01 -0700)]
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

2 years ago[JITLink] Fix warning 'shift count exceeds width' in AArch64 backend
Stefan Gränitz [Mon, 25 Oct 2021 18:41:26 +0000 (20:41 +0200)]
[JITLink] Fix warning 'shift count exceeds width' in AArch64 backend

2 years ago[MLIR][Math] Add erf to math dialect
Boian Petkantchin [Mon, 25 Oct 2021 18:15:13 +0000 (18:15 +0000)]
[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

2 years ago[openmp] Emit deferred diag only when device compilation presents
Wei Wang [Thu, 2 Sep 2021 17:18:06 +0000 (10:18 -0700)]
[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

2 years ago[OpenMP] libomp: disable definitions of 5.1 atomics for non-x86 arch.
AndreyChurbanov [Mon, 25 Oct 2021 18:17:26 +0000 (21:17 +0300)]
[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

2 years ago[lldb] [DynamicRegisterInfo] Remove AddRegister() and make Finalize() protected
Michał Górny [Sat, 9 Oct 2021 19:22:51 +0000 (21:22 +0200)]
[lldb] [DynamicRegisterInfo] Remove AddRegister() and make Finalize() protected

Now that AddRegister() is no longer used, remove it.  While at it,
we can also make Finalize() protected as all supported API methods
call it internally.

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

2 years ago[lldb] [gdb-remote] Remove HardcodeARMRegisters() hack
Michał Górny [Sat, 9 Oct 2021 14:21:49 +0000 (16:21 +0200)]
[lldb] [gdb-remote] Remove HardcodeARMRegisters() hack

HardcodeARMRegisters() is a hack that was supposed to be used "until
we can get an updated debugserver down on the devices".  Since it was
introduced back in 2012, there is a good chance that the debugserver
has been updated at least once since then.  Removing this code makes
transition to the new DynamicRegisterInfo API easier.

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

2 years agotsan: add DynamicMutexSet helper
Dmitry Vyukov [Mon, 25 Oct 2021 13:53:22 +0000 (15:53 +0200)]
tsan: add DynamicMutexSet helper

MutexSet is too large to be allocated on stack.
But we need local MutexSet objects in few places
and use various hacks to allocate them.
Add DynamicMutexSet helper that simplifies allocation
of such objects.

Reviewed By: melver

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

2 years agomsan: disble CHECK test on powerpc64
Dmitry Vyukov [Mon, 25 Oct 2021 17:31:29 +0000 (19:31 +0200)]
msan: disble CHECK test on powerpc64

It seems that CHECK terminates the process with 0 status on powerpc64:
https://reviews.llvm.org/D112440#3084251
Disable the test for now.

Reviewed By: melver

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

2 years ago[mlir][sparse] lower trivial tensor.cast on identical sparse tensors
Aart Bik [Wed, 20 Oct 2021 19:47:31 +0000 (12:47 -0700)]
[mlir][sparse] lower trivial tensor.cast on identical sparse tensors

Even though tensor.cast is not part of the sparse tensor dialect,
it may be used to cast static dimension sizes to dynamic dimension
sizes for sparse tensors without changing the actual sparse tensor
itself. Those cases should be lowered properly when replacing sparse
tensor types with their opaque pointers. Likewise, no op sparse
conversions are handled by this revision in a similar manner.

Reviewed By: bixia

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

2 years agoAdd release notes for the LLDB impact from the array type name change
David Blaikie [Mon, 25 Oct 2021 17:17:44 +0000 (10:17 -0700)]
Add release notes for the LLDB impact from the array type name change

Changing the array type printing from `int [N]` to `int[N]` impacts lldb
pretty printer registration & may need to be updated to handle the
dropped space between type and dimensions.

2 years agoRemove referenced to deleted parallel-libs project
David Blaikie [Sat, 23 Oct 2021 16:56:37 +0000 (09:56 -0700)]
Remove referenced to deleted parallel-libs project

2 years ago[DebugInfo][InstrRef][NFC] Switch to using DenseMaps and similar
Jeremy Morse [Mon, 25 Oct 2021 16:50:53 +0000 (17:50 +0100)]
[DebugInfo][InstrRef][NFC] Switch to using DenseMaps and similar

There are a few STL containers hanging around that can become DenseMaps,
SmallVectors and similar. This recovers a modest amount of compile time
performance.

While I'm here, adjust the bit layout of ValueIDNum: this was always
supposed to act like a value type, however it seems that clang doesn't
compile the comparison functions to act that way. Add a uint64_t to a
union that explicitly aliases the bitfields, so that we can compare the
whole value as a single integer.

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

2 years ago[OPENMP51]Initial parsing/sema for append_args clause for 'declare variant'
Mike Rice [Thu, 14 Oct 2021 21:28:51 +0000 (14:28 -0700)]
[OPENMP51]Initial parsing/sema for append_args clause for 'declare variant'

Adds initial parsing and sema for the 'append_args' clause.

Note that an AST clause is not created as it instead adds its values
to the OMPDeclareVariantAttr.

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

2 years ago[fir][NFC] Format and make FIROps.td homogenous
Valentin Clement [Mon, 25 Oct 2021 16:35:21 +0000 (18:35 +0200)]
[fir][NFC] Format and make FIROps.td homogenous

This patch has couple of small changes to clean-up FIROps.td.
- Wrap lines that are longer than 80.
- All parser, verifier and printer that are single line are wrapped with double
  quotes.
- Couple of small typos.

Reviewed By: AlexisPerry

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

2 years ago[fir][NFC] Move MLIR includes to FIRDialect.td
Valentin Clement [Mon, 25 Oct 2021 16:33:00 +0000 (18:33 +0200)]
[fir][NFC] Move MLIR includes to FIRDialect.td

The fir_Dialect definition was coming silently through FIRTypes.td.
Make the include of flang/Optimizer/Dialect/FIRDialect.td explicit in
FIROps.td and move MLIR includes to FIRDialect.td.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: AlexisPerry

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[WebAssembly] support Memory64 in target_features section
Wouter van Oortmerssen [Thu, 21 Oct 2021 20:44:54 +0000 (13:44 -0700)]
[WebAssembly] support Memory64 in target_features section

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

2 years ago[DebugInfo][InstrRef] Recover stack-slot tracking performance
Jeremy Morse [Mon, 25 Oct 2021 16:21:35 +0000 (17:21 +0100)]
[DebugInfo][InstrRef] Recover stack-slot tracking performance

This patch is like D111627 -- instead of calculating IDF for every location
on the stack, only do it for the smallest units of interference, and copy
the PHIs for those units to any aliases.

The test added runs placeMLocPHIs directly, and tests that:
 * A def of the lower 8 bits of a stack slot causes all aliasing regs to
   have PHIs placed,
 * It doesn't cause the equivalent location to x86's $ah, which isn't
   aliased, to have a PHI placed.

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

2 years ago[RISCV] Remove always_inline and nodebug attributes from RISCV vector intrinsic header.
Craig Topper [Mon, 25 Oct 2021 16:28:56 +0000 (09:28 -0700)]
[RISCV] Remove always_inline and nodebug attributes from RISCV vector intrinsic header.

I don't think these are needed with the way builtin_alias is
implemented.

2 years ago[indvars] Fix pr52276 (missing one use check)
Philip Reames [Mon, 25 Oct 2021 16:25:00 +0000 (09:25 -0700)]
[indvars] Fix pr52276 (missing one use check)

The recently added logic to canonicalize exit conditions to unsigned relies on facts which hold about the use (i.e. exit test).  Applying this blindly to the icmp is not legal, as there may be another use which never reaches the exit.  Restrict ourselves to case where we have a single use.

2 years ago[OpenMP][OMPT] thread_num determination during execution of nested serialized paralle...
Vladimir Inđić [Mon, 25 Oct 2021 16:16:09 +0000 (18:16 +0200)]
[OpenMP][OMPT] thread_num determination during execution of nested serialized parallel regions

__ompt_get_task_info_internal function is adapted to support thread_num
determination during the execution of multiple nested serialized
parallel regions enclosed by a regular parallel region.

Consider the following program that contains parallel region R1 executed
by two threads. Let the worker thread T of region R1 executes serialized
parallel regions R2 that encloses another serialized parallel region R3.
Note that the thread T is the master thread of both R2 and R3 regions.

Assume that __ompt_get_task_info_internal function is called with the
argument "ancestor_level == 1" during the execution of region R3.
The function should determine the "thread_num" of the thread T inside
the team of region R2, whose implicit task is at level 1 inside the
hierarchy of active tasks. Since the thread T is the master thread of
region R2, one should expected that "thread_num" takes a value 0.
After the while loop finishes, the following stands: "lwt != NULL",
"prev_lwt == NULL", "prev_team" represents the team information about
the innermost serialized parallel region R3. This results in executing
the assignment "thread_num = prev_team->t.t_master_tid". Note that
"prev_team->t.t_master_tid" was initialized at the moment of
R2’s creation and represents the "thread_num" of the thread T inside
the region R1 which encloses R2. Since the thread T is the worker thread
of the region R1, "the thread_num" takes value 1, which is a contradiction.

This patch proposes to use "lwt" instead of "prev_lwt" when determining
the "thread_num". If "lwt" exists, the task at the requested level belongs
to the serialized parallel region. Since the serialized parallel region
is executed by one thread only, the "thread_num" takes value 0.

Similarly, assume that __ompt_get_task_info_internal function is called
with the argument "ancestor_level == 2" during the execution of region R3.
The function should determine the "thread_num" of the thread T inside the
team of region R1. Since the thread is the worker inside the region R1,
one should expected that "thread_num" takes value 1. After the loop finishes,
the following stands: "lwt == NULL", "prev_lwt != NULL", "prev_team" represents
the team information about the innermost serialized parallel region R3.
This leads to execution of the assignment "thread_num = 0", which causes
a contradiction.

Ignoring the "prev_lwt" leads to executing the assignment
"thread_num = prev_team->t.t_master_tid" instead. From the previous explanation,
it is obvious that "thread_num" takes value 1.

Note that the "prev_lwt" variable is marked as unnecessary and thus removed.

This patch introduces the test case which represents the OpenMP program
described earlier in the summary.

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

2 years ago[OpenMP][OMPT][clang] task frame support fixed in __kmpc_fork_call
Vladimir Inđić [Mon, 25 Oct 2021 11:58:57 +0000 (13:58 +0200)]
[OpenMP][OMPT][clang] task frame support fixed in __kmpc_fork_call

__kmp_fork_call sets the enter_frame of the active task (th_curren_task)
before new parallel region begins. After the region is finished, the
enter_frame is cleared.

The old implementation of __kmpc_fork_call didn’t clear the enter_frame of
active task.

Also, the way of initializing the enter_frame of the active task was wrong.
Consider the following two OpenMP programs.

The first program: Let R1 be the serialized parallel region that encloses
another serialized parallel region R2. Assume that thread that executes R2 is
going to create a new serialized parallel region R3 by executing
__kmpc_fork_call. This thread is responsible to set enter_frame of R2's
implicit task. Note that the information about R2's implicit task is present
inside master_th->th.th_current_task at this moment, while lwt represents the
information about R1's implicit task. The old implementation uses lwt and
resets enter_frame of R1's implicit task instead of R2's implicit task. The
new implementation uses master_th->th.th_current_task instead.

The second program: Consider the OpenMP program that contains parallel region
R1 which encloses an explicit task T. Assume that thread should create another
parallel region R2 during the execution of the T. The __kmpc_fork_call is
responsible to create R2 and set enter frame of T whose information is present
inside the master_th->th.th_current_task.
Old implementation tries to set the frame of
parent_team->t.t_implicit_task_taskdata[tid] which corresponds to the implicit
task of the R1, instead of T.

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

2 years ago[OpenMP][Tests] Test omp_get_wtime for invariants
Joachim Protze [Mon, 25 Oct 2021 15:01:49 +0000 (17:01 +0200)]
[OpenMP][Tests] Test omp_get_wtime for invariants

As discussed in D108488, testing for invariants of omp_get_wtime would be more
reliable than testing for duration of sleep, as return from sleep might be
delayed due to system load.

Alternatively/in addition, we could compare the time measured by omp_get_wtime
 to time measured with C++11 chrono (for portability?).

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

2 years ago[OpenMP][Tests][NFC] Actually check for test outcome
Joachim Protze [Mon, 25 Oct 2021 15:44:39 +0000 (17:44 +0200)]
[OpenMP][Tests][NFC] Actually check for test outcome

The CHECK: line in the test had no effect, because the test does not
pipe to FileCheck. Since the test only checks for a single value,
encode the result in the return value of the test.

2 years ago[OpenMP][Tests][NFC] Mark tests trying to link COI as unsupported
Joachim Protze [Mon, 25 Oct 2021 14:10:14 +0000 (16:10 +0200)]
[OpenMP][Tests][NFC] Mark tests trying to link COI as unsupported

For some tests with target-related functionality icc 18/19 tries to link
libioffload_target.so.5, which fails for missing COI symbols.

2 years ago[OpenMP][Tests][NFC] Replace atomic increment by reduction
Joachim Protze [Mon, 25 Oct 2021 14:02:31 +0000 (16:02 +0200)]
[OpenMP][Tests][NFC] Replace atomic increment by reduction

Also mark the test as unsupported by intel-21, because the test does
not terminate

2 years ago[OpenMP][Tools][NFC] Fix C99-style declaration of iteration variables
Joachim Protze [Mon, 25 Oct 2021 13:27:38 +0000 (15:27 +0200)]
[OpenMP][Tools][NFC] Fix C99-style declaration of iteration variables

Where possible change to declare the variable before the loop.
Where not possible, specifically request -std=c99 (could be limited to
specific compilers like icc).

2 years ago[OpenMP][Tools][NFC] Pass intel license ENV to lit
Joachim Protze [Mon, 25 Oct 2021 13:24:09 +0000 (15:24 +0200)]
[OpenMP][Tools][NFC] Pass intel license ENV to lit

2 years ago[lldb] Modernize and expand TestCppBitfields
Raphael Isemann [Mon, 25 Oct 2021 15:44:02 +0000 (17:44 +0200)]
[lldb] Modernize and expand TestCppBitfields

* clang-format test source.
* Removed the dead setup code.
* Using expect_expr etc. instead of raw expect.
* Slightly expanded with tests for vtable pointers (which mostly just crash atm.)
* Removed some other minor test guideline problems.

2 years ago[clang] Use llvm::{count,count_if,find_if,all_of,none_of} (NFC)
Kazu Hirata [Mon, 25 Oct 2021 16:14:45 +0000 (09:14 -0700)]
[clang] Use llvm::{count,count_if,find_if,all_of,none_of} (NFC)

2 years ago[RISCV] Reduce the number of RISCV vector builtins by an order of magnitude.
Craig Topper [Mon, 25 Oct 2021 15:56:43 +0000 (08:56 -0700)]
[RISCV] Reduce the number of RISCV vector builtins by an order of magnitude.

All but 2 of the vector builtins are only used by clang_builtin_alias.
When using clang_builtin_alias, the type string of the builtin is never
checked. Only the types in the function definition used for the alias
are checked.

This patch takes advantage of this to share a single builtin for
many different types. We already used type overloads on the IR intrinsic
so the codegen for the builtins that are being merge were already
the same. This extends the type overloading to the builtins.

I had to make a few tweaks to make this work.
-Floating point vector-vector vmerge now uses the vmerge intrinsic
 instead of the vfmerge intrinsic. New isel patterns and tests are
 added to support this.
-The SemaChecking for the immediate of vset_v/vget_v has been removed.
 Determining the valid range is harder now. I've added masking to
 ManualCodegen to ensure valid IR for invalid input.

This reduces the number of builtins from ~25000 to ~1100.

Reviewed By: HsiangKai

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

2 years ago[BasicAA] Add test for incorrect non-negative logic (NFC)
Nikita Popov [Mon, 25 Oct 2021 16:01:03 +0000 (18:01 +0200)]
[BasicAA] Add test for incorrect non-negative logic (NFC)

2 years agoRevert "[mlir][Linalg] Allow comprehensive bufferization to use callbacks for alloc...
MaheshRavishankar [Mon, 25 Oct 2021 15:56:31 +0000 (08:56 -0700)]
Revert "[mlir][Linalg] Allow comprehensive bufferization to use callbacks for alloc/dealloc."

This reverts commit c86f218fe4ca661a4348d20b66210324224870e8.

Revert because it causes build failure.

2 years ago[RISCV] Add vcsr CSR name for V extension.
Craig Topper [Mon, 25 Oct 2021 15:49:58 +0000 (08:49 -0700)]
[RISCV] Add vcsr CSR name for V extension.

Reviewed By: frasercrmck, kito-cheng

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

2 years ago[CodeGen] Fix dependence breaking for tied operands
Danila Malyutin [Thu, 5 Aug 2021 16:53:58 +0000 (19:53 +0300)]
[CodeGen] Fix dependence breaking for tied operands

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

2 years ago[mlir][Linalg] Allow comprehensive bufferization to use callbacks for alloc/dealloc.
MaheshRavishankar [Mon, 25 Oct 2021 05:30:10 +0000 (22:30 -0700)]
[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.

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

2 years ago[DebugInfo] Follow up to ee3eee71e, x86 tests need an x86 triple
Jeremy Morse [Mon, 25 Oct 2021 15:43:50 +0000 (16:43 +0100)]
[DebugInfo] Follow up to ee3eee71e, x86 tests need an x86 triple

2 years ago[lldb] Remove a trailing \0 from the result of HostInfoMacOSX::GetOSBuildString
Pavel Labath [Mon, 25 Oct 2021 15:33:06 +0000 (17:33 +0200)]
[lldb] Remove a trailing \0 from the result of HostInfoMacOSX::GetOSBuildString

This has been in there since forever, but only started to matter once
40e4ac3e changed how we print the string.

2 years ago[libc++][NFC] Remove unimplemented parts of chrono synopsis
Joe Loser [Mon, 25 Oct 2021 15:15:33 +0000 (11:15 -0400)]
[libc++][NFC] Remove unimplemented parts of chrono synopsis

Several parts in the `chrono` synopsis for C++20 are not yet
implemented. The current recommendation is that things are added to the
synopsis when implemented -- not beforehand. As such, remove the
not-yet-implemented parts to avoid confusion.

Reviewed By: ldionne, Quuxplusone, #libc

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

2 years ago[libc++] LWG3001: add `remove_extent_t` to `weak_ptr::element_type`.
Konstantin Varlamov [Mon, 25 Oct 2021 15:15:38 +0000 (11:15 -0400)]
[libc++] LWG3001: add `remove_extent_t` to `weak_ptr::element_type`.

Also fix a few places in the `shared_ptr` implementation where
`element_type` was passed to the `__is_compatible` helper. This could
result in `remove_extent` being applied twice to the pointer's template
type (first by the definition of `element_type` and then by the helper),
potentially leading to somewhat less readable error messages for some
incorrect code.

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

2 years ago[HIP][OpenMP] Fix assertion in deferred diag
Yaxun (Sam) Liu [Thu, 21 Oct 2021 16:59:49 +0000 (12:59 -0400)]
[HIP][OpenMP] Fix assertion in deferred diag

Fix assertion in UsedDeclVisitor where clang is trying to look up a destructor
for a forward declared class.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=52250

Reviewed by: Artem Belevich, John McCall

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

2 years ago[libc++] Include revision numbers in the paper status lists
Louis Dionne [Fri, 22 Oct 2021 19:08:46 +0000 (15:08 -0400)]
[libc++] Include revision numbers in the paper status lists

Several of our C++20 and C++2b papers were missing the actual revision
number that was voted in to the Standard. The revision number is quite
important because in a few cases, a paper has a revision *after* the
one that is voted into the Standard, which isn't voted into the Standard.
Hence, if we simply followed the wg21.link blindly and implemented that,
we'd end up implementing the latest revision of the paper, which might
not have been voted.

As a fly-by fix, I found out that P1664 had been withdrawn from the
straw polls and had never been voted into the Standard. This commit
removes that entry from our list.

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

2 years ago[lldb] [Host/ConnectionFileDescriptor] Do not use non-blocking mode
Michał Górny [Mon, 25 Oct 2021 12:32:56 +0000 (14:32 +0200)]
[lldb] [Host/ConnectionFileDescriptor] Do not use non-blocking mode

Disable non-blocking mode that's enabled only for file:// and serial://
protocols.  All read operations should be going through the select(2)
in ConnectionFileDescriptor::BytesAvaliable, which effectively erases
(non-)blocking mode differences in reading.  We do want to perform
writes in the blocking mode.

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

2 years ago[DebugInfo][InstrRef] Track values fused into stack spills
Jeremy Morse [Mon, 25 Oct 2021 14:09:42 +0000 (15:09 +0100)]
[DebugInfo][InstrRef] Track values fused into stack spills

During register allocation, some instructions can have stack spills fused
into them. It means that when vregs are allocated on the stack we can
convert:

    SETCCr %0
    DBG_VALUE %0

to

    SETCCm %stack.0
    DBG_VALUE %stack.0

Unfortunately instruction referencing finds this harder: a store to the
stack doesn't have a specific operand number, therefore we don't substitute
the old operand for a new operand, and the location is dropped. This patch
implements a solution: just recognise the memory operand attached to an
instruction with a Special Number (TM), and record a substitution between
the old value and the new one.

This patch adds substitution code to InlineSpiller to record such fused
spills, and tracking in InstrRefBasedLDV to recognise such values, and
produce the value numbers for them. Everything to do with the movement of
stack-defined values is already handled in InstrRefBasedLDV.

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