Commit Graph

424241 Commits

Author SHA1 Message Date
Diana Picus
1c0b03f6e7 [flang][driver] Support parsing response files
Add support for reading response files in the flang driver. Response
files contain command line arguments and are used whenever a command
becomes longer than the shell/environment limit. Response files are
recognized via the special "@path/to/response/file.rsp" syntax, which
distinguishes them from other file inputs.

This patch hardcodes GNU tokenization, since we don't have a CL mode for
the driver. In the future we might want to add a --rsp-quoting command
line option, like clang has, to accommodate Windows platforms.

Differential Revision: https://reviews.llvm.org/D124846
2022-05-18 08:25:45 +00:00
Yeting Kuo
00999fb6e1 [SelectionDAGBuilder] Pass fast math flags to most of VP SDNodes.
The patch does not pass math flags to float VPCmpIntrinsics because LLParser
could not identify float VPCmpIntrinsics as FPMathOperators.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D125600
2022-05-18 16:15:47 +08:00
Diana Picus
6bcafce103 [flang][Runtime] Use proper prototypes in Fortran_main. NFCI
This is compiled as C code, so it's a good idea to be explicit about the
prototype. Clang complains about this when -Wstrict-prototypes is used.

Differential Revision: https://reviews.llvm.org/D125672
2022-05-18 08:04:09 +00:00
Qiu Chaofan
d9d15af787 [PowerPC] Treat llvm.fmuladd intrinsic as using CTR
This fixes bug 55463, similar to D78668. This is a temporary fix since
we will switch to post-isel CTR loop determination in the future.

Reviewed By: dim, shchenz

Differential Revision: https://reviews.llvm.org/D125746
2022-05-18 15:57:55 +08:00
rkayaith
7814b559bd [GreedyPatternRewriter] Avoid reversing constant order
The previous fix from af371f9f98 only applied when using a bottom-up
traversal. The change here applies the constant preprocessing logic to the
top-down case as well. This resolves the issue with the canonicalizer pass still
reordering constants, since it uses a top-down traversal by default.

Fixes #51892

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D125623
2022-05-18 00:55:59 -07:00
Nikita Popov
e9a1c82d69 [SCEVExpander] Expand umin_seq using freeze
%x umin_seq %y is currently expanded to %x == 0 ? 0 : umin(%x, %y).
This patch changes the expansion to umin(%x, freeze %y) instead
(https://alive2.llvm.org/ce/z/wujUhp).

The motivation for this change are the test cases affected by
D124910, where the freeze expansion ultimately produces better
optimization results. This is largely because
`(%x umin_seq %y) == %x` is a common expansion pattern, which
reliably optimizes in freeze representation, but only sometimes
with the zero comparison (in particular, if %x == 0 can fold to
something else, we generally won't be able to cover reasonable
code from this.)

Differential Revision: https://reviews.llvm.org/D125372
2022-05-18 09:53:07 +02:00
Nikita Popov
323514de58 [LoopUnroll] Avoid branch on poison for runtime unroll with multiple exits
When performing runtime unrolling with multiple exits, one of the
earlier (non-latch) exits may exit the loop on the first iteration,
such that we never branch on the latch exit condition. As such, we
need to freeze the condition of the new branch that is introduced
before the loop, as it now executes unconditionally.

Differential Revision: https://reviews.llvm.org/D125754
2022-05-18 09:51:22 +02:00
Nikita Popov
c4c01e4e4e [llvm-nm] Always use opaque pointers (PR55506)
Always enable opaque pointers in llvm-nm, because the tool doesn't
actually care, and this allows us to read both typed pointer and
opaque pointer bitcode files in one archive. Previously this
depended on the order inside the archive (it would work with an
opaque pointer bitcode file first, but fail with a typed pointer
bitcode file first).

Fixes https://github.com/llvm/llvm-project/issues/55506.

Differential Revision: https://reviews.llvm.org/D125751
2022-05-18 09:46:14 +02:00
rkayaith
ebad5fb309 [mlir][Canonicalize] Fix command-line options
The canonicalize command-line options currently have no effect, as the pass is
reading the pass options in its constructor, before they're actually
initialized. This results in the default values of the options always being used.

The change here moves the initialization of the `GreedyRewriteConfig` out of the
constructor, so that it runs after the pass options have been parsed.

Fixes #55466

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D125621
2022-05-18 00:28:18 -07:00
River Riddle
17e2e7b788 [mlir:PDLL] Don't append / for directory code completion
This allows for properly using / as a trigger character, i.e.
more easily allows chaining include directory completions.
2022-05-18 00:23:47 -07:00
River Riddle
6d4471efb0 [mlir:PDLL] Improve the location ranges of several expressions during parsing
This allows for the range to encompass more of the source associated
with the full expression, making diagnostics easier to see/tooling easier/etc.
2022-05-18 00:23:47 -07:00
River Riddle
e213e5a999 [mlir:PDLL] Drop space as a completion commit character
This causes annoyances when attempting to use space as
a trigger character (to start a different completion).
2022-05-18 00:23:47 -07:00
Martin Storsjö
92f1028ceb [llvm-readobj] Fix printing of Windows ARM unwind opcodes, add tests
The existing code was essentially untested; in some cases, it used
too narrow variable types to fit all the bits, in some cases the
bit manipulation operations were incorrect.

For the "ldr lr, [sp], #x" opcode, there's nothing in the documentation
that says it cannot be used in a prologue. (In practice, it would
probably seldom be used there, but technically there's nothing
stopping it from being used.) The documentation only specifies the
operation to replay for unwinding it, but the corresponding mirror
instruction to be printed for a prologue is "str lr, [sp, #-x]!".

Also improve printing of register masks, by aggregating registers
into ranges where possible, and make the printing of the terminating
branches clearer, as "bx <reg>" and "b.w <target>".

Differential Revision: https://reviews.llvm.org/D125643
2022-05-18 10:14:33 +03:00
Pavel Samolysov
d81064949f [ArgPromotion] Add unused-argument.ll test (NFC)
If a pointer argument is unused within the callee, this argument should
be removed from the function's signature while all used pointer
arguments should be promoted as it is expected. The ArgumentPromotion
pass doesn't touch unused non-pointer arguments at all.
2022-05-18 10:05:13 +03:00
Marek Kurdej
573a5b5800 Revert "[clang-format] Fix WhitespaceSensitiveMacros not being honoured when macro closing parenthesis is followed by a newline."
This reverts commit 50cd52d935.

It provoked regressions in C++ and ObjectiveC as described in https://reviews.llvm.org/D123676#3515949.

Reproducers:
```
MACRO_BEGIN
#if A
int f();
#else
int f();
#endif
```

```
NS_SWIFT_NAME(A)
@interface B : C
@property(readonly) D value;
@end
```
2022-05-18 07:27:45 +02:00
Groverkss
e00cbbec06 [MLIR][Presburger] Cleanup getMaybeValues in FACV
This patch cleans up multiple getMaybeValue functions to take an IdKind instead
of special functions.

Reviewed By: arjunp

Differential Revision: https://reviews.llvm.org/D125617
2022-05-18 09:44:14 +05:30
Groverkss
862b5a5233 [MLIR][Presburger] Attach values only to non-local identifiers in FAVC
This patch changes `FlatAffineValueConstraints` to only allow attaching
values to non-local identifiers.

The reasoning for this change is:
1. Information attached to local identifiers can be lost since local identifiers
  can be removed for output size optimizations.
2. There are no current use cases for attaching values to Local identifiers.
3. Attaching a value to a local identifier does not make sense since a local
  identifier represents existential quantification.

This patch also adds some additional asserts to the affected functions.

Reviewed By: arjunp, bondhugula

Differential Revision: https://reviews.llvm.org/D125613
2022-05-18 09:17:23 +05:30
Philip Reames
9b1e00738c [BasicAA] Remove unneeded special case for malloc/calloc
This code pre-exists the generic handling for inaccessiblememonly.  If we remove it and update one test with inaccessiblememonly, nothing else changes.  Note that simply running O1 on that test would annotate malloc with the missing inaccessiblememonly.
2022-05-17 20:45:14 -07:00
Zi Xuan Wu (Zeson)
dca37af061 [NFC][Clang] Modify expect of fail test or XFAIL because CSKY align is different
CSKY is always in 4-byte align, no matter it's long long type.
For global aggregate variable, it's 4-byte align if its size is bigger than or equal to 4 bytes.

Differential Revision: https://reviews.llvm.org/D124977
2022-05-18 10:53:30 +08:00
Shao-Ce SUN
25af3afa67 [NFC][AMDGPU][CodeGen] Use ArrayRef in TargetLowering functions
Based on D123467.

Reviewed By: rampitec

Differential Revision: https://reviews.llvm.org/D124508
2022-05-18 10:50:23 +08:00
Chenbing Zheng
d5c7d4b522 [InstCombine] add tests for icmp-fsh 2022-05-18 10:01:44 +08:00
Juneyoung Lee
3adcf96b4f [JumpThreading] Let ProcessImpliedCondition look into freeze instructions
This patch makes JumpThreading's ProcessImpliedCondition deal with frozen
conditions.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D84941
2022-05-18 10:41:31 +09:00
Juneyoung Lee
85fb9ccfa3 Precommit a test file for D84941 2022-05-18 10:41:25 +09:00
Ben Shi
8527f32f0a [lld][ELF] Support BFD name elf32-avr
Reviewed By: MaskRay

differential Revision: https://reviews.llvm.org/D125544
2022-05-18 00:00:14 +00:00
Robert Suderman
9294a1e9a8 [mlir][tosa] Rework tosa.apply_scale lowering for 32-bit
Added handling rounding behavior in 32-bits for when possible. This
avoids kernel compilation generating scalarized code on platforms where
64-bit vectors are not available.

As the 48-bit lowering requires 64-bit anyway, we added a full 64-bit
solution simplifying the old path.

Reviewed By: dcaballe, mravishankar

Differential Revision: https://reviews.llvm.org/D125583
2022-05-17 16:01:12 -07:00
Philip Reames
d4545e6fa0 Revert "[RISCV] Enable strict assertions in InsertVSETVLI data flow"
This reverts commit 79a66ec97b.

The stronger asserts served their purpose; I stumbled across another bug.  Will reapply once this one is also fixed.

The bug appears to be a variant of a previous one:
* We mutate an instruction in one block.
* That mutation changes the phase3 results of another block.

This is very similiar to a previous issue, except cross block instead of within a single block.
2022-05-17 15:53:13 -07:00
Matthias Springer
996834e681 [mlir][SCF] Fix scf.while bufferization
Before this fix, the bufferization implementation made the incorrect assumption that the values yielded from the "before" region must match with the values yielded from the "after" region.

Differential Revision: https://reviews.llvm.org/D125835
2022-05-18 00:35:50 +02:00
Sam McCall
79ca4ed3e7 [pseudo] Design notes from discussion today. NFC 2022-05-18 00:08:47 +02:00
Alexander Shaposhnikov
0f4d9f9b71 [ConstantRange] Improve the implementation of binaryAnd
This diff adjusts binaryAnd to take advantage of the analysis
based on KnownBits.

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

Test plan:
1/ ninja check-llvm
2/ ninja check-llvm-unit
2022-05-17 22:06:03 +00:00
Amir Ayupov
c907d6e0e9 [BOLT][NFC] Suppress unused variable warnings
Addresses the warnings emitted by Apple Clang 13.1.6 (Xcode 13.3.1).
Tip @tschuett issue #55404.

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D125733
2022-05-17 14:30:23 -07:00
Amir Ayupov
a7b69dbdd1 [BOLT][NFC] Move BinaryDominatorTree out of BinaryLoop header
Split up the BinaryLoop header and move BinaryDominatorTree into its own header,
preparing it for a standalone use.

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D125664
2022-05-17 14:20:11 -07:00
Philip Reames
a5983e57af [RISCV] Add additional test coverage of 11a7e77c and related transforms 2022-05-17 13:40:50 -07:00
Nuno Lopes
5a8e755101
[docs][LangRef] Fix typo in llvm.smul.fix example 2022-05-17 21:36:36 +01:00
Michael Jones
9f1d905f39 [libc] add snprintf
After adding sprintf, snprintf is simple. The functions are very
similar. The tests only cover the behavior of the max length since the
sprintf tests should cover the other behavior.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D125826
2022-05-17 13:32:59 -07:00
Eric Li
5bbef2e3ff [clang][dataflow] Fix double visitation of nested logical operators
Sub-expressions that are logical operators are not spelled out
separately in basic blocks, so we need to manually visit them when we
encounter them. We do this in both the `TerminatorVisitor`
(conditionally) and the `TransferVisitor` (unconditionally), which can
cause cause an expression to be visited twice when the binary
operators are nested 2+ times.

This changes the visit in `TransferVisitor` to check if it has been
evaluated before trying to visit the sub-expression.

Differential Revision: https://reviews.llvm.org/D125821
2022-05-17 20:28:48 +00:00
LLVM GN Syncbot
6947945080 [gn build] Port 1f49714d3e 2022-05-17 19:47:10 +00:00
LLVM GN Syncbot
6f803caa6d [gn build] Port 1188faa7ab 2022-05-17 19:47:09 +00:00
Walter Erquinigo
1188faa7ab [trace][intelpt] Support system-wide tracing [6] - Break IntelPTCollector into smaller files and minor refactor
IntelPTCollector is very big and has 3 classes in it. It's actually cleaner if each one has its own file. This also gives more visibility to the developer about the different kinds of "tracers" that we have.

Besides that, I'm now restricting the creation of the BinaryData chunks to GetState() instead of having it in different places, which is not very clean, because the gdb-remote protocol should be as restricted as possible.

Differential Revision: https://reviews.llvm.org/D125047
2022-05-17 12:46:54 -07:00
Walter Erquinigo
1637545f68 [trace][intelpt] Support system-wide tracing [5] - Disable/enable per-core tracing based on the process state
When tracing on per-core mode, we are tracing all processes, which means
that after hitting a breakpoint, our process will stop running (thus
producing no more tracing data) but other processes will continue
writing to our trace buffers. This causes a big data loss for our trace.
As a way to remediate this, I'm adding some logic to pause and unpause
tracing based on the target's state. The earlier we do it the better,
however, I'm not adding the trigger at the earliest possible point for
simplicity of this diff. Later we can improve that part.

Differential Revision: https://reviews.llvm.org/D124962
2022-05-17 12:46:54 -07:00
Walter Erquinigo
1f49714d3e [trace][intelpt] Support system-wide tracing [4] - Support per core tracing on lldb-server
This diffs implements per-core tracing on lldb-server. It also includes tests that ensure that tracing can be initiated from the client and that the jLLDBGetState ppacket returns the list of trace buffers per core.

This doesn't include any decoder changes.

Finally, this makes some little changes here and there improving the existing code.

A specific piece of code that can't reliably be tested is when tracing
per core fails due to permissions. In this case we add a
troubleshooting message and this is the manual test:

```
/proc/sys/kernel/perf_event_paranoid set to 1

(lldb) process trace start --per-core-tracing                                         error: perf event syscall failed: Permission denied
 You might need that /proc/sys/kernel/perf_event_paranoid has a value of 0 or -1.
``

Differential Revision: https://reviews.llvm.org/D124858
2022-05-17 12:46:54 -07:00
LLVM GN Syncbot
8d53f2fc0d [gn build] Port 6aabf60f2f 2022-05-17 19:38:35 +00:00
Stanislav Mekhanoshin
dee3190293 [AMDGPU] Add llvm.amdgcn.global.load.lds intrinsic
Differential Revision: https://reviews.llvm.org/D125279
2022-05-17 12:35:27 -07:00
Sam McCall
6aabf60f2f Revert "Reland "[clangd] Indexing of standard library""
This reverts commit ccdb56ac10.

Still seeing windows failures on GN bots: http://45.33.8.238/win/58316/step_9.txt

Unfortunately I can't debug these at all - it's a bare unsymbolized
stacktrace, and I can't reproduce the failure.
2022-05-17 21:33:48 +02:00
Stanislav Mekhanoshin
a09af86693 [AMDGPU] Enable FLAT LDS DMA on gfx9/10 before gfx940
We always had global and scratch loads to LDS in the gfx9,
but did not handle it. These were available via the 'lds'
encoding bit. In gfx940 this bit was reused as 'svs' which
resulted in new '_lds' opcodes effectively pushing this
bit into the opcode, but functionally it is the same. These
instructions are also available on gfx10.

Differential Revision: https://reviews.llvm.org/D125126
2022-05-17 12:16:37 -07:00
LLVM GN Syncbot
d910508a65 [gn build] Port ccdb56ac10 2022-05-17 19:07:18 +00:00
Philip Reames
118c5d1c97 [RISCV] Minor reorganization of VSETVLIInfo::operator== for readability [NFC] 2022-05-17 12:05:17 -07:00
Sam McCall
ccdb56ac10 Reland "[clangd] Indexing of standard library"
This reverts commit 76ddbb1ca7.
2022-05-17 21:02:23 +02:00
Eric Li
854c273cbb [clang][dataflow] Weaken guard to only check for storage location
Weaken the guard for whether a sub-expression has been evaluated to
only check for the storage location, instead of checking for the
value. It should be sufficient to check for the storage location, as
we don't necessarily guarantee that a value will be set for the
location (although this is currently true right now).

Differential Revision: https://reviews.llvm.org/D125823
2022-05-17 18:58:07 +00:00
Philip Reames
11a7e77c95 [RISCV] Canonicalize AVL=setvli to AVL=Imm or AVL=VLMAX
This patch adds a transform to the local prepass in InsertVSETVLI which canonicalizes an AVL of a register from another vsetvli into immediate or VLMAX when VTYPE is the same. In this patch, I chose to be conservative and avoid arbitrary vreg forwarding due to profitability concerns about possibility overlapping live ranges.

This has the effect of eliminating vsetvli instructions in loops which are walking either VLMAX or a constant number of lanes per iteration.

Differential Revision: https://reviews.llvm.org/D125812
2022-05-17 11:46:22 -07:00
Michael Jones
ff6fe39eca [libc] add sprintf
This adds the sprintf entrypoint, as well as unit tests. Currently
sprintf only supports %%, %s, and %c, but the other conversions are on
the way.

Reviewed By: sivachandra, lntue

Differential Revision: https://reviews.llvm.org/D125573
2022-05-17 11:32:20 -07:00