Commit Graph

438318 Commits

Author SHA1 Message Date
LLVM GN Syncbot 0150c192a7 [gn build] Port 2c799b7793 2022-10-06 21:24:57 +00:00
Matthew Voss 2c799b7793 [llvm-reduce] Add pass that reduces DebugInfo metadata
This new pass for llvm-reduce attempts to reduce DebugInfo metadata.
The process used is:
  1. Scan every MD node, keeping track of nodes already visited.
  2. Look for DebugInfo nodes, then record any operands that are lists.
  3. Bisect though all the elements of the collected lists.

Differential Revision: https://reviews.llvm.org/D132077
2022-10-06 14:24:39 -07:00
Aart Bik d71dc357b1 [mlir][sparse] remove llvm dependence from sparse bazel
Reviewed By: wrengr, Peiming

Differential Revision: https://reviews.llvm.org/D135401
2022-10-06 14:22:24 -07:00
Florian Hahn 5b70db8f00
[ConstraintElimination] Add tests where unsigned system can be queried.
Add tests with a mix of signed and unsigned predicates. In some cases,
the unsigned system can be queried for signed predicates to improve
results.
2022-10-06 22:11:51 +01:00
Peter Klausler 52601325f1 [flang] Improve syntax error messages by fixing withMessage() parser combinator
The parser combinator withMessage("error message"_err_en_US, PARSER) is meant
to run the parser PARSER and, if it fails, override its error messages if
it failed silently or it was unable to recognize any tokens at all.  This
gives the parser a way to avoid emitting some confusing or missing error
messages.  Unfortunately, the implementation could sometimes lose track of
whether any tokens had been recognized, leading to problems with outer usage
of withMessage() and also -- more seriously -- with ParseState::CombineFailedParses().
That's a utility that determines which error messages to retain when two
or more parsers have been attempted at the same starting point and none
of them succceed.  Its policy is to retain the state from the parser that
consumed the most input text before failing, so long as it had recognized at
least one token.

So anyway, fix up withMessage(), adjust the tests, and add a test of the
original motivating confusing error situation, in which a syntax error in
a COMMON statement was being diagnosed as a problem with a statement function
definition because withMessage() had lost the fact that the parse of the
COMMON statement had recognized some tokens, and the last attempted parse
later was a failed attempt to parse a statement function.

Differential Revision: https://reviews.llvm.org/D135216
2022-10-06 14:00:06 -07:00
Aart Bik 4369972281 [mlir][sparse] minor header ordering cleanup
Order of methods was getting a bit out of sync with headers

Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D135377
2022-10-06 13:56:03 -07:00
Peiming Liu d30dccd21f [mlir][sparse] Favors synthetic tensor over other undefined tensors
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D135385
2022-10-06 20:51:38 +00:00
Peter Klausler ddb35533e6 [flang] Add missing source location to a semantic error message
Ensure that the semantic error "An allocatable or pointer component
reference must be applied to a scalar base" is emitted with a source
code location.

Differential Revision: https://reviews.llvm.org/D135215
2022-10-06 13:50:36 -07:00
Ellis Hoag aa065c016b Revert "[llvm-reduce] Remove debug metadata elements"
This reverts commit 69549de865.

The change in D135237 can lead to verification failures like `scope must have two or three operands`.
The ongoing work in D132077 does something similar without these failures, so lets wait for that to land and revert this patch.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D135395
2022-10-06 13:40:03 -07:00
Jorge Gorbe Moya 69c661a65f [lldb] Skip check for conflicting filter/synth when adding a new regex.
When adding a new synthetic child provider, we check for an existing
conflicting filter in the same category (and vice versa). This is done
by trying to match the new type name against registered formatters.

However, the new type name we're registered can also be a regex
(`type synth add -x`), and in this case the conflict check is just
wrong: it will try to match the new regex as if it was a type name,
against previously registered regexes.

See https://github.com/llvm/llvm-project/issues/57947 for a longer
explanation with concrete examples of incorrect behavior.

Differential Revision: https://reviews.llvm.org/D134570
2022-10-06 13:27:11 -07:00
Philip Reames 04bb32e58a [DAG] Extract helper for (neg x) [nfc]
This is a frequently reoccurring pattern, let's factor it out.

Differential Revision: https://reviews.llvm.org/D135301
2022-10-06 13:23:52 -07:00
Shilei Tian 9dd0476293 [OpenMP][DeviceRTL] Fix build issue 2022-10-06 16:21:51 -04:00
Aaron Puchert 0041a69495 Thread safety analysis: Support copy-elided production of scoped capabilities through arbitrary calls
When support for copy elision was initially added in e97654b2f2, it
was taking attributes from a constructor call, although that constructor
call is actually not involved. It seems more natural to use attributes
on the function returning the scoped capability, which is where it's
actually coming from. This would also support a number of interesting
use cases, like producing different scope kinds without the need for tag
types, or producing scopes from a private mutex.

Changing the behavior was surprisingly difficult: we were not handling
CXXConstructorExpr calls like regular calls but instead handled them
through the DeclStmt they're contained in. This was based on the
assumption that constructors are basically only called in variable
declarations (not true because of temporaries), and that variable
declarations necessitate constructors (not true with C++17 anymore).

Untangling this required separating construction from assigning a
variable name. When a call produces an object, we use a placeholder
til::LiteralPtr for `this`, and we collect the call expression and
placeholder in a map. Later when going through a DeclStmt, we look up
the call expression and set the placeholder to the new VarDecl.

The change has a couple of nice side effects:
* We don't miss constructor calls not contained in DeclStmts anymore,
  allowing patterns like
    MutexLock{&mu}, requiresMutex();
  The scoped lock temporary will be destructed at the end of the full
  statement, so it protects the following call without the need for a
  scope, but with the ability to unlock in case of an exception.
* We support lifetime extension of temporaries. While unusual, one can
  now write
    const MutexLock &scope = MutexLock(&mu);
  and have it behave as expected.
* Destructors used to be handled in a weird way: since there is no
  expression in the AST for implicit destructor calls, we instead
  provided a made-up DeclRefExpr to the variable being destructed, and
  passed that instead of a CallExpr. Then later in translateAttrExpr
  there was special code that knew that destructor expressions worked a
  bit different.
* We were producing dummy DeclRefExprs in a number of places, this has
  been eliminated. We now use til::SExprs instead.

Technically this could break existing code, but the current handling
seems unexpected enough to justify this change.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D129755
2022-10-06 22:19:09 +02:00
Aaron Puchert d8fa40dfa7 Thread safety analysis: Handle additional cast in scoped capability construction
We might have a CK_NoOp cast and a further CK_ConstructorConversion.
As an optimization, drop some IgnoreParens calls: inside of the
CK_{Constructor,UserDefined}Conversion should be no more parentheses,
and inside the CXXBindTemporaryExpr should also be none.

Lastly, we factor out the unpacking so that we can reuse it for
MaterializeTemporaryExprs later on.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D129752
2022-10-06 22:18:26 +02:00
Shilei Tian 32dc48094b [OpenMP][DeviceRTL] Fix an issue that thread array might be corrupted
The shared memory stack in the device runtime assumes no intervined uses.
D135037 breaks the assumption, potentially causing the shared stack corruption.
This patch moves the thread array to heap memory. Since it is already the slow
path, it doesn't matter that much anyway.

Reviewed By: jhuber6

Differential Revision: https://reviews.llvm.org/D135391
2022-10-06 16:13:33 -04:00
Alina Sbirlea b9898e7ed1 Revert "Reapply [InstCombine] Switch foldOpIntoPhi() to use InstSimplify"
This reverts commit e94619b955.
2022-10-06 13:12:24 -07:00
Peter Klausler 2253b06f55 [flang][NFC] Document Fortran aliasing rules
Summarize current understanding of Fortran's guarantees to a compiler
(or in other words, restrictions on programs and programmers)
about aliasing.

Differential Revision: https://reviews.llvm.org/D135214
2022-10-06 13:11:40 -07:00
Peter Klausler b7a0482a0a [flang] Clarify edge case of host association and generic interfaces
Name resolution was mishandling cases of generic interfaces and specific procedures
(sometimes complicatd by use of the same name for each) when the specific procedure
was accessed by means of host association; only the scope of the generic interface
definition was searched for the specific procedure.  Also search enclosing scopes
in the usual way.

Differential Revision: https://reviews.llvm.org/D135213
2022-10-06 13:10:33 -07:00
TatWai Chong eb04f321c3 [tosa] Add legalization for conv3d
Update the existing implementation to match TOSA spec.

Reviewed By: rsuderman

Differential Revision: https://reviews.llvm.org/D133062
2022-10-06 12:50:38 -07:00
Siva Chandra Reddy 3f965818b6 [libc] Add POSIX execv and execve functions.
The POSIX global variable environ has also been added.

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D135351
2022-10-06 19:50:23 +00:00
Valentin Clement eaa583c330
[flang] Use assembly format for fir.dispatch
Remove custom parser/printer and make use of the assembly format
for the fir.dispatch operation.

Depends on D135358

Reviewed By: PeteSteinfeld, jeanPerier

Differential Revision: https://reviews.llvm.org/D135363
2022-10-06 21:41:13 +02:00
Julian Lettner 97aee595bf [Sanitizer] Fix compile errors in rtl-old/tsan_rtl.cpp
Differential Revision: https://reviews.llvm.org/D134389
2022-10-06 12:28:36 -07:00
Stefan Pintilie 0e2e1fc90a [PowerPC] Fix types for vcipher builtins.
The documentation specifies that the parameters for the vcipher builtins are
```
vector unsigned char
```
The code used
```
vector unsigned long long
```

This patch fixes the types for the vcipher builtins.

Reviewed By: amyk

Differential Revision: https://reviews.llvm.org/D135300
2022-10-06 14:21:34 -05:00
Jorge Gorbe Moya dee9c7f5d7 [NFCI] Simplify TypeCategoryImpl for-each callbacks.
The callback system to iterate over every formatter of a given kind in
a TypeCategoryImpl is only used in one place (the implementation of
`type {formatter_kind} list`), and it's too convoluted for the sake of
unused flexibility.

This change changes it so that only one callback is passed to `ForEach`
(instead of a callback for exact matches and another one for regex
matches), and moves the iteration logic to `TieredFormatterContainer`
to avoid duplication.

If in the future we need different logic in the callback depending on
exact/regex match, the callback can get the type of formatter matching
used from the TypeMatcher argument anyway.

Differential Revision: https://reviews.llvm.org/D134771
2022-10-06 12:11:27 -07:00
Alexey Bataev 323ed2308a [SLP]Improve/fix CSE analysis of the blocks/instructions.
Added analysis for invariant extractelement instructions and improved
detection of the CSE blocks for generated extractelement instructions.

Differential Revision: https://reviews.llvm.org/D135279
2022-10-06 12:08:48 -07:00
Mariusz Borsa 7850df3de0 [Sanitizers][Darwin] Fix invalid gap found by FindAvailableMemoryRange
An application running with ASAN can fail during shadow memory allocation, with an error
indicating a failure to map shadow memory region due to negative size parameter passed to mmap.

It turns out that the mach_vm_region_recurse() call can return an address of a module
which is beyond the range of the VM address space available to the iOS process,
i.e. greater than the value returned by GetMaxVirtualAddress(). It leads the FindAvailableMemoryRange function
to the an incorrect conclusion that it has found a suitable gap where the shadow memory can fit in,
 while the shadow memory cannot be really allocated in this case.

The fix just takes the maximum VM address into account, causing the function to return 0,
meaning that the VM gap to fit the requested size could not be found.

rdar://66530705

Differential Revision: https://reviews.llvm.org/D134836
2022-10-06 12:06:30 -07:00
Jonas Devlieghere 01470b68f3
[lldb] Fix hard-coded argument to set_target_properties
The call to `set_target_properties` should use the target passed to
`add_lldb_library` instead of a hard-coded value. Upstream `liblldb` is
the only target for which this matters, but downstream we have
LLDBRPC.framework which needs this as well.
2022-10-06 11:43:52 -07:00
Jessica Paquette 5c63b24ec8 [GlobalISel] Add a m_SpecificReg matcher
Similar to the specific matchers for constants.

The intention here is to make it easier to write combines which check if a
specific register is used more than once.

e.g. matching patterns like:

```
(X + Y) == Y
```

Differential Revision: https://reviews.llvm.org/D135378
2022-10-06 11:35:16 -07:00
Peter Klausler a5f5d72f6c [flang][runtime] When NAMELIST input hits EOF, signal END, not an error
NAMELIST input processing in the runtime support library treats an
end-of-file found while searching for the initial '&' character
as an error condition, but it really should be distinguishable.
Call SignalEnd() rather than SignalError().

Differential Revision: https://reviews.llvm.org/D135212
2022-10-06 11:30:56 -07:00
Peter Klausler c11b4456c2 [flang] Selectors whose expressions are pointers returned from functions are valid targets
An ASSOCIATE or SELECT TYPE statement's selector whose "right-hand side" is the result
of a reference to a function that returns a pointer must be usable as a valid target
(but not as a pointer).

Differential Revision: https://reviews.llvm.org/D135211
2022-10-06 11:30:19 -07:00
Peter Klausler 7ff9064b26 [flang] Delay parse tree rewriting for I/O UNIT=func()
When an I/O statement's UNIT= specifier is a variable that is a
function reference, parse tree rewriting may determine the wrong type
of the result because generic resolution has not yet been performed.
So move this bit of parse tree rewriting into I/O semantic
checking so that the right handling (integer -> external file unit
number, character pointer -> internal I/O) applies.

Differential Revision: https://reviews.llvm.org/D135210
2022-10-06 11:29:41 -07:00
Peter Klausler e2eabb7ed5 [flang] Ignore errors on declarations in interfaces that "have no effect"
Fortran strangely allows declarations to appear in procedure interface
definitions when those declarations do not contribute anything to the
characteristics of the procedure; in particular, one may declare local
variables that are neither dummy variables nor function results.
Such declarations "have no effect" on the semantics of the program,
and that should include semantic error checking for things like
special restrictions on PURE procedures.

Differential Revision: https://reviews.llvm.org/D135209
2022-10-06 11:28:23 -07:00
Alex Brachet 4ea1a647ff [PGO] Make emitted symbols hidden
Differential Revision: https://reviews.llvm.org/D135340
2022-10-06 18:28:16 +00:00
Peter Klausler 3411263dde [flang] Ensure USE associations of shadowed procedures are emitted to module files
When a generic interface in a module shadows a procedure of the same name that
has been brought into scope via USE association, ensure that that USE association is
not lost when the module file is written.

Differential Revision: https://reviews.llvm.org/D135207
2022-10-06 11:25:50 -07:00
Peter Klausler de457f6489 [flang] Error message situation should be a warning
f18 emits an error message when the same name is used in a scope
for both a procedure and a generic interface, and the procedure is
not a specific procedure of the generic interface.  It may be
questionable usage, and not portable, but it does not appear to
be non-conforming by a strict reading of the standard, and many
popular Fortran compilers accept it.

Differential Revision: https://reviews.llvm.org/D135205
2022-10-06 11:21:36 -07:00
Peter Klausler 8100374437 [flang] Don't force SET_EXPONENT(I=...) argument to integer(4)
The implementation of the folding code for SET_EXPONENT() was written
in such a fashion as to convert the I= actual argument value to a 32-bit
integer.  Which is usually not a problem, but it's not always correct
and a test case ran into trouble with it.  Fix to allow any kind of
INTEGER without conversion.

Differential Revision: https://reviews.llvm.org/D135203
2022-10-06 11:20:27 -07:00
Joao Moreira eac3e5c3fb [X86] Do not emit JCC to __x86_indirect_thunk
Clang may optimize conditional tailcall blocks with the following layout:

cmp <condition>
je  tailcall_target
ret

When retpoline is in place, indirect calls are converted into direct calls to a retpoline thunk. When these indirect calls are tail calls, they may be subject to the above described optimization (there is no indirect JCC, but since now the jump is direct it can be made conditional). The above layout is non-ideal for the Linux kernel scenario because the branches into thunks may be patched back into indirect branches during runtime depending on the underlying CPU features, what would not be feasible if the binary is emitted with the optimized layout above.

Thus, prevent clang from emitting this it if CodeModel is Kernel.

Feature request from the respective kernel mailing list: https://lore.kernel.org/llvm/Yv3uI%2FMoJVctmBCh@worktop.programming.kicks-ass.net/

Reviewed By: nickdesaulniers, pengfei

Differential Revision: https://reviews.llvm.org/D134915
2022-10-06 11:09:24 -07:00
Craig Topper dc2b8fb965 [RISCV] Use fixed vector types in fixed-vectors-vfnmsac-vp.ll. NFC 2022-10-06 11:02:13 -07:00
Bill Wendling c131883146 [clang][NFC] Remove extraneous normalized value 2022-10-06 11:01:25 -07:00
Bjorn Pettersson 0db4b1d1a8 [SimplifyLibCalls] Adjust code comment in optimizeStringLength. NFC
The limitation in LibCallSimplifier::optimizeStringLength to only
optimize when the string is an i8 array was changed already in
commit 50ec0b5dce back in 2017.

We still only simplify when 's' points at an array of 'CharSize', so
the comment is still valid in the sense that we do not support
arbitrary array types.

Differential Revision: https://reviews.llvm.org/D135261
2022-10-06 20:00:27 +02:00
Craig Topper 3d6c63d413 [RISCV] Cleanup some vector tests. NFC
Some tests had scalable vector intrinsic names with fixed vector types.
Some had types in the wrong order.

Remove scalable vector test from fixed vector files.

Also replace insert+shuffle constexprs with fixed constant vectors.
2022-10-06 10:51:39 -07:00
Son Tuan Vu a4deb14fdf [LLVM][Support] Support for `llvm:🆑:list`'s default values
This patch introduces support for default values of list of CL options.
It fixes the issue in https://github.com/llvm/llvm-project/issues/52667

Reviewed By: bkramer

Differential Revision: https://reviews.llvm.org/D135311
2022-10-06 17:50:40 +00:00
Bill Wendling 7404b855e5 [clang][NFC] Use enum for -fstrict-flex-arrays
Use enums for the strict flex arrays flag so that it's more readable.

Differential Revision: https://reviews.llvm.org/D135107
2022-10-06 10:45:41 -07:00
Arthur Eubanks ae5733346f Revert "[DSE] Eliminate noop store even through has clobbering between LoadI and StoreI"
This reverts commit cd8f3e7581.

Causes miscompiles, see D132657
2022-10-06 10:36:02 -07:00
Aaron Ballman 5922b92060 Silence a signed/unsigned mismatch warning; NFC 2022-10-06 13:32:15 -04:00
Florian Hahn c9fa457933
[ConstraintElimination] Remove fixme addressed in 8e3e96298f. 2022-10-06 18:24:50 +01:00
Sanjay Patel 8da2fa856f [InstCombine] fold sdiv with hidden common factor
(X * Y) s/ (X << Z) --> Y s/ (1 << Z)

https://alive2.llvm.org/ce/z/yRSddG

issue #58137
2022-10-06 13:11:50 -04:00
Sanjay Patel 241893f99f [PhaseOrdering] add test for mul + sdiv; NFC
issue #58137
2022-10-06 13:11:50 -04:00
Ben Langmuir 8d9a3a6b9b [clang][test] Make headers unique to avoid linking issues
Make the empty headers used by cl-pch-showincludes.cpp unique so that
filesystems that link these files together by contents will not see
different behaviour in this test, which is not testing linked files
specifically.

This was uncovered by 5ea78c4113 which made us stop mutating the name
of the presumed loc for the file in ContentCache, but that just surfaced
an underlying issue that the filename of multiple includes of linked
files are not separately tracked.

Differential Revision: https://reviews.llvm.org/D135373
2022-10-06 10:09:22 -07:00
Florian Hahn c5e1ddb6fd
[ConstraintElimination] Update tests to use opaque pointers. 2022-10-06 18:07:25 +01:00