Commit Graph

354115 Commits

Author SHA1 Message Date
Muhammad Omair Javaid 0796b170fb Fix error in TestNumThreads.py when frame.GetFunctionName returns none
Summary:
This patch fixes an error happening in TestNumThreads.py when it encounters frame.GetFunctionName none for address only locations in stripped libc.

This error was showing up on arm-linux docker container running lldb buildbot.

Reviewers: labath

Reviewed By: labath

Subscribers: kristof.beyls, lldb-commits

Differential Revision: https://reviews.llvm.org/D79777
2020-05-13 05:13:46 +05:00
Nicolas Vasilache 63c0e72b2f [mlir] Revisit std.subview handling of static information.
The main objective of this revision is to change the way static information is represented, propagated and canonicalized in the SubViewOp.

In the current implementation the issue is that canonicalization may strictly lose information because static offsets are combined in irrecoverable ways into the result type, in order to fit the strided memref representation.

The core semantics of the op do not change but the parser and printer do: the op always requires `rank` offsets, sizes and strides. These quantities can now be either SSA values or static integer attributes.

The result type is automatically deduced from the static information and more powerful canonicalizations (as powerful as the representation with sentinel `?` values allows). Previously static information was inferred on a best-effort basis from looking at the source and destination type.

Relevant tests are rewritten to use the idiomatic `offset: x, strides : [...]`-form. Bugs are corrected along the way that were not trivially visible in flattened strided memref form.

Lowering to LLVM is updated, simplified and now supports all cases.
A mixed static-dynamic mode test that wouldn't previously lower is added.

It is an open question, and a longer discussion, whether a better result type representation would be a nicer alternative. For now, the subview op carries the required semantic.

Differential Revision: https://reviews.llvm.org/D79662
2020-05-12 20:04:44 -04:00
Zequan Wu cb22ab7403 Add nomerge function attribute to supress tail merge optimization in simplifyCFG
We want to add a way to avoid merging identical calls so as to keep the
separate debug-information for those calls. There is also an asan
usecase where having this attribute would be beneficial to avoid
alternative work-arounds.

Here is the link to the feature request:
https://bugs.llvm.org/show_bug.cgi?id=42783.

`nomerge` is different from `noline`. `noinline` prevents function from
inlining at callsites, but `nomerge` prevents multiple identical calls
from being merged into one.

This patch adds `nomerge` to disable the optimization in IR level. A
followup patch will be needed to let backend understands `nomerge` and
avoid tail merge at backend.

Reviewed By: asbirlea, rnk

Differential Revision: https://reviews.llvm.org/D78659
2020-05-12 16:49:20 -07:00
Nico Weber 759bae956a [lld-macho] Ignore -platform_version and -syslibroot flags.
clang passes these flags; this makes it easier to try `clang -v`
output with `ld -flavor darwinnew`.

Differential Revision: https://reviews.llvm.org/D79797
2020-05-12 19:17:01 -04:00
Siva Chandra Reddy e17a47b2d3 [libc][Obvious] Fix deps of few threads targets.
A missing dep has been added, and a few redundent deps have been
removed.
2020-05-12 16:14:12 -07:00
Casey Carter 2c861e8a12 [libc++][test] Properly mark libc++-only XFAILs
These tests PASS on libstdc++ and MSVC.
2020-05-12 16:11:22 -07:00
Stanislav Mekhanoshin 71ed66d97f [AMDGPU] Make v4i64/v4f64/v8i64/v8f64 legal
We can produce such vectors in the Promote Alloca pass,
but we are unable to use movrel to operate it and lower
via scratch. Making it legal makes SI_INDIRECT patterns
work.

There is more work to do in subsequent changes:

1. We initialize m0 twice to access each dword. It shall
be possible to only do it once and increment base register
number instead.
2. We also need v16i64/v16f64 but these first need to be
added to tablegen.

Differential Revision: https://reviews.llvm.org/D79808
2020-05-12 16:05:12 -07:00
Jonas Devlieghere ab22f71dd7 [lldb/Reproducers] Also record directories FileSystem::Collect.
Now that the FileCollector knows how to deal with directories we no
longer have to ignore them in the FileSystem class.
2020-05-12 15:59:24 -07:00
Sean Silva 452e2fc409 Revert of Revert of [mlir][shape] Tidy up shape.shape_of
Summary:

- Mark it NoSideEffect
- Add custom parser/printer

This reverts the temporary revert in
https://reviews.llvm.org/rG84a9c725742d26df04808a3c7349dbd98684c6cb
That was a false alarm. A downstream test actually needed to be updated.
2020-05-12 15:51:24 -07:00
Jan Korous 759465ee34 [YAMLVFSWriter] Fix for delimiters
Differential Revision: https://reviews.llvm.org/D79809
2020-05-12 15:43:10 -07:00
Sanjay Patel f490ca76b0 [x86][CGP] enable target hook to sink funnel shift intrinsic's splatted shift amount
SDAG suffers when it can't see that a funnel operand is a splat value
(due to single-basic-block visibility), so invert the normal loop
hoisting rules to move a splat op closer to its use.

This would be part 1 of an enhancement similar to D63233.

This is needed to re-fix PR37426:
https://bugs.llvm.org/show_bug.cgi?id=37426
...because we got better at canonicalizing IR to funnel shift intrinsics.

The existing CGP code for shift opcodes is likely overstepping what it was
intended to do, so that will be fixed in a follow-up.

Differential Revision: https://reviews.llvm.org/D79718
2020-05-12 18:40:40 -04:00
Davide Italiano a9e8562651 [GIsel] Update a comment and make it more precise.
This only covers ANYEXT/ZEXT. SEXT is covered in another test
I just checked in.
2020-05-12 15:38:20 -07:00
Alex Zinenko 473bdaf2e8 [mlir] Move Conversion/StandardToStandard to Dialect/StandardOps/Transforms/FuncConversions
Conversion/ folders were originally intended to store patterns for
DialectA->DialectB conversions that depend on both dialects and do not
conceptually belong to either of the dialects. As such, DialectA->DialectA
conversion does not make sense under Conversion/ and should rather live with
the dialect it operates on.

Differential Revision: https://reviews.llvm.org/D79569
2020-05-13 00:33:25 +02:00
Davide Italiano 99d60a1d0b [GlobalISel] Assign the correct location when combining G_SEXT.
<rdar://problem/62991635>
2020-05-12 15:32:18 -07:00
Alexey Lapshin 1c44430e73 Fix buildbots #2 after aa1eb5152d. 2020-05-13 01:23:39 +03:00
Justin Hibbits 0138cc0125 PowerPC: Treat llvm.fma.f* intrinsic as using CTR with SPE
Summary:
The SPE doesn't have a 'fma' instruction, so the intrinsic becomes a
libcall.  It really should become an expansion to two instructions, but
for some reason the compiler doesn't think that's as optimal as a
branch.  Since this lowering is done after CTR is allocated for loops,
tell the optimizer that CTR may be used in this case.  This prevents a
"Invalid PPC CTR loop!" assertion in the case that a fma() function call
is used in a C/C++ file, and clang converts it into an intrinsic.

Reviewed By: shchenz
Differential Revision: https://reviews.llvm.org/D78668
2020-05-12 17:19:43 -05:00
Alexey Lapshin 293c6d3821 Fix buildbots after aa1eb5152d. 2020-05-13 01:11:01 +03:00
Wei Mi 56926ae0fa [SampleFDO] Rename llvm-profdata flag -partial-profile to -gen-partial-profile.
The internal flag -partial-profile in llvm conflicts with the flag with
the same name in llvm-profdata. The conflict happens in builds with
LLVM_LINK_LLVM_DYLIB enabled. In this case the tools are linked with libLLVM
and we end up with two definitions for the same cl::opt.

The patch renames llvm-profdata flag -partial-profile to -gen-partial-profile.
2020-05-12 15:06:03 -07:00
Jonas Devlieghere 58bc507b6f [VirtualFileSystem] Add unit test that showcases another YAMLVFSWriter bug
This scenario generates another broken YAML mapping as illustrated below.

  {
    'type': 'directory',
    'name': "c",
    'contents': [
      ,
      {
        'type': 'directory',
        'name': "d",
        'contents': [
          ,
          {
            'type': 'directory',
            'name': "e",
            'contents': [
              {
                'type': 'file',
                'name': "f",
                'external-contents': "//root/a/c/d/e/f"
              }                    {
                'type': 'file',
                'name': "g",
                'external-contents': "//root/a/c/d/e/g"
              }
            ]
          }
        ]
      }
    ]
  },
2020-05-12 14:55:43 -07:00
Jonas Devlieghere 59ba19c56e [VirtualFileSystem] Add unit test that showcases YAMLVFSWriter bug
This scenario generates a broken YAML mapping as illustrated below.

 {
   'type': 'directory',
   'name': "c",
   'contents': [
     {
       'type': 'file',
       'name': "d",
       'external-contents': "//root/a/c/d"
     }            {
       'type': 'file',
       'name': "e",
       'external-contents': "//root/a/c/e"
     }            {
       'type': 'file',
       'name': "f",
       'external-contents': "//root/a/c/f"
     }
   ]
 },
2020-05-12 14:47:31 -07:00
Alexey Lapshin aa1eb5152d [X86][ISelLowering] refactor Varargs handling in X86ISelLowering.cpp
Summary:
This patch refactors handling of VarArgs in
X86TargetLowering::LowerFormalArguments.
That refactoring was requested while reviewing
D69372. Code related to varargs handling is removed
from X86TargetLowering::LowerFormalArguments and
is divided into smaller routines.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D74794
2020-05-13 00:32:00 +03:00
Fangrui Song 66055230bf [TargetLoweringObjectFileImpl] Produce .text.hot. instead of .text.hot for -fno-unique-section-names
GNU ld's internal linker script uses (https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=add44f8d5c5c05e08b11e033127a744d61c26aee)

  .text           :
  {
    *(.text.unlikely .text.*_unlikely .text.unlikely.*)
    *(.text.exit .text.exit.*)
    *(.text.startup .text.startup.*)
    *(.text.hot .text.hot.*)
    *(SORT(.text.sorted.*))
    *(.text .stub .text.* .gnu.linkonce.t.*)
    /* .gnu.warning sections are handled specially by elf.em.  */
    *(.gnu.warning)
  }

Because `*(.text.exit .text.exit.*)` is ordered before `*(.text .text.*)`, in a -ffunction-sections build, the C library function `exit` will be placed before other functions.
gold's `-z keep-text-section-prefix` has the same problem.

In lld, `-z keep-text-section-prefix` recognizes `.text.{exit,hot,startup,unlikely,unknown}.*`, but not `.text.{exit,hot,startup,unlikely,unknown}`, to avoid the strange placement problem.

In -fno-function-sections or -fno-unique-section-names mode, a function whose `function_section_prefix` is set to `.exit"`
will go to the output section `.text` instead of `.text.exit` when linked by lld.
To address the problem, append a dot to become `.text.exit.`

Reviewed By: grimar

Differential Revision: https://reviews.llvm.org/D79600
2020-05-12 14:14:17 -07:00
Louis Dionne 363393c4b3 [libc++abi] Adjust XFAIL on macOS for bug that was fixed in recent OSes 2020-05-12 17:00:03 -04:00
Sergey Dmitriev 32f5ee830b [Attributor] Fixup block addresses after rewriting function signature
Reviewers: jdoerfert, sstefan1, uenoku

Reviewed By: jdoerfert

Subscribers: hiraditya, uenoku, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79801
2020-05-12 13:53:04 -07:00
Richard Smith 6c29073efb PR45589: Properly decompose overloaded `&&` and `||` operators in
constraint expressions.

We create overloaded `&&` and `||` operators to hold the possible
unqualified lookup results (if any) when the operands are dependent. We
could avoid building these in some cases (we will never use the stored
lookup results, and it would be better to not store them or perform the
lookups), but in the general case we will probably still need to handle
overloaded operators even with that optimization.
2020-05-12 13:45:45 -07:00
Stephen Neuendorffer 7a17f3ccd1 [MLIR] Fix dependencies for Analysis libraries
cmake does not truly support dependencies on automatically generated files
which are not in the same directory as the targets which depend on them.
It works with ninja, but doesn't work with make

This patch adds an explicit dependence so that all dialects are built
before the analysis libraries.

Differential Revision: https://reviews.llvm.org/D79805
2020-05-12 13:41:16 -07:00
Artem Dergachev 11c8c2a551 [analyzer] SATestBuild.py: Fix support for #NOPREFIX.
Regressed in ec2d93c.
2020-05-12 22:43:32 +03:00
Stephen Neuendorffer 661b234cbc [MLIR] Rename SideEffects.td -> SideEffectInterfaces.td
This normalize the name of the tablegen file with the name of the generated
files (SideEffectInterfaces.h.inc) and the other Interface tablegen files,
which all end in Interface(s).td

Differential Revision: https://reviews.llvm.org/D79517
2020-05-12 12:21:42 -07:00
Fred Riss d9166ad272 [lldb/Driver] Support terminal resizing
Summary:
The comment in the Editine.h header made it sound like editline was
just unable to handle terminal resizing. We were not ever telling
editline that the terminal had changed size, which might explain why
it wasn't working.

This patch threads a `TerminalSizeChanged()` callback through the
IOHandler and invokes it from the SIGWINCH handler in the driver. Our
`Editline` class already had a `TerminalSizeChanged()` method which
was invoked only when editline was configured.

This patch also changes `Editline` to not apply the changes right away
in `TerminalSizeChanged()`, but instead defer that to the next
character read. During my testing, it happened once that the signal
was received while our `ConnectionFileDescriptor::Read` was allocating
memory. As `el_resize` seems to allocate memory too, this crashed.

Reviewers: labath, teemperor

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D79654
2020-05-12 11:55:25 -07:00
David Blaikie aa99da5ace Avoid binding pointers to "auto&" (by dereferencing the pointer that's non-null anyway)
Based on @djtodoro's 2552dc5317
2020-05-12 11:40:00 -07:00
zoecarver ce195fb22b [libcxx] Re-commit: shared_ptr changes from library fundamentals (P0414R2).
Implements P0414R2:
  * Adds support for array types in std::shared_ptr.
  * Adds reinterpret_pointer_cast for shared_ptr.

Re-committing now that the leaking tests are fixed.

Differential Revision: https://reviews.llvm.org/D62259
2020-05-12 11:23:18 -07:00
Kamau Bridgeman cd83333fc8 [PowerPC] Fold redundant load immediates of zero and delete if possible
This patch folds redundant load immediates into a zero for instructions
which recognise this as the value zero and not the register. If the load
immediate is no longer in use it is then deleted.

This is already done in earlier passes but the ppc-mi-peephole allows for
a more general implementation.

Differential Revision: https://reviews.llvm.org/D69168
2020-05-12 13:15:06 -05:00
Jonas Devlieghere bad61548b2 [Reproducers] Serialize process arguments in ProcessInfo
While debugging why TestProcessList.py failed during passive replay, I
remembered that we don't serialize the arguments for ProcessInfo. This
is necessary to make the test pass and to make platform process list -v
behave the same during capture and replay.

Differential revision: https://reviews.llvm.org/D79646
2020-05-12 11:12:37 -07:00
Jan Korous 9202df35b2 [FileCollector][NFC] Add comments
Differential Revision: https://reviews.llvm.org/D78961
2020-05-12 11:02:31 -07:00
Juneyoung Lee e5f602d82c [ValueTracking] Let propagatesPoison support binops/unaryops/cast/etc.
Summary:
This patch makes propagatesPoison be more accurate by returning true on
more bin ops/unary ops/casts/etc.

The changed test in ScalarEvolution/nsw.ll was introduced by
a19edc4d15 .
IIUC, the goal of the tests is to show that iv.inc's SCEV expression still has
no-overflow flags even if the loop isn't in the wanted form.
It becomes more accurate with this patch, so think this is okay.

Reviewers: spatel, lebedev.ri, jdoerfert, reames, nikic, sanjoy

Reviewed By: spatel, nikic

Subscribers: regehr, nlopes, efriedma, fhahn, javed.absar, llvm-commits, hiraditya

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78615
2020-05-13 02:51:42 +09:00
Craig Topper 01636c1eea [X86] Remove the v16i8->v16i16 path for MULHS with AVX2.
We have a couple main strategies for legalizing MULH.

-If the vXi16 type is legal, extend to do the full i16 multiply
and then shift and truncate the results.
-Use unpcks to split each 128 bit lane into high and low halves.a

For signed we have an extra case to split a v32i8 to v16i8 and then
use the extending to v16i16 strategy.

This patch proposes to use the unpck strategy instead. Which is
what we already do for unsigned.

This seems to be 1 instruction shorter when the RHS is constant
like the idiv case. It's 1 instruction longer for the smulo case.
But we're trading cross lane shuffles for inlane shuffles and a
shift.

Differential Revision: https://reviews.llvm.org/D79652
2020-05-12 10:32:01 -07:00
Dimitry Andric fc373522b0 [arm] Add big-endian version of pcrel fixups for adr instructions
Summary:
In 2e24219d3c, a number of ARM pcrel fixups were resolved at assembly
time, to solve PR44929. This only covered little-endian ARM however, so
add similar fixups for big-endian ARM. Also extend the test case to
cover big-endian ARM.

Reviewers: hans, psmith, MaskRay

Reviewed By: psmith, MaskRay

Subscribers: kristof.beyls, hiraditya, danielkiss, emaste, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79774
2020-05-12 19:27:48 +02:00
Austin Kerbow 9f0b736126 [AMDGPU] Add AGPRs to getRegClassForSizeOnBank
Differential Revision: https://reviews.llvm.org/D79761
2020-05-12 10:14:00 -07:00
Craig Topper 8c72b0271b [CodeGen] Use Align in MachineConstantPool. 2020-05-12 10:06:40 -07:00
Sanjay Patel 93bd696347 [VectorCombine] add test to check for iterative improvements; NFC 2020-05-12 12:49:25 -04:00
Thomas Lively 3d49d1cfa7 [WebAssembly] Implement pseudo-min/max SIMD instructions
Summary:
As proposed in https://github.com/WebAssembly/simd/pull/122. Since
these instructions are not yet merged to the SIMD spec proposal, this
patch makes them entirely opt-in by surfacing them only through LLVM
intrinsics and clang builtins. If these instructions are made
official, these intrinsics and builtins should be replaced with simple
instruction patterns.

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D79742
2020-05-12 09:39:01 -07:00
Fangrui Song 25a95f49b0 [gcov][test] Fix clang test 2020-05-12 09:21:19 -07:00
Fangrui Song b56b1e67e3 [gcov] Default coverage version to '408*' and delete CC1 option -coverage-exit-block-before-body
gcov 4.8 (r189778) moved the exit block from the last to the second.
The .gcda format is compatible with 4.7 but

* decoding libgcov 4.7 produced .gcda with gcov [4.7,8) can mistake the
  exit block, emit bogus `%s:'%s' has arcs from exit block\n` warnings,
  and print wrong `" returned %s` for branch statistics (-b).
* decoding libgcov 4.8 produced .gcda with gcov 4.7 has similar issues.

Also, rename "return block" to "exit block" because the latter is the
appropriate term.
2020-05-12 09:14:03 -07:00
Whitney Tsang 5c10c6e012 [PassBuilder] Moved ProfileSummaryAnalysis in buildInlinerPipeline.
Summary:
As commented in the code, ProfileSummaryAnalysis is required for inliner
pass to query, so this patch moved
RequireAnalysisPass<ProfileSummaryAnalysis> in the recently created
buildInlinerPipeline.
Reviewer: mtrofin, davidxl, tejohnson, dblaikie, jdoerfert, sstefan1
Reviewed By: mtrofin, davidxl, jdoerfert
Subscribers: hiraditya, steven_wu, dexonsmith, wuzish, llvm-commits,
jsji
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D79696
2020-05-12 16:00:40 +00:00
Jay Foad 989be65b11 [GlobalISel][IRTranslator] Fix <1 x Ty> handling in ConstantExprs
Summary:
ConstantExprs involving operations on <1 x Ty> could translate into MIR
that failed to verify with:
*** Bad machine code: Reading virtual register without a def ***

The problem was that translate(const Constant &C, Register Reg) had
recursive calls that passed the same Reg in for the translation of a
subexpression, but without updating VMap for the subexpression first as
translate(const Constant &C, Register Reg) expects.

Fix this by using the same translateCopy helper function that we use for
translating Instructions. In some cases this causes extra G_COPY
MIR instructions to be generated.

Fixes https://bugs.llvm.org/show_bug.cgi?id=45576

Reviewers: arsenm, volkan, t.p.northover, aditya_nandakumar

Subscribers: jvesely, wdng, nhaehnle, rovka, hiraditya, kerbowa, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78378
2020-05-12 16:51:03 +01:00
Jay Foad bd80a8bb87 [GlobalISel][IRTranslator] New helper function translateCopy. NFC.
Reviewers: arsenm, volkan, t.p.northover, aditya_nandakumar

Subscribers: wdng, rovka, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78377
2020-05-12 16:51:03 +01:00
Florian Hahn ffcaed32ef [Matrix] Check non-dependent elt type before creating DepSizedMatrix.
We should check non-dependent element types before creating a
DependentSizedMatrixType. Otherwise we do not generate an error message
for dependent-sized matrix types with invalid non-dependent element
types, if the template is never instantiated. See the make5 struct in
the tests.

It also moves the SEMA template tests to
clang/test/SemaTemplate/matrix-type.cpp and introduces a few more test
cases.
2020-05-12 16:46:37 +01:00
Michael Kruse 5c707fd97c [docs] Corrected inaccuracies in Common Problems section.
Changed the language in LLVM_USE_LINKER to more strongly recommend LLD
and to specify that the GNU gold linker is only useful if LLD is
unavailable in binary form and it is the first build of LLVM. Added that
LLD will help when used on ELF-based platforms.

Corrected information in CMAKE_BUILD_TYPE regarding the Release build
type and enabling assertions.

Added option LLVM_ENABLE_ASSERTIONS and mentioned enabling this option
with a Release build as an alternative to using a Debug build.

Specified that the LLVM_OPTIMIZED_TABLEGEN
option is only for Debug builds, that the LLVM_USE_SPLIT_DWARF option
is only available on ELF host platforms, and that setting
CLANG_ENABLE_STATIC_ANALYZER to OFF only slightly improves build time.

These changes address comments made in D75425.

Reviewed By: Meinersbur

Differential Revision: https://reviews.llvm.org/D77346
2020-05-12 10:09:37 -05:00
Jez Ng 87b6fd3e02 [lld-macho] Add support for creating and reading reexported dylibs
This unblocks the linking of real programs, since many core system
functions are only available as sub-libraries of libSystem.

Differential Revision: https://reviews.llvm.org/D79228
2020-05-12 07:52:03 -07:00
Jez Ng c8c39185f3 [lld-macho] Re-add dylink-lazy test
This reverts commit eb81de2de4003e3045fdf743e093f77e37aee9bf; the
test commands just needed to be run under llvm-lit.
2020-05-12 07:52:03 -07:00