Commit Graph

363741 Commits

Author SHA1 Message Date
Aleksandr Platonov 399e459343 [clangd] Fix find_program() result check when searching for gRPC
`find_program(<VAR> ...)` sets <VAR> to <VAR>-NOTFOUND if nothing was found.
So we need to compare <VAR> with "<VAR>-NOTFOUND" or just use `if([NOT] <VAR>)`, because `if(<VAR>)` is false if `<VAR>` ends in the suffix -NOTFOUND.

Reviewed By: kbobyrev

Differential Revision: https://reviews.llvm.org/D85958
2020-08-14 11:33:41 +03:00
Joachim Protze 66a3575c28 [OpenMP] Fix releasing of stack memory
Starting with 787eb0c637 I got spurious segmentation faults for some testcases. I could nail it down to `brel` trying to release the "memory" of the node allocated on the stack of __kmpc_omp_wait_deps. With this patch, you will see the assertion triggering for some of the tests in the test suite.

My proposed solution for the issue is to just patch __kmpc_omp_wait_deps:
```
  __kmp_init_node(&node);
-  node.dn.on_stack = 1;
+  // the stack owns the node
+  __kmp_node_ref(&node);
```

What do you think?

Reviewed By: AndreyChurbanov

Differential Revision: https://reviews.llvm.org/D84472
2020-08-14 10:32:53 +02:00
Kirill Bobyrev 1786908f8c
[clangd] Warn developers when trying to link system-installed gRPC statically
Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D85815
2020-08-14 10:22:10 +02:00
Vitaly Buka 798eb71c3a [NFC][StackSafety] Dedup callees 2020-08-14 01:14:52 -07:00
Mehdi Amini 1e484b8a24 Remove spurious empty line at the beginning of source file (NFC) 2020-08-14 08:02:59 +00:00
Mehdi Amini 5035d192fa Fix BufferPlacement Pass to derive from the TableGen generated parent class (NFC) 2020-08-14 08:01:47 +00:00
Gui Andrade 909a851dbf [CGAtomic] Mark atomic libcall functions `nounwind`
These functions won't ever unwind. This is useful for MemorySanitizer
as it simplifies handling __atomic_load in particular.

Differential Revision: https://reviews.llvm.org/D85573
2020-08-14 07:46:43 +00:00
LLVM GN Syncbot d795f968d9 [gn build] Port 2e4a20fd70 2020-08-14 07:42:49 +00:00
Eduardo Caldas 2e4a20fd70 [SyntaxTree] Split `TreeTestBase` into header and source
* Switch to using directive on source files.
* Remove unused `SyntaxTreeTest::addFile`

Differential Revision: https://reviews.llvm.org/D85913
2020-08-14 07:29:07 +00:00
Raphael Isemann bbe3c479a6 [lldb] Fix a crash when tab-completion an empty line in a function with only one local variable
When LLDB sees only one possible completion for an input, it will add a trailing
space to the completion to signal that to the user. If the current argument is
quoted, that also means LLDB needs to add the trailing quote to finish the
current argument first.

In case the user is in a function with only one local variable and is currently
editing an empty line in the multiline expression editor, then we are in the
unique situation where we can have a unique completion for an empty input line.
(In a normal LLDB session this would never occur as empty input would just list
all the possible commands).

In this special situation our check if the current argument needs to receive a
trailing quote will crash LLDB as there is no current argument and the
completion code just unconditionally tries to access the current argument. This
just adds the missing check if we even have a current argument before we check
if we need to add a terminating quote character.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D85903
2020-08-14 09:06:52 +02:00
Sebastian Neubauer 9aa0ff77bd [AMDGPU] Enable .rodata for amdpal os
PAL recently got support for multiple ELF sections and relocations,
therefore we can now use .rodata sections instead of forcing constants
into .text.

Differential Revision: https://reviews.llvm.org/D85895
2020-08-14 09:05:48 +02:00
David Sherwood 6c7957c990 [SVE] Fix bug in SVEIntrinsicOpts::optimizePTest
The code wasn't taking into account that the two operands
passed to ptest could be identical and was trying to erase
them twice.

Differential Revision: https://reviews.llvm.org/D85892
2020-08-14 07:57:21 +01:00
Sam Parker 725400f993 [NFCI][SimpleLoopUnswitch] Adjust CostKind query
When getUserCost was transitioned to use an explicit CostKind,
TCK_CodeSize was used even though the original kind was implicitly
SizeAndLatency so restore this behaviour. We now only query for
CodeSize when optimising for minsize.

I expect this to not change anything as, I think all, targets will
currently return the same value for CodeSize and SizeLatency. Indeed
I see no changes in the test suite for Arm, AArch64 and X86.

Differential Revision: https://reviews.llvm.org/D85829
2020-08-14 07:54:20 +01:00
Igor Kudrin 95fad44e34 [DebugInfo] Avoid an infinite loop with a truncated pre-v5 .debug_str_offsets.dwo.
dumpStringOffsetsSection() expects the size of a contribution to be
correctly aligned. The patch adds the corresponding verifications for
pre-v5 cases.

Differential Revision: https://reviews.llvm.org/D85739
2020-08-14 13:11:37 +07:00
Arthur Eubanks 48cd5b72b1 Revert "[SLC] sprintf(dst, "%s", str) -> strcpy(dst, str)"
This reverts commit ab9fc8bae8.

Incorrect transformation if the result is used.
Causes breakages, e.g.
http://green.lab.llvm.org/green/job/test-suite-verify-machineinstrs-x86_64-O3/8193/
2020-08-13 21:05:03 -07:00
Chris Kennelly 800f0eda5b [NFC] Remove unused function.
Differential Revision: https://reviews.llvm.org/D85944
2020-08-13 21:20:15 -04:00
aartbik 6b66f21446 [mlir] [VectorOps] Canonicalization of 1-D memory operations
Masked loading/storing in various forms can be optimized
into simpler memory operations when the mask is all true
or all false. Note that the backend does similar optimizations
but doing this early may expose more opportunities for further
optimizations. This further prepares progressively lowering
transfer read and write into 1-D memory operations.

Reviewed By: ThomasRaoux

Differential Revision: https://reviews.llvm.org/D85769
2020-08-13 17:15:35 -07:00
Thomas Lively b182ccfc2d [WebAssembly] Add missing lit.local.cfg 2020-08-13 16:33:52 -07:00
Peter Collingbourne c201f27225 hwasan: Emit the globals note even when globals are uninstrumented.
This lets us support the scenario where a binary is linked from a mix
of object files with both instrumented and non-instrumented globals.
This is likely to occur on Android where the decision of whether to use
instrumented globals is based on the API level, which is user-facing.

Previously, in this scenario, it was possible for the comdat from
one of the object files with non-instrumented globals to be selected,
and since this comdat did not contain the note it would mean that the
note would be missing in the linked binary and the globals' shadow
memory would be left uninitialized, leading to a tag mismatch failure
at runtime when accessing one of the instrumented globals.

It is harmless to include the note when targeting a runtime that does
not support instrumenting globals because it will just be ignored.

Differential Revision: https://reviews.llvm.org/D85871
2020-08-13 16:33:22 -07:00
Yuanfang Chen a5ed20b549 [NewPM][CodeGen] Add machine code verification callback
D83608 need this.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D85916
2020-08-13 16:13:01 -07:00
Ben Dunbobbin 4cb016cd2d [X86][ELF] Prefer lowering MC_GlobalAddress operands to .Lfoo$local for STV_DEFAULT only
This patch restricts the behaviour of referencing via .Lfoo$local
local aliases, introduced in https://reviews.llvm.org/D73230, to
STV_DEFAULT globals only.

Hidden symbols via --fvisiblity=hidden (https://gcc.gnu.org/wiki/Visibility)
is an important scenario.

Benefits:

- Improves the size of object files by using fewer STT_SECTION symbols.

- The code reads a bit better (it was not obvious to me without going
  back to the code reviews why the canBenefitFromLocalAlias function
  currently doesn't consider visibility).

- There is also a side benefit in restoring the effectiveness of the
  --wrap linker option and making the behavior of --wrap consistent
  between LTO and normal builds for references within a translation-unit.
  Note: this --wrap behavior (which is specific to LLD) should not be
  considered reliable. See comments on https://reviews.llvm.org/D73230
  for more.

Differential Revision: https://reviews.llvm.org/D85782
2020-08-14 00:09:15 +01:00
Arthur Eubanks 41f49736a9 [ConstProp] Handle insertelement constants
Previously ConstantFoldExtractElementInstruction() would only work with
insertelement instructions, not contants. This properly handles
insertelement constants as well.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D85865
2020-08-13 15:59:17 -07:00
Amy Huang ae6523cd62 [DebugInfo] Add -fuse-ctor-homing cc1 flag so we can turn on constructor homing only if limited debug info is already on.
This adds a cc1 flag to enable constructor homing but doesn't turn on debug
info if it wasn't enabled already (which is what using
-debug-info-kind=constructor does). This will be used for testing, and won't
be needed anymore once ctor homing is used as default / merged into =limited.

Bug to enable ctor homing: https://bugs.llvm.org/show_bug.cgi?id=46537

Differential Revision: https://reviews.llvm.org/D85799
2020-08-13 15:48:55 -07:00
Dávid Bolvanský ab9fc8bae8 [SLC] sprintf(dst, "%s", str) -> strcpy(dst, str)
Solves 46489
2020-08-14 00:05:55 +02:00
Chris Kennelly 097c8fb2cb [NFC] Remove unused variables.
These were no longer needed following
96855125e7.

Reviewed By: rupprecht

Differential Revision: https://reviews.llvm.org/D85939
2020-08-13 17:56:51 -04:00
David Green 0c390c22a5 Revert "[ARM] Fix IT block generation after Thumb2SizeReduce with -Oz"
This reverts commit 18279a54b5 as it is
causing some chromium android test problems.
2020-08-13 22:40:36 +01:00
Jonas Devlieghere 3da939686c [lldb] Improve diagnostics in lldb-repro when replay fails
- Print the replay invocation.
 - Keep the reproducer around.
 - Return the "opposite" exit code so we don't have to rely on FileCheck
   to fail the test when the expected exit code is non-zero.
2020-08-13 14:38:34 -07:00
Austin Kerbow 7d1cb187fb [AMDGPU] Fix FP/BP spills when MUBUF constant offset exceeded
If we need a scratch register for the spill don't use the same scratch
register that is being used for the MBUF offset.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D85772
2020-08-13 14:12:00 -07:00
Thomas Lively d53d952810 [WebAssembly] Allow inlining functions with different features
Allow inlining only when the Callee has a subset of the Caller's
features. In principle, we should be able to inline regardless of any
features because WebAssembly supports features at module granularity,
not function granularity, but without this restriction it would be
possible for a module to "forget" about features if all the functions
that used them were inlined.

Requested in PR46812.

Differential Revision: https://reviews.llvm.org/D85494
2020-08-13 13:57:43 -07:00
Rainer Orth f59bec7acb [clang][Driver] Default to /usr/bin/ld on Solaris
`clang` currently requires the native linker on Solaris:

  - It passes `-C` to `ld` which GNU `ld` doesn't understand.

  - To use `gld`, one needs to pass the correct `-m EMU` option to select
    the right emulation.  Solaris `ld` cannot handle that option.

So far I've worked around this by passing `-DCLANG_DEFAULT_LINKER=/usr/bin/ld`
to `cmake`.  However, if someone forgets this, it depends on the user's
`PATH` whether or not `clang` finds the correct linker, which doesn't make
for a good user experience.

While it would be nice to detect the linker flavor at runtime, this is more
involved.  Instead, this patch defaults to `/usr/bin/ld` on Solaris.  This
doesn't work on its own, however: a link fails with

  clang-12: error: unable to execute command: Executable "x86_64-pc-solaris2.11-/usr/bin/ld" doesn't exist!

I avoid this by leaving absolute paths alone in `ToolChain::GetLinkerPath`.

Tested on `amd64-pc-solaris2.11`, `sparcv9-sun-solaris2.11`, and
`x86_64-pc-linux-gnu`.

Differential Revision: https://reviews.llvm.org/D84029
2020-08-13 22:42:58 +02:00
Dávid Bolvanský 18910c4cb5 [Tests] Update strncpy tests 2020-08-13 22:37:44 +02:00
Lang Hames f136e5ecfb Re-apply "[llvm-jitlink] Don't demote unreferenced definitions in -harness mode"
This reapplies commit e137b55058 with
fixes for the broken test case: Non-global symbols should only be
skipped after checking that they're not referenced by the harness.
2020-08-13 13:23:17 -07:00
Dávid Bolvanský 5ef2287d36 [SLC] Optimize strncpy(a, a, C) to memcpy(a, a000, C)
Solves PR47154
2020-08-13 22:22:51 +02:00
Nikita Popov 524f591a39 [InstSimplify] Add tests for assume with min/max intrinsic (NFC)
If we assume one of the operands is smaller/greater, then min/max
may be simplified.
2020-08-13 22:10:07 +02:00
Peter Collingbourne 9f8c4039f2 sanitizer_common: Introduce internal_madvise and start using it.
A recent change to sanitizer_common caused us to issue the syscall
madvise(MADV_HUGEPAGE) during HWASAN initialization. This may lead to a
problem if madvise is instrumented (e.g. because libc is instrumented
or the user intercepted it). For example, on Android the syscall may
fail if the kernel does not support transparent hugepages, which leads
to an attempt to set errno in a HWASAN instrumented function. Avoid
this problem by introducing a syscall wrapper and using it to issue
this syscall.

Tested only on Linux; includes untested updates for the other
platforms.

Differential Revision: https://reviews.llvm.org/D85870
2020-08-13 13:09:02 -07:00
Vy Nguyen 114c9fa0e4 Add "status" to the list of absl libraries.
The Abseil-NoInternalDependenciesCheck currently mistakenly triggers on any usage of internal helpers even if it is within absl/status.

Differential Revision: https://reviews.llvm.org/D85843
2020-08-13 16:08:14 -04:00
Abhina Sreeskantharajan dedaf78fa7 [SystemZ][z/OS] enable trigraphs by default on z/OS
This patch enables trigraphs on z/OS.

Reviewed By: hubert.reinterpretcast, fanbo-meng

Differential Revision: https://reviews.llvm.org/D85722
2020-08-13 16:02:07 -04:00
Chris Kennelly 96855125e7 [tsan] Respect no_huge_pages_for_shadow.
Disable huge pages in the TSan shadow regions when no_huge_pages_for_shadow == true (default).

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D85841
2020-08-13 15:55:23 -04:00
parallels bc45bab7eb [libc] Add strtok_r implementation.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D85779
2020-08-13 15:51:38 -04:00
Cameron McInally 21810b0e14 [SVE] Lower fixed length vector integer UMIN/UMAX
Differential Revision: https://reviews.llvm.org/D85926
2020-08-13 14:48:36 -05:00
Nico Weber 661d83aa38 [gn build] (manually) port d650cbc349 better 2020-08-13 15:48:03 -04:00
Nico Weber 5092039644 [gn build] (manually) port d650cbc349 2020-08-13 15:43:43 -04:00
Stefan Gränitz 5bcd32b744 [ORC][NFC] Fix typo in comment 2020-08-13 21:14:20 +02:00
Alex Lorenz c2807b2e56 [darwin][driver] fix isMacosxVersionLT minimum supported OS version check
The previous Driver's triple check only worked for -target, but not for -arch -mmacosx-version-min invocations
2020-08-13 12:06:45 -07:00
River Riddle f7a13479b8 [mlir][docs] Update/Add documentation for MLIRs Pattern Rewrite infrastructure
This infrastructure has evolved a lot over the course of MLIRs lifetime, and has never truly been documented outside of rationale or proposals. This revision aims to document the infrastructure and user facing API, with the rationale specific portions moved to the Rationale folder and updated.

Differential Revision: https://reviews.llvm.org/D85260
2020-08-13 12:05:55 -07:00
River Riddle fa4b3147e3 [mlir][DialectConversion] Update the documentation for dialect conversion
This revision updates the documentation for dialect conversion, as many concepts have changed/evolved over time.

Differential Revision: https://reviews.llvm.org/D85167
2020-08-13 12:05:54 -07:00
Stefan Gränitz f12db8cf75 [ORC] cloneToNewContext() can work with a const-ref to ThreadSafeModule 2020-08-13 21:01:21 +02:00
Stefan Gränitz 34a5669ccd [ORC] Fix SymbolLookupSet::containsDuplicates() 2020-08-13 21:01:21 +02:00
shafik 25bbceb047 [LLDB] Fix how ValueObjectChild handles bit-fields stored in a Scalar in UpdateValue()
When bit-field data was stored in a Scalar in ValueObjectChild during UpdateValue()
it was extracting the bit-field value. Later on in lldb_private::DumpDataExtractor(…)
we were again attempting to extract the bit-field. Which would then not obtain the
correct value. This will remove the extra extraction in UpdateValue().
We hit this specific case when values are passed in registers, which we could only
reproduce in an optimized build.

Differential Revision: https://reviews.llvm.org/D85376
2020-08-13 11:53:14 -07:00
Haowei Wu d650cbc349 [elfabi] Move llvm-elfabi related code to InterfaceStub library
This change moves elfabi related code to llvm/InterfaceStub library
so it can be shared by multiple llvm tools without causing cyclic
dependencies.

Differential Revision: https://reviews.llvm.org/D85678
2020-08-13 11:51:44 -07:00