Commit Graph

427085 Commits

Author SHA1 Message Date
Jonas Devlieghere 6cde6ac03c
[lldb] Don't overwrite quit and exit builtins in the Python interpreter
The interactive interpreter is overwriting the exit and quit builtins
with an instance of LLDBQuitter in order to make exit and quit behave
like exit() and quit(). It does that by overwriting the __repr__
function to call itself.

Despite being a neat trick, it has the unintentional side effect that
printing these builtins now quits the interpreter:

  (lldb) script
  Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
  >>> print(exit)
  (lldb)

You might consider the above example slightly convoluted, but a more
realistic situation is calling locals():

  (lldb) script
  Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
  >>> locals()
  (lldb)

This patch keeps the existing behavior but without overwriting the
builtins. Instead, it looks for quit and exit in the input. If they're
present, we exit the interpreter with the help of an exception.

The previous implementation also used globals to differentiate between
exit getting called from the interactive interpreter or from inside a
script. This patch achieves the same by using a different exception in
for the interpreter case.

rdar://84095490

Differential revision: https://reviews.llvm.org/D127895
2022-06-15 14:53:40 -07:00
Okwan Kwon f4ad203930 [mlir] create PrintOpStatsPass using printAsJSON
This was missed by the previous commit in OpStats.cpp.
2022-06-15 14:49:54 -07:00
Peter Klausler 690de85ed8 [flang][runtime] Better error message for mis-ASSIGN'ed FORMAT
When an I/O data transfer statement uses an ASSIGN'ed FORMAT that
has not been ASSIGN'ed to a FORMAT statement, the runtime receives
a zero-length format string.  Distinguish this case from the general
error message about missing parentheses.

Differential Revision: https://reviews.llvm.org/D127797
2022-06-15 14:46:22 -07:00
Nico Weber 307109266f unbreak Modules/cxx20-export-import.cpp with LLVM_APPEND_VC_REV=OFF after 45d88cd008
See revision b8b7a9dcdc for prior art.
2022-06-15 17:42:35 -04:00
Peter Klausler eb6cd7fe31 [flang] ERROR STOP is not an image control statement
The predicate that determines image control statements needs
to distinguish STOP (which is) from ERROR STOP (which isn't).

Differential Revision: https://reviews.llvm.org/D127796
2022-06-15 14:39:31 -07:00
Chelsea Cassanova 3ba71f1be1 Reland "[lldb/Fuzzer] Create ninja target for target fuzzer"
This reverts commit b10579d0b5.

Make sure that the lldb-target-fuzzer exists before adding the
custom fuzz-lldb-target.
2022-06-15 17:37:38 -04:00
Min-Yih Hsu cd8978e19e [mlir][LLVMIR] Ask ICmpOp to return vector<Nxi1> when needed
If any of the operands for ICmpOp is a vector, returns a vector<Nxi1>
, rather than an i1 type result.

Differential Revision: https://reviews.llvm.org/D127536
2022-06-15 14:33:48 -07:00
Min-Yih Hsu 719e24d39f [mlir][LLVMIR] Use isScalableVectorType in ShuffleVectorOp::parse
Instead of casting the incoming operand into VectorType to check if it's
scalable or not.
This is the place I missed to fix in f088b99eac.

Differential Revision: https://reviews.llvm.org/D127535
2022-06-15 14:33:48 -07:00
Min-Yih Hsu dcdd5d312f [mlir][LLVMIR] Use insertelement if needed when translating ConstantAggregate
When translating from a llvm::ConstantAggregate with vector type, we
should lower to insertelement operations (if needed) rather than using
insertvalue.

Differential Revision: https://reviews.llvm.org/D127534
2022-06-15 14:33:47 -07:00
Peter Klausler db6c3ecd2c [flang][runtime] Make NCOPIES= argument of REPEAT a signed integer, & check it
NCOPIES= is currently a std::size_t in the API.  If a negative value is
used, the memory allocation will fail.  Change it to be a signed integer,
and crash with a message instead if it be negative.

Differential Revision: https://reviews.llvm.org/D127795
2022-06-15 14:29:17 -07:00
Peter Klausler 1a3ac58667 [flang][runtime] Fix handling of output FORMAT('x' 'y')
I'm emitting "x'y" because the space-separated apostrophes are
misinterpreted as being adjacent repeated quotation marks.
Fix to ensure no space skipping is applied when checking for
repeated quotation marks.

Differential Revision: https://reviews.llvm.org/D127792
2022-06-15 14:23:02 -07:00
Peter Klausler bcad53e131 [flang] Add more qualification when creating names for compiler-generated USEs
When generic resolution finds its specific procedure in a module,
and that specific procedure is not use-associated into the local scope
(perhaps because it was PRIVATE, perhaps because the generic was
use-associated with ONLY:), we create a new use-association with
a renaming.  The name constructed for this renaming needs to be
additionally qualified with the module name of the specific procedure
in order to avoid clashing with another specific of the same name
that may have previously been use-associated in the same way from
a distinct module.

Differential Revision: https://reviews.llvm.org/D127790
2022-06-15 14:18:28 -07:00
Peter Klausler f6253eb9ba [flang][runtime] Fix INQUIRE(POS=n) for non-advancing I/O
Position inquiries need to account for offsets in records to be
accurate in the case of non-advancing I/O.

Differential Revision: https://reviews.llvm.org/D127789
2022-06-15 14:14:06 -07:00
Peter Klausler 8ef1075381 [flang][runtime] Signal END from character input
There's code in EditCharacterInput() that causes that template function
to silently return false if it is invoked at the end of the input file.
This overrides other checks that properly call SignalEnd() later.

Differential Revision: https://reviews.llvm.org/D127786
2022-06-15 14:12:38 -07:00
Sam Clegg 78747bd39a [clang][WebAssembly] Loosen restriction on `main` symbol mangling
Remove the `hasPrototype()` restriction so that old style K&R
declarations of main work too.

For example the following has 2 params but no prototype.

```
int main(argc, argv)
    int argc;
    char *argv[];
{
  return 0;
}
```

Also, use `getNumParams()` over `param_size()` which seems to be a more
direct way to get at the same information.

Also, add missing tests for this mangling.

Differential Revision: https://reviews.llvm.org/D127888
2022-06-15 13:56:05 -07:00
Walter Erquinigo b97b082c5a Fix failures
https://lab.llvm.org/buildbot/#/builders/17/builds/23269 breaks because
we are doing some asm calls that only work on x86

https://lab.llvm.org/buildbot/#/builders/68/builds/34092/steps/6/logs/stdio
breaks because some comparators where being done incorrectly.
2022-06-15 13:54:04 -07:00
Peter Klausler 6963fb7dfb [flang][runtime] Fix REWIND after non-advancing data transfer
A REWIND of a unit that's in the middle of a record due to a READ
or WRITE statement with ADVANCE='NO' needs to reset the left tab
limit so that the next transfer takes place at the beginning of
the first record.

Differential Revision: https://reviews.llvm.org/D127783
2022-06-15 13:40:49 -07:00
Fangrui Song c418d0f1be [Driver] Simplify -fno-builtin- handling. NFC 2022-06-15 13:35:08 -07:00
Ben Langmuir 509223da61 [clang][deps] Further canonicalize implicit modules options in dep scan
Disable or canonicalize compiler options that are not relevant in
explicit module builds, similar to what we already did for the modules
cache path. This reduces uninteresting differences between
command-lines, which is particularly useful if there is a tool that can
cache the compilations.

Differential Revision: https://reviews.llvm.org/D127883
2022-06-15 13:29:47 -07:00
Nikolas Klauser afd5a4f2dc [libc++] Implement ranges::lexicographical_compare
Reviewed By: var-const, Mordante, #libc

Spies: H-G-Hristov, sstefan1, libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D127130
2022-06-15 22:29:21 +02:00
Walter Erquinigo fc5ef57c7d [trace][intelpt] Support system-wide tracing [12] - Support multi-core trace load and save
:q!
This diff is massive, but it's because it connects the client with lldb-server
and also ensures that the postmortem case works.

- Flatten the postmortem trace schema. The reason is that the schema has become quite complex due to the new multicore case, which defeats the original purpose of having a schema that could work for every trace plug-in. At this point, it's better that each trace plug-in defines it's own full schema. This means that the only common field is "type".
-- Because of this new approach, I merged the "common" trace load and saving functionalities into the IntelPT one. This simplified the code quite a bit. If we eventually implement another trace plug-in, we can see then what we could reuse.
-- The new schema, which is flattened, has now better comments and is parsed better. A change I did was to disallow hex addresses, because they are a bit error prone. I'm asking now to print the address in decimal.
-- Renamed "intel" to "GenuineIntel" in the schema because that's what you see in /proc/cpuinfo.
- Implemented reading the context switch trace data buffer. I had to do
some refactors to do that cleanly.
-- A major change that I did here was to simplify the perf_event circular buffer reading logic. It was too complex. Maybe the original Intel author had something different in mind.
- Implemented all the necessary bits to read trace.json files with per-core data.
- Implemented all the necessary bits to save to disk per-core trace session.
- Added a test that ensures that parsing and saving to disk works.

Differential Revision: https://reviews.llvm.org/D126015
2022-06-15 13:28:36 -07:00
Arthur Eubanks bab0910f77 [gn build] Add missing BLAKE3 dependency 2022-06-15 13:16:40 -07:00
Peter Klausler 142db43b62 [flang][runtime] Allow recovery from BACKSPACE(badUnit)
When an unconnected unit number is used in a BACKSPACE statement
with ERR=, IOSTAT=, &/or IOMSG= control specifiers, don't crash,
but let the program deal with the error.

Differential Revision: https://reviews.llvm.org/D127782
2022-06-15 13:00:54 -07:00
owenca 2d82c9ccf3 [clang-format][NFC] Fix braces in ClangFormat.cpp
Differential Revision: https://reviews.llvm.org/D127827
2022-06-15 12:57:48 -07:00
Stella Stamenova b10579d0b5 Revert "[lldb/Fuzzer] Create ninja target for target fuzzer"
This reverts commit f3250da1b9.

This broke the windows lldb bot: https://lab.llvm.org/buildbot/#/builders/83/builds/19988 and likely others.
2022-06-15 12:40:33 -07:00
Aaron Ballman 10822857b7 Rolling back tests for WG14 DR145
Several build bots are failing with surprising behavior, so it's less
clear whether we do or don't implement this DR properly.

https://lab.llvm.org/buildbot/#/builders/91/builds/10454
https://lab.llvm.org/buildbot/#/builders/109/builds/40668
https://lab.llvm.org/buildbot/#/builders/139/builds/23334
2022-06-15 15:37:14 -04:00
Aaron Ballman 61a649ca35 Update the status of more C DRs
This adds information for DRs 126 through 146.
2022-06-15 15:25:47 -04:00
Amy Kwan 34033a84b8 [PowerPC] Skip combine for vector_shuffles when two scalar_to_vector nodes are different vector types.
Currently in `combineVectorShuffle()`, we update the shuffle mask if either
input vector comes from a scalar_to_vector, and we keep the respective input
vectors in its permuted form by producing PPCISD::SCALAR_TO_VECTOR_PERMUTED.
However, it is possible that we end up in a situation where both input vectors
to the vector_shuffle are scalar_to_vector, and are different vector types.
In situations like this, the shuffle mask is updated incorrectly as the current
code assumes both scalar_to_vector inputs are the same vector type.

This patch skips the combines for vector_shuffle if both input vectors are
scalar_to_vector, and if they are of different vector types. A follow up patch
will focus on fixing this issue afterwards, in order to correctly update the
shuffle mask.

Differential Revision: https://reviews.llvm.org/D127818
2022-06-15 14:12:18 -05:00
Okwan Kwon 85f19f99e4 [mlir] add createPrintOpStatsPass() with explicit params
This allows to set printAsJSON through the create function.

Differential Revision: https://reviews.llvm.org/D127891
2022-06-15 12:09:59 -07:00
Walter Erquinigo a0a46473c3 [trace][intelpt] Support system-wide tracing [11] - Read warnings and perf conversion in the client
- Add logging for when the live state of the process is refreshed
- Move error handling of the live state refreshing to Trace from TraceIntelPT. This allows refreshing to fail either at the plug-in level or at the base class level. The error is cached and it can be gotten every time RefreshLiveProcessState is invoked.
- Allow DoRefreshLiveProcessState to handle plugin-specific parameters.
- Add some encapsulation to prevent TraceIntelPT from accessing variables belonging to Trace.

Test done via logging:

```
(lldb) b main
Breakpoint 1: where = a.out`main + 20 at main.cpp:27:20, address = 0x00000000004023d9
(lldb) r
Process 2359706 launched: '/home/wallace/a.out' (x86_64)
Process 2359706 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x00000000004023d9 a.out`main at main.cpp:27:20
   24   };
   25
   26   int main() {
-> 27     std::vector<int> vvv;
   28     for (int i = 0; i < 100000; i++)
   29       vvv.push_back(i);
   30
(lldb) process trace start                                                                                        (lldb) log enable lldb target -F(lldb) n
Process 2359706 stopped
* thread #1, name = 'a.out', stop reason = step over
    frame #0: 0x00000000004023e8 a.out`main at main.cpp:28:12
   25
   26   int main() {
   27     std::vector<int> vvv;
-> 28     for (int i = 0; i < 100000; i++)
   29       vvv.push_back(i);
   30
   31     std::deque<int> dq1 = {1, 2, 3};
(lldb) thread trace dump instructions -c 2 -t                                                                     Trace.cpp:RefreshLiveProcessState                            Trace::RefreshLiveProcessState invoked
TraceIntelPT.cpp:DoRefreshLiveProcessState                   TraceIntelPT found tsc conversion information
thread #1: tid = 2359706
  a.out`std::vector<int, std::allocator<int>>::vector() + 26 at stl_vector.h:395:19
    54: [tsc=unavailable] 0x0000000000403a7c    retq
```

See the logging lines at the end of the dump. They indicate that refreshing happened and that perf conversion information was found.

Differential Revision: https://reviews.llvm.org/D125943
2022-06-15 12:08:00 -07:00
Walter Erquinigo 1f2d49a8e7 [trace][intelpt] Support system-wide tracing [10] - Return warnings and tsc information from lldb-server.
- Add a warnings field in the jLLDBGetState response, for warnings to be delivered to the client for troubleshooting. This removes the need to silently log lldb-server's llvm::Errors and not expose them easily to the user
- Simplify the tscPerfZeroConversion struct and schema. It used to extend a base abstract class, but I'm doubting that we'll ever add other conversion mechanisms because all modern kernels support perf zero. It is also the one who is supposed to work with the timestamps produced by the context switch trace, so expecting it is imperative.
- Force tsc collection for cpu tracing.
- Add a test checking that tscPerfZeroConversion is returned by the GetState request
- Add a pre-check for cpu tracing that makes sure that perf zero values are available.

Differential Revision: https://reviews.llvm.org/D125932
2022-06-15 12:08:00 -07:00
Walter Erquinigo a758205951 [trace][intelpt] Support system-wide tracing [9] - Collect and return context switch traces
- Add collection of context switches per cpu grouped with the per-cpu intel pt traces.
- Move the state handling from the interl pt trace class to the PerfEvent one.
- Add support for stopping and enabling perf event groups.
- Return context switch entries as part of the jLLDBTraceGetState response.
- Move the triggers of whenever the process stopped or resumed. Now the will-resume notification is in a better location, which will ensure that we'll capture the instructions that will be executed.
- Remove IntelPTSingleBufferTraceUP. The unique pointer was useless.
- Add unit tests

Differential Revision: https://reviews.llvm.org/D125897
2022-06-15 12:07:59 -07:00
Walter Erquinigo 5a92632dc4 [trace][intelpt] Support system-wide tracing [8] - Improve the single buffer perf_event configuration
We were setting some events to be written in the data buffer of the
perf_event, but we don't need that.

Besides that, we don't need the data buffer to be larger than 1, so we
can reduce its size.

Differential Revision: https://reviews.llvm.org/D125850
2022-06-15 12:07:59 -07:00
Walter Erquinigo 1f56f7fc16 [trace][intelpt] Support system-wide tracing [7] - Create a base IntelPTProcessTrace class
We have two different "process trace" implementations: per thread and per core. As a way to simplify the collector who uses both, I'm creating a base abstract class that is used by these implementations. This effectively simplify a good chunk of code.

Differential Revision: https://reviews.llvm.org/D125503
2022-06-15 12:07:59 -07:00
David Goldman bc1f24332a [clangd] Improve ObjC protocol suggestions from the index
When querying the index during an ObjC protocol name lookup for code
completion, we should only suggest ObjC protocols.

Differential Revision: https://reviews.llvm.org/D127125
2022-06-15 15:02:37 -04:00
Chelsea Cassanova f3250da1b9 [lldb/Fuzzer] Create ninja target for target fuzzer
Create a ninja target for running the LLDB target fuzzer.
Currently the ninja target for the fuzzer will build the fuzzer without
running it. This allows the fuzzer to be built and run.

Differential revision: https://reviews.llvm.org/D127882
2022-06-15 14:55:43 -04:00
Michael Jones ad233c6047 [libc] add printf
This patch adds the entrypoint for printf. With this, building a
"hello world" program with just LLVM-libc is possible.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D126831
2022-06-15 11:45:38 -07:00
Michael Jones 2e6eccfe34 [libc] refactor printf file writing
Add return values to converter functions to allow for better error
handling when writing files. Also move the file writing code around to
be easier to read.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D127773
2022-06-15 11:45:36 -07:00
Jacques Pienaar 02e32708bd [mlir][bzl] Export textmate grammar file 2022-06-15 11:28:43 -07:00
Petr Hosek 55ba0830e4 [Clang] Let the linker choose shared or static libunwind unless specified
We shouldn't assume that libunwind.so is available. Rather can defer
the decision to the linker which defaults to libunwind.so, but if .so
isn't available, it'd pick libunwind.a. Users can use -static-libgcc
and -shared-libgcc to override this behavior and explicitly choose
the version they want.

Differential Revision: https://reviews.llvm.org/D127528
2022-06-15 18:22:13 +00:00
Benjamin Kramer 8c4a07c61f [DAGCombiner] Fold fold (fp_to_bf16 (bf16_to_fp op)) -> op 2022-06-15 19:54:39 +02:00
Jin Xin Ng aaff3fb6d5 [mlgo] Fix accounting for SCC splits
Previously if the inliner split an SCC such that an empty one remained, the MLInlineAdvisor could potentially lose track of the EdgeCount if a subsequent CGSCC pass modified the calls of a function that was initially in the SCC pre-split. Saving the seen nodes in onPassEntry resolves this.

Reviewed By: mtrofin

Differential Revision: https://reviews.llvm.org/D127693
2022-06-15 10:53:23 -07:00
Florian Hahn 5ff5b460d9
[LV] Remove unneeded CustomBuilder arg from setDebugLocFromInst (NFC).
The only user that passed in a custom builder was passing in
VPTransformState::Builder, which is the same as ILV::Builder.
2022-06-15 18:48:02 +01:00
Fangrui Song 103b28902f [llvm-profdata][test] Change -Wl,-no-pie to -no-pie after D127808
The driver option -no-pie is preferred: Clang selects different crt*.o files,
though the PIC one usually can replace the non-PIC one.
2022-06-15 10:46:37 -07:00
Thomas Raoux a6f2c2291e [mlir][GPUToNVVM] Fix bug in mma elementwise lowering
The maxf implementation of wmma elementwise op was incorrect as the
operands of the select to check for Nan were swapped.

Differential Revision: https://reviews.llvm.org/D127879
2022-06-15 17:23:17 +00:00
Simon Pilgrim 4204361fed [X86] X86InstrInfo.cpp - fix signed/unsigned promotion warnings in addImm calls
addImm takes a int64_t arg but we were using uint64_t types
2022-06-15 18:21:43 +01:00
Mitch Phillips 45d88cd008 [clang] Add -fsanitize=memtag-globals (no-op).
Adds the -fsanitize plumbing for memtag-globals. Makes -fsanitize=memtag
imply -fsanitize=memtag-globals.

This has no effect on codegen for now.

Reviewed By: eugenis, aaron.ballman

Differential Revision: https://reviews.llvm.org/D127163
2022-06-15 10:07:53 -07:00
Okwan Kwon 8010d7e044 [mlir] add an option to print op stats in JSON
Differential Revision: https://reviews.llvm.org/D127691
2022-06-15 10:07:36 -07:00
Quinn Pham 335e8bf100 [PowerPC] emit VSX instructions instead of VMX instructions for vector loads and stores
This patch changes the PowerPC backend to generate VSX load/store instructions
for all vector loads/stores on Power8 and earlier  (LE) instead of VMX
load/store instructions. The reason for this change is because VMX instructions
require the vector to be 16-byte aligned. So, a vector load/store will fail with
VMX instructions if the vector is misaligned. Also, `gcc` generates VSX
instructions in this situation which allow for unaligned access but require a
swap instruction after loading/before storing. This is not an issue for BE
because we already emit VSX instructions since no swap is required. And this is
not an issue on Power9 and up since we have access to `lxv[x]`/`stxv[x]` which
allow for unaligned access and do not require swaps.

This patch also delays the VSX load/store for LE combines until after
LegalizeOps to prioritize other load/store combines.

Reviewed By: #powerpc, stefanp

Differential Revision: https://reviews.llvm.org/D127309
2022-06-15 12:06:04 -05:00
Rob Suderman 640973f2b9 [tosa] Lower tosa.slice to tensor.slice for dynamic case
Existing slice lowering only supporting static shapes.

Reviewed By: NatashaKnk

Differential Revision: https://reviews.llvm.org/D127704
2022-06-15 09:54:36 -07:00