Commit Graph

392569 Commits

Author SHA1 Message Date
LLVM GN Syncbot c76fe67a7b [gn build] Port 9b02a9b401 2021-06-29 09:44:27 +00:00
LLVM GN Syncbot fc6a5d85ea [gn build] Port 159024ce23 2021-06-29 09:44:26 +00:00
Valeriy Savchenko 159024ce23 [analyzer] Implement getType for SVal
This commit adds a function to the top-class of SVal hierarchy to
provide type information about the value.  That can be extremely
useful when this is the only piece of information that the user is
actually caring about.

Additionally, this commit introduces a testing framework for writing
unit-tests for symbolic values.

Differential Revision: https://reviews.llvm.org/D104550
2021-06-29 12:11:19 +03:00
Ole Strohm 78d309ce19 [OpenCL] Fix qualifiers check on binding references to temporaries
Fix the qualifiers check from PR49733.

Fixes: PR49733

Reviewed By: Anastasia

Differential Revision: https://reviews.llvm.org/D103962
2021-06-29 10:03:57 +01:00
Med Ismail Bennani d6b64612bd [lldb/Interpreter] Fix session-save-on-quit when using ^D
Previously, when `interpreter.save-session-on-quit` was enabled, lldb
would save the session transcript only when running the `quit` command.

This patch changes that so the transcripts are saved when the debugger
object is destroyed if the setting is enabled.

rdar://72902650

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-06-29 10:54:29 +02:00
Med Ismail Bennani fe1874dd2d [lldb/Interpreter] Add setting to set session transcript save directory
This patch introduces a new interpreter setting
`interpreter.save-session-directory` so the user can specify a directory
where the session transcripts will be saved.

If not set, the session transcript are saved on a temporary file.

rdar://72902842

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-06-29 10:54:29 +02:00
Tianqing Wang 6178ddcd2b [X86] Add a test to reveal a bug in CMOV conversion.
CMOV conversion first rewrites all CMOVs with memory load to branches.
Then runs a second pass to convert other CMOVs in loops if profitable.
But the first pass doesn't add new basic blocks to MachineLoopInfo,
CMOVs in these blocks are ignored in the subsequent pass.

Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D104692
2021-06-29 16:37:19 +08:00
Bruno De Fraine 4d8871a898 PR50767: clear non-distinct debuginfo for function with nodebug definition after undecorated declaration
Fix suggested by Yuanfang Chen:

Non-distinct debuginfo is attached to the function due to the undecorated declaration. Later, when seeing the function definition and `nodebug` attribute, the non-distinct debuginfo should be cleared.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D104777
2021-06-29 10:26:45 +02:00
Diana Picus b8bac6b33c [flang] Add runtime interface for SYSTEM_CLOCK
SYSTEM_CLOCK may take up to 3 optional parameters, all of which are
INTENT(OUT). The COUNT and COUNT_MAX parameters are integer scalars,
while COUNT_RATE may be a real or integer scalar.

This patch breaks up the interface into 3 different functions, one for
each parameter. All 3 return integers. It is up to lowering to convert
the results to the preferred type.

Differential Revision: https://reviews.llvm.org/D104851
2021-06-29 08:25:01 +00:00
Florian Hahn 91fa3565da
[BasicAA] Be more careful with modulo ops on VariableGEPIndex.
(V * Scale) % X may not produce the same result for any possible value
of V, e.g. if the multiplication overflows. This means we currently
incorrectly determine NoAlias in some cases.

This patch updates LinearExpression to track whether the expression
has NSW and uses that to adjust the scale used for alias checks.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D99424
2021-06-29 09:22:36 +01:00
Soham Dixit 51d969dc27 [DebugInfo] Bug 41152 - Improve dumping of empty location expressions
Fixes PR41152 (https://bugs.llvm.org/show_bug.cgi?id=41152).

Reviewed by: jhenderson, dblaikie, SouraVX

Differential Revision: https://reviews.llvm.org/D103502
2021-06-29 09:21:00 +01:00
Alexander Shaposhnikov 6229369e50 Revert "[llvm-objcopy][MachO] Minor code cleanup"
This reverts commit c94cf97b53
since it appears to have broken linaro-clang-armv7-quick build bot
and needs further investigation.
2021-06-29 01:18:48 -07:00
David Sherwood dcfc2c3fac [NFC] Remove shadowed variable in InnerLoopVectorizer::createInductionVariable
Avoid creating a IRBuilder stack variable with the same name as the
class member.
2021-06-29 09:14:35 +01:00
Tianqing Wang d8faf03807 [X86] Add -mgeneral-regs-only support.
Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D103943
2021-06-29 16:02:51 +08:00
Tobias Gysi a2a4bc561d [mlir][linalg] All StructuredOp parameters are inputs or outputs.
Adapt the StructuredOp verifier to ensure all operands are either in the input or the output group. The change is possible after adding support for scalar input operands (https://reviews.llvm.org/D104220).

Differential Revision: https://reviews.llvm.org/D104783
2021-06-29 07:45:50 +00:00
Alexander Belyaev d15663710c Revert "[mlir] Skip scalar operands when tiling to linalg.tiled_loop."
This reverts commit 69046b4a79. It did not
really break anything, but it was decided to allow scalars and other
non-shaped operands for tiled_loop.
2021-06-29 08:55:25 +02:00
Siva Chandra 487f74a6c4 [libc][Obvious] Fix typo in implementation of aarch64 clearExcept.
Instead of reading and updating the status word, control word was being
updated.
2021-06-28 23:17:37 -07:00
David Blaikie e1b8fde1cb Revert "[Clang] Add option to handle behaviour of vector bool/vector pixel."
This reverts commit c3fe847f9d.

Tests fail in non-asserts builds because they assume named IR, by the
looks of it (testing for the "entry" label, for instance). I don't know
enough about the update_cc_test_checks.py stuff to know how to manually
fix these tests, so reverting for now.
2021-06-28 22:57:21 -07:00
Alexander Shaposhnikov c94cf97b53 [llvm-objcopy][MachO] Minor code cleanup
Remove unnecessary template in MachOReader.cpp. NFC.
2021-06-28 22:51:02 -07:00
Xiang1 Zhang 6d234a6908 [X86] Zero some outputs of Kelocker intrinsics in error case
Reviewed By: WangPengfei

Differential Revision: https://reviews.llvm.org/D104766
2021-06-29 13:35:40 +08:00
Ben Shi c94c8d8b5d [AVR][clang] Fix wrong calling convention in functions return struct type
According to AVR ABI (https://gcc.gnu.org/wiki/avr-gcc), returned struct value
within size 1-8 bytes should be returned directly (via register r18-r25), while
larger ones should be returned via an implicit struct pointer argument.

Reviewed By: dylanmckay

Differential Revision: https://reviews.llvm.org/D99237
2021-06-29 11:32:39 +08:00
Kai Luo ae79854e1c [AIX][compiler-rt] Deliver libatomic.a at top level library directory
Install libatomic.a in top level library directory so that compiler can find it in search directories.

Reviewed By: jsji

Differential Revision: https://reviews.llvm.org/D104908
2021-06-29 03:14:20 +00:00
Greg Clayton 42c05ed8be Fix failing tests after https://reviews.llvm.org/D104488.
Synthetic names no longer have the shared library name appended to the end.
2021-06-28 19:59:24 -07:00
Michael Liao 948308ef34 Fix `-Wunused-variable` warning. NFC. 2021-06-28 22:50:36 -04:00
Michael Liao e818eface8 [MIRParser] Add machine metadata.
- Add standalone metadata parsing support so that machine metadata nodes
  could be populated before and accessed during MIR is parsed.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D103282
2021-06-28 22:29:36 -04:00
Xun Li 31eb696fc4 [Coroutines] Remove CoroElide from O0 pipeline
CoroElide pass works only when a post-split coroutine is inlined into another post-split coroutine.
In O0, there is no inlining after CoroSplit, and hence no CoroElide can happen.
It's useless to put CoroElide pass in the O0 pipeline and it will never be triggered (unless I miss anything).

Differential Revision: https://reviews.llvm.org/D105066
2021-06-28 19:28:27 -07:00
Leonard Grey a8a6e5b094 [lld-macho] Preserve alignment for non-deduplicated cstrings
Fixes PR50637.

Downstream bug: https://crbug.com/1218958

Currently, we split __cstring along symbol boundaries with .subsections_via_symbols
when not deduplicating, and along null bytes when deduplicating. This change splits
along null bytes unconditionally, and preserves original alignment in the non-
deduplicated case.

Removing subsections-section-relocs.s because with this change, __cstring
is never reordered based on the order file.

Differential Revision: https://reviews.llvm.org/D104919
2021-06-28 22:26:43 -04:00
harsh-nod 0d6e4199e3 [mlir][vector] Order parallel indices before transposing the input in multireductions
The current code does not preserve the order of the parallel
dimensions when doing multi-reductions and thus we can end
up in scenarios where the result shape does not match the
desired shape after reduction.

This patch fixes that by ensuring that the parallel indices
are in order and then concatenates them to the reduction dimensions
so that the reduction dimensions are innermost.

Differential Revision: https://reviews.llvm.org/D104884
2021-06-28 18:47:16 -07:00
Greg Clayton ab546ead3b Fix a case where multiple symbols with zero size would cause duplicate entries in gsym files.
Symbol tables can have symbols with no size in mach-o files that were failing to get combined into a single entry. This resulted in many duplicate entries for the same address and made gsym files larger.

Differential Revision: https://reviews.llvm.org/D105068
2021-06-28 18:26:26 -07:00
Greg Clayton 323bcbdba0 Fix buildbot failure after https://reviews.llvm.org/D104488. 2021-06-28 18:12:05 -07:00
Greg Clayton d77ccfdc72 Create synthetic symbol names on demand to improve memory consumption and startup times.
This fix was created after profiling the target creation of a large C/C++/ObjC application that contained almost 4,000,000 redacted symbol names. The symbol table parsing code was creating names for each of these synthetic symbols and adding them to the name indexes. The code was also adding the object file basename to the end of the symbol name which doesn't allow symbols from different shared libraries to share the names in the constant string pool.

Prior to this fix this was creating 180MB of "___lldb_unnamed_symbol" symbol names and was taking a long time to generate each name, add them to the string pool and then add each of these names to the name index.

This patch fixes the issue by:
- not adding a name to synthetic symbols at creation time, and allows name to be dynamically generated when accessed
- doesn't add synthetic symbol names to the name indexes, but catches this special case as name lookup time. Users won't typically set breakpoints or lookup these synthetic names, but support was added to do the lookup in case it does happen
- removes the object file baseanme from the generated names to allow the names to be shared in the constant string pool

Prior to this fix the startup times for a large application was:
12.5 seconds (cold file caches)
8.5 seconds (warm file caches)

After this fix:
9.7 seconds (cold file caches)
5.7 seconds (warm file caches)

The names of the symbols are auto generated by appending the symbol's UserID to the end of the "___lldb_unnamed_symbol" string and is only done when the name is requested from a synthetic symbol if it has no name.

Differential Revision: https://reviews.llvm.org/D104488
2021-06-28 18:04:51 -07:00
River Riddle 473a21c0e9 [vscode-mlir] Add support for restarting the server on setting/server changes
This revision adds detection for changes to either the mlir-lsp-server binary or the setting, and prompts the user to restart the server. Whether the user gets prompted or not is a configurable setting in the extension, and this setting may updated based on the user response to the prompt.

Differential Revision: https://reviews.llvm.org/D104501
2021-06-29 00:08:44 +00:00
Lang Hames 8e66fc4384 [JITLink][ELF] Move ELF section and symbol parsing into ELFLinkGraphBuilder.
Move architecture independent ELF parsing/graph-building code from
ELFLinkGraphBuilder_x86_64 to the ELFLinkGraphBuilder base class template.
2021-06-29 09:59:49 +10:00
Philip Reames 716d2fedbf Precommit miscompile test from D103700 2021-06-28 16:00:42 -07:00
Stanislav Mekhanoshin b608053efb [IR] Fix replaceUsesWithIf ponetial issue with constants
There can be a use after free in the Value::replaceUsesWithIf()
if two uses point to the same constant. Patch defers handling
of the constants past the iterator scan.

Another potential issue is that handleOperandChange updates all
the uses in a given Constant, not just the one passed to
ShouldReplace. Added a FIXME comment.

Both issues are not currently exploitable as the only use of
this call with constants avoids it.

Differential Revision: https://reviews.llvm.org/D105061
2021-06-28 15:55:55 -07:00
Joseph Huber aaad46e6f5 [OpenMP] Run the OpenMPOpt module pass at O1
Now that the OpenMPOpt module pass include important optimizations for removing
globalization from offloading regions it should be run at a lower optimization
level.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D105056
2021-06-28 18:47:41 -04:00
Nico Weber f1969b74a7 [lld/mac] Fix nondeterminism in output section ordering
The two different thread_local_regular sections (__thread_data and
more_thread_data) had nondeterminstic ordering for two reasons:

1. https://reviews.llvm.org/D102972 changed concatOutputSections
   from MapVector to DenseMap, so when we iterate it to make
   output segments, we would add the two sections to the __DATA
   output segment in nondeterministic order.

2. The same change also moved the two stable_sort()s for segments
   and sections to sort(). Since sections with assigned priority
   (such as TLV data) have the same priority for all sections,
   this is incorrect -- we must use stable_sort() so that the
   initial (input-order-based) order remains.

As a side effect, we now (deterministically) put the __common
section in front of __bss (while previously we happened to
put it after it). (__common and __bss are both zerofill so
both have order INT_MAX, but common symbols are added to
inputSections before normal sections are collected.)

Makes lld/test/MachO/tlv.s and lld/test/MachO/tlv-dylib.s pass with
LLVM_ENABLE_EXPENSIVE_CHECKS=ON.

Differential Revision: https://reviews.llvm.org/D105054
2021-06-28 18:41:33 -04:00
Hongtao Yu 633ca3ff2f [UniqueLinkageName] Use exsiting GlobalDecl object instead of reconstructing one.
C++ constructors/destructors need to go through a different constructor to construct a GlobalDecl object in order to retrieve their linkage type. This causes an assert failure in the default constructor of GlobalDecl. I'm chaning it to using the exsiting GlobalDecl object.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D102356
2021-06-28 14:50:41 -07:00
Muhammad Omair Javaid 1fa7023585 [LLDB] dotest.py set selected_platform on remote connection
This patch fixes a bug in dotest.py where lldb.selected_platform was
being set to host platform even after a successful connection to a
remote platform via platform url. This patch fixes this behavior and
sets selected_platform to remote_platform after a successful connection.

This patch also removes target_platform variable from run_suite.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D105060
2021-06-28 21:37:12 +00:00
Scott Linder 8cd35ad854 [DebugInfo] Enforce implicit constraints on `distinct` MDNodes
Add UNIQUED and DISTINCT properties in Metadata.def and use them to
implement restrictions on the `distinct` property of MDNodes:

* DIExpression can currently be parsed from IR or read from bitcode
  as `distinct`, but this property is silently dropped when printing
  to IR. This causes accepted IR to fail to round-trip. As DIExpression
  appears inline at each use in the canonical form of IR, it cannot
  actually be `distinct` anyway, as there is no syntax to describe it.
* Similarly, DIArgList is conceptually always uniqued. It is currently
  restricted to only appearing in contexts where there is no syntax for
  `distinct`, but for consistency it is treated equivalently to
  DIExpression in this patch.
* DICompileUnit is already restricted to always being `distinct`, but
  along with adding general support for the inverse restriction I went
  ahead and described this in Metadata.def and updated the parser to be
  general. Future nodes which have this restriction can share this
  support.

The new UNIQUED property applies to DIExpression and DIArgList, and
forbids them to be `distinct`. It also implies they are canonically
printed inline at each use, rather than via MDNode ID.

The new DISTINCT property applies to DICompileUnit, and requires it to
be `distinct`.

A potential alternative change is to forbid the non-inline syntax for
DIExpression entirely, as is done with DIArgList implicitly by requiring
it appear in the context of a function. For example, we would forbid:

    !named = !{!0}
    !0 = !DIExpression()

Instead we would only accept the equivalent inlined version:

    !named = !{!DIExpression()}

This essentially removes the ability to create a `distinct` DIExpression
by construction, as there is no syntax for `distinct` inline. If this
patch is accepted as-is, the result would be that the non-canonical
version is accepted, but the following would be an error and produce a diagnostic:

    !named = !{!0}
    ; error: 'distinct' not allowed for !DIExpression()
    !0 = distinct !DIExpression()

Also update some documentation to consistently use the inline syntax for
DIExpression, and to describe the restrictions on `distinct` for nodes
where applicable.

Reviewed By: StephenTozer, t-tye

Differential Revision: https://reviews.llvm.org/D104827
2021-06-28 21:20:04 +00:00
Nikita Popov aad87328fa [AsmWriter] Properly handle uselistorder for global symbols
Currently, AsmWriter will stick uselistorder directives for global
values inside individual functions. This doesn't make a lot of sense,
and interacts badly with D104950, as use list order adjustments will
be performed while still working on a forward reference.

This patch instead always prints uselistorder directives for globals
at the module level. This isn't really compatible with the previously
used implementation approach. Rather than walking through all values
again, use the OrderMap (after stabilizing its order) to go through
all values and compute the use list shuffles for them. Classify them
per-function, or nullptr for globals.

Even independently of D104950, this seems to fix a few
verify-uselistorder failures. Conveniently, there is even a
pre-existing failing test that this fixes.

Differential Revision: https://reviews.llvm.org/D104976
2021-06-28 23:15:32 +02:00
Joseph Huber 2190c48fde [OpenMP][Documentation] Add FAQ entry for CMake module
This patch adds documentation for using the CMake find module for OpenMP
target offloading provided by LLVM. It also removes the requirement for
AMD's architecture to be set as this isn't necessary for upstream LLVM.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D105051
2021-06-28 17:05:07 -04:00
Joseph Huber c9f3240c9d [OpenMP][Documentation] Add OpenMPOpt optimization section
Add some information about the optimizations currently provided by
OpenMPOpt. Every optimization performed should eventually be listed
here.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D105050
2021-06-28 17:05:03 -04:00
Alexander Belyaev 69046b4a79 [mlir] Skip scalar operands when tiling to linalg.tiled_loop.
We are interested only in tensors/memrefs when creating a TiledLoopOp.

Differential Revision: https://reviews.llvm.org/D105059
2021-06-28 23:01:17 +02:00
Sanjay Patel 9d0bf7699c [InstCombine] don't try to fold a constant expression that can trap (PR50906)
We could use a bigger hammer and bail out on any constant
expression, but there's a regression test that appears to
validly do the transform (although it may not have been
intending to check that optimization).
2021-06-28 17:00:21 -04:00
Sanjay Patel 357c339ec8 [InstCombine][test] add test for potential miscompile with constant expression; NFC (PR50906) 2021-06-28 17:00:21 -04:00
Nick Desaulniers 8aee282f57 [IR] remove assert since always_inline can appear on CallBase
I added an assertion in D91816 (documenting behavior added in D93422)
that callers and callees with mismatched fn attr's related to stack
protectors should not occur unless the callee was attributed
always_inline.

This falls apart when a call, invoke, or callbr (any instruction
inheriting from CallBase) itself has an always_inline attribute. Clang
will emit such attributes on Instructions when __attribute__((flatten))
is used to recursively force inlining from a caller.

Since these assertions only had the caller and callee Functions, and not
the call site (CallBase derived classes), we would have to search the
caller for such instructions to reconstruct the call site information.
But at that point, inlining has already occurred; the call site has
already been removed from the caller.

Remove the assertions, add a unit test for always_inline call sites, and
update the LangRef.

Another curiosity is that the always_inline Attribute on Instructions is
only expanded by the inline pass, not the always_inline pass.

Thanks to @pcc on this report when building Android's RunTime (ART)
interpreter.

Reviewed By: pcc, MaskRay

Differential Revision: https://reviews.llvm.org/D104944
2021-06-28 13:53:57 -07:00
Nick Desaulniers a00ad85990 [Test] rewrite inline_nossp.ll
While adding remark based tests in D104944, I noticed that the tests
that we were passing were passing for the wrong reason. They were
passing because the dynamic allocas were preventing inlining, not the
code I added in D91816.

Rewrite and simplify the test. Add remark based checks to validate we're
preventing inline substitutions for the right reasons.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D104958
2021-06-28 13:52:45 -07:00
Joseph Huber 57ad2e1067 [OpenMP] Prevent OpenMPOpt from internalizing uncalled functions
Currently OpenMPOpt will only check if a function is a kernel before deciding not to internalize it. Any uncalled function that gets internalized will be trivially dead in the module so this is unnnecessary.

Depends on D102423

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D104890
2021-06-28 16:47:53 -04:00
Jacques Pienaar 5bc9cc1332 [drr] Enable specifying range in NativeCodeCall replacement.
This enables creating a replacement rule where range of positional replacements
need not be spelled out, or are not known (e.g., enable having a rewrite that
forward all operands to a call generically).

Differential Revision: https://reviews.llvm.org/D104955
2021-06-28 13:42:16 -07:00