lldb.git
2 years ago[AliasAnalysis] Misc fixes for checking aliasing with scalable types.
Eli Friedman [Mon, 16 Mar 2020 18:13:20 +0000 (11:13 -0700)]
[AliasAnalysis] Misc fixes for checking aliasing with scalable types.

This is fixing up various places that use the implicit
TypeSize->uint64_t conversion.

The new overloads in MemoryLocation.h are already used in various places
that construct a MemoryLocation from a TypeSize, including MemorySSA.
(They were using the implicit conversion before.)

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

2 years ago[OPENMP50]Add support for extended device clause in target directives.
Alexey Bataev [Wed, 18 Mar 2020 19:01:15 +0000 (15:01 -0400)]
[OPENMP50]Add support for extended device clause in target directives.

Added parsing/sema/serialization support for extended device clause in
executable target directives.

2 years ago[ValueTracking] Add computeKnownBits DemandedElts support to EXTRACTELEMENT/OR/BSWAP...
Simon Pilgrim [Wed, 18 Mar 2020 18:49:45 +0000 (18:49 +0000)]
[ValueTracking] Add computeKnownBits DemandedElts support to EXTRACTELEMENT/OR/BSWAP/BITREVERSE instructions (PR36319)

These are all covered by the bswap/bitreverse vector tests.

2 years ago[HIP] Fix duplicate clang -cc1 options on MSVC toolchain
Yaxun (Sam) Liu [Wed, 11 Mar 2020 20:40:28 +0000 (16:40 -0400)]
[HIP] Fix duplicate clang -cc1 options on MSVC toolchain

HIPToolChain::TranslateArgs call TranslateArgs of host toolchain with
the input args to get a list of derived args called DAL, then
go through the input args by itself and append them to DAL.

This assumes that the host toolchain should not append any unchanged
args to DAL, otherwise there will be duplicates since
HIPToolChain will append it again.

This works for GNU toolchain since it returns an empty list for DAL.

However, MSVC toolchain will append unchanged args to DAL, which
causes duplicate args.

This patch let MSVC toolchain not append unchanged args for HIP
offloading kind, which fixes this issue.

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

2 years ago[TSan] Support pointer authentication in setjmp/longjmp interceptors
Julian Lettner [Mon, 16 Mar 2020 18:27:15 +0000 (11:27 -0700)]
[TSan] Support pointer authentication in setjmp/longjmp interceptors

arm64e adds support for pointer authentication, which was adopted by
libplatform to harden setjmp/longjmp and friends.  We need to teach
the TSan interceptors for those functions about this.

Reviewed By: kubamracek

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

2 years ago[PowerPC] Remove UB from PPCInstrInfo when handling rotates fed by constants
Nemanja Ivanovic [Wed, 18 Mar 2020 18:37:47 +0000 (13:37 -0500)]
[PowerPC] Remove UB from PPCInstrInfo when handling rotates fed by constants

As pointed out in https://bugs.llvm.org/show_bug.cgi?id=45232 this code can
end up shifting a 64-bit unsigned value left by 64 bits. Althought this works
as expected on some platforms it is definitely UB. This patch removes the UB
and adds the associated test case.

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

2 years agoReplace get*Alignment() methods with get*Align() equivalents.
Simon Pilgrim [Wed, 18 Mar 2020 18:25:07 +0000 (18:25 +0000)]
Replace get*Alignment() methods with get*Align() equivalents.

Fixes deprecation warning in EXPENSIVE_CHECKS builds.

2 years ago[InstSimplify] Add bitreverse/bswap vector tests
Simon Pilgrim [Wed, 18 Mar 2020 18:02:36 +0000 (18:02 +0000)]
[InstSimplify] Add bitreverse/bswap vector tests

Shows missing DemandedElts support (PR36319)

2 years ago[GlobalISel] Port some basic undef combines from DAGCombiner.cpp
Jessica Paquette [Wed, 18 Mar 2020 01:59:51 +0000 (18:59 -0700)]
[GlobalISel] Port some basic undef combines from DAGCombiner.cpp

This ports some combines from DAGCombiner.cpp which perform some trivial
transformations on instructions with undef operands.

Not having these can make it extremely annoying to find out where we differ
from SelectionDAG by looking at existing lit tests. Without them, we tend to
produce pretty bad code generation when we run into instructions which use
undef operands.

Also remove the nonpow2_store_narrowing testcase from arm64-fallback.ll, since
we no longer fall back on the add.

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

2 years ago[Dominators] Fixup comments in GenericDominatorTreeConstruction. NFC.
Jakub Kuderski [Wed, 18 Mar 2020 17:57:36 +0000 (13:57 -0400)]
[Dominators] Fixup comments in GenericDominatorTreeConstruction. NFC.

Reviewers: asbirlea, brzycki, NutshellySima, grosser

Reviewed By: asbirlea, NutshellySima

Subscribers: llvm-commits

Tags: #llvm

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

2 years agoAdd missing module map entry.
Adrian Prantl [Wed, 18 Mar 2020 17:50:23 +0000 (10:50 -0700)]
Add missing module map entry.

2 years agoSupport repeated machine outlining
Jin Lin [Tue, 17 Mar 2020 22:40:26 +0000 (15:40 -0700)]
Support repeated machine outlining

Summary: The following change is to allow the machine outlining can be applied for Nth times, where N is specified by the compiler option. By default the value of N is 1. The motivation is that the repeated machine outlining can further reduce code size.  Please refer to the presentation "Improving Swift Binary Size via Link Time Optimization" in LLVM Developers' Meeting in 2019.

Reviewers: aschwaighofer, tellenbach, paquette

Reviewed By: paquette

Subscribers: tellenbach, hiraditya, llvm-commits, jinlin

Tags: #llvm

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

2 years ago[VPlan] Use underlying value for printing, if available.
Florian Hahn [Wed, 18 Mar 2020 17:39:11 +0000 (17:39 +0000)]
[VPlan] Use underlying value for printing, if available.

When the an underlying value is available, we can use its name for
printing, as discussed in D73078.

Reviewers: rengolin, hsaito, Ayal, gilr

Reviewed By: Ayal

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

2 years ago[ARM,MVE] Add intrinsics for the VQDMLAD family.
Simon Tatham [Wed, 18 Mar 2020 16:19:35 +0000 (16:19 +0000)]
[ARM,MVE] Add intrinsics for the VQDMLAD family.

Summary:
This is another set of instructions too complicated to be sensibly
expressed in IR by anything short of a target-specific intrinsic.
Given input vectors a,b, the instruction generates intermediate values
2*(a[0]*b[0]+a[1]+b[1]), 2*(a[2]*b[2]+a[3]+b[3]), etc; takes the high
half of each double-width values, and overwrites half the lanes in the
output vector c, which you therefore have to provide the input value
of. Optionally you can swap the elements of b so that the are things
like a[0]*b[1]+a[1]*b[0]; optionally you can round to nearest when
taking the high half; and optionally you can take the difference
rather than sum of the two products. Finally, saturation is applied
when converting back to a single-width vector lane.

Reviewers: dmgreen, MarkMurrayARM, miyuki, ostannard

Reviewed By: miyuki

Subscribers: kristof.beyls, hiraditya, cfe-commits

Tags: #clang

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

2 years agoRevert "[Syntax] Build template declaration nodes"
Nico Weber [Wed, 18 Mar 2020 16:57:55 +0000 (12:57 -0400)]
Revert "[Syntax] Build template declaration nodes"

This reverts commit dd12826808f9079e164b82e64b0697a077379241.
Breaks tests on Windows, see https://reviews.llvm.org/D76346#1929208

2 years ago[libc] Adding memcpy implementation for x86_64
Guillaume Chatelet [Tue, 11 Feb 2020 12:37:02 +0000 (13:37 +0100)]
[libc] Adding memcpy implementation for x86_64

Summary:
The patch is not ready yet and is here to discuss a few options:
 - How do we customize the implementation? (i.e. how to define `kRepMovsBSize`),
 - How do we specify custom compilation flags? (We'd need `-fno-builtin-memcpy` to be passed in),
 - How do we build? We may want to test in debug but build the libc with `-march=native` for instance,
 - Clang has a brand new builtin `__builtin_memcpy_inline` which makes the implementation easy and efficient, but:
   - If we compile with `gcc` or `msvc` we can't use it, resorting on less efficient code generation,
   - With gcc we can use `__builtin_memcpy` but then we'd need a postprocess step to check that the final assembly do not contain call to `memcpy` (unlikely but allowed),
   - For msvc we'd need to resort on the compiler optimization passes.

Reviewers: sivachandra, abrachet

Subscribers: mgorny, MaskRay, tschuett, libc-commits, courbet

Tags: #libc-project

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

2 years ago[gn build] remove a workaround that is no longer needed
Nico Weber [Wed, 18 Mar 2020 16:37:08 +0000 (12:37 -0400)]
[gn build] remove a workaround that is no longer needed

2 years ago[NFC][PowerPC] Update test
Sam Parker [Wed, 18 Mar 2020 16:20:56 +0000 (16:20 +0000)]
[NFC][PowerPC] Update test

Run the update script on one of the loop unroll tests.

2 years agoAMDGPU: Initial, crude support for indirect calls
Matt Arsenault [Tue, 17 Mar 2020 01:07:46 +0000 (21:07 -0400)]
AMDGPU: Initial, crude support for indirect calls

This isn't really usable, and requires using the
-amdgpu-fixed-function-abi flag to work.

Assumes a uniform call target, and will hit a verifier error if the
call target ends up in a VGPR. Also doesn't attempt to do anything
sensible for the reported register/stack usage.

2 years agoReapply "AMDGPU/GlobalISel: Fully handle 0 dmask case during legalize"
Matt Arsenault [Wed, 18 Mar 2020 14:11:09 +0000 (10:11 -0400)]
Reapply "AMDGPU/GlobalISel: Fully handle 0 dmask case during legalize"

This reverts commit 9bca8fc4cf5d290b576618d14a105fafe80cf5ae.

Rearrange handling to avoid changing the instruction in the case where
it's going to be erased and replaced with undef.

2 years ago[AMDGPU] Fix AMDGPUUnifyDivergentExitNodes
Piotr Sobczak [Wed, 18 Mar 2020 13:24:09 +0000 (14:24 +0100)]
[AMDGPU] Fix AMDGPUUnifyDivergentExitNodes

Summary:
For the case where "done" bits on existing exports are removed
by unifyReturnBlockSet(), unify all return blocks - even the
uniformly reached ones. We do not want to end up with a non-unified,
uniformly reached block containing a normal export with the "done"
bit cleared.

That case is believed to be rare - possible with infinite loops
in pixel shaders.

This is a fix for D71192.

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

2 years ago[gn build] add rebase changes that should have been in 9f981e9adf9c8d29bb80306daf08d2...
Nico Weber [Wed, 18 Mar 2020 15:38:25 +0000 (11:38 -0400)]
[gn build] add rebase changes that should have been in 9f981e9adf9c8d29bb80306daf08d2770263ade6

2 years ago[ValueTracking] Add computeKnownBits DemandedElts support to AND instructions (PR36319)
Simon Pilgrim [Wed, 18 Mar 2020 15:31:49 +0000 (15:31 +0000)]
[ValueTracking] Add computeKnownBits DemandedElts support to AND instructions (PR36319)

2 years agoReland "[gn build] (manually) port 8b409eaba"
Nico Weber [Wed, 18 Mar 2020 15:28:57 +0000 (11:28 -0400)]
Reland "[gn build] (manually) port 8b409eaba"

This reverts commit 4060016fce3e6a0b926ee9fc59e440a612d3a2ec
and re-merges c5b81466c.

2 years ago[Syntax] Build template declaration nodes
Marcel Hlopko [Wed, 18 Mar 2020 15:00:07 +0000 (16:00 +0100)]
[Syntax] Build template declaration nodes

Summary:
Copy of https://reviews.llvm.org/D72334, submitting with Ilya's permission.

Handles template declaration of all kinds.

Also builds template declaration nodes for specializations and explicit
instantiations of classes.

Some missing things will be addressed in the follow-up patches:

specializations of functions and variables,
template parameters.

Reviewers: gribozavr2

Reviewed By: gribozavr2

Subscribers: cfe-commits

Tags: #clang

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

2 years ago[InstCombine] GEPOperator::accumulateConstantOffset does not support scalable vectors
Sander de Smalen [Wed, 18 Mar 2020 12:46:42 +0000 (12:46 +0000)]
[InstCombine] GEPOperator::accumulateConstantOffset does not support scalable vectors

Avoid transforming:

 %0 = bitcast i8* %base to <vscale x 16 x i8>*
 %1 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %0, i64 1

into:

 %0 = getelementptr i8, i8* %base, i64 16
 %1 = bitcast i8* %0 to <vscale x 16 x i8>*

Reviewers: efriedma, ctetreau

Reviewed By: efriedma

Tags: #llvm

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

2 years ago[PowerPC][AIX] Implement by-val caller arguments in a single register.
Chris Bowler [Wed, 18 Mar 2020 14:24:34 +0000 (10:24 -0400)]
[PowerPC][AIX] Implement by-val caller arguments in a single register.

This is the first of a series of patches that adds caller support for
by-value arguments. This patch add support for arguments that are passed in a
single GPR.

There are 3 limitation cases:
-The by-value argument is larger than a single register.
-There are no remaining GPRs even though the by-value argument would
otherwise fit in a single GPR.
-The by-value argument requires alignment greater than register width.

Future patches will be required to add support for these cases as well
as for the callee handling (in LowerFormalArguments_AIX) that
corresponds to this work.

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

2 years ago[lldb] [testsuite] Enable forgotten -gsplit-dwarf for 2 testfiles
Jan Kratochvil [Wed, 18 Mar 2020 14:49:24 +0000 (15:49 +0100)]
[lldb] [testsuite] Enable forgotten -gsplit-dwarf for 2 testfiles

D63643 added these testfiles but some of the %t4dwo and %t5dwo builds
are the same as corresponding %t4 and %t5 builds. Fortunately the
testcases do PASS.

After just adding -gsplit-dwarf these both skeleton files:
  tools/lldb/test/SymbolFile/DWARF/Output/debug-types-expressions.test.tmp4dwo
  tools/lldb/test/SymbolFile/DWARF/Output/debug-types-expressions.test.tmp5dwo

were referencing to this one non-skeleton file:
  tools/lldb/test/SymbolFile/DWARF/debug-types-expressions.dwo

Surprisingly it does not affect the other test debug-types-basic.test
probably because it compiles to .o and then links it. While
debug-types-expressions.test compiles directly to an executable.

So fixed that while keeping the direct executable compilation.

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

2 years ago[InstCombine][X86] Add additional demandedelts style test for in-range variable per...
Simon Pilgrim [Wed, 18 Mar 2020 14:36:05 +0000 (14:36 +0000)]
[InstCombine][X86] Add additional demandedelts style test for in-range variable per-element shift amounts (PR40391)

If we've shuffled the shift amount some of the (undemanded) elements may have become undef - this should be handled by the missing support in PR36319.

2 years agoFix `warning: extra ‘;’` (NFC)
Mehdi Amini [Wed, 18 Mar 2020 14:21:14 +0000 (14:21 +0000)]
Fix `warning: extra ‘;’` (NFC)

2 years agoFix build with gcc 7.5 by adding a "redundant move"
Mehdi Amini [Wed, 18 Mar 2020 13:36:17 +0000 (13:36 +0000)]
Fix build with gcc 7.5 by adding a "redundant move"

The constructor of Expected<T> expects as T&&, but gcc-7.5 does not
infer an rvalue in this context apparently.

2 years ago[NFCI][SCEV] Avoid recursion in SCEVExpander::isHighCostExpansion*()
Roman Lebedev [Wed, 18 Mar 2020 12:02:31 +0000 (15:02 +0300)]
[NFCI][SCEV] Avoid recursion in SCEVExpander::isHighCostExpansion*()

Summary:
As noted in [[ https://bugs.llvm.org/show_bug.cgi?id=45201 | PR45201 ]],
[[ https://bugs.llvm.org/show_bug.cgi?id=10090 | PR10090 ]] SCEV doesn't
always avoid recursive algorithms, and that causes issues with
large expression depths and/or smaller stack sizes.

In `SCEVExpander::isHighCostExpansion*()` case, the refactoring to avoid
recursion is rather idiomatic. We simply need to place the root expr
into a vector, and iterate over vector elements accounting for the cost
of each one, adding new exprs at the end of the vector,
thus achieving recursion-less traversal.

The order in which we will visit exprs doesn't matter here,
so we will be fine with the most basic approach of using SmallVector
and inserting/extracting from the back, which accidentally is the same
depth-first traversal that we were doing previously recursively.

Reviewers: mkazantsev, reames, wmi, ekatz

Reviewed By: mkazantsev

Subscribers: hiraditya, javed.absar, llvm-commits

Tags: #llvm

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

2 years ago[IPRA][ARM] Spill extra registers at -Oz
Oliver Stannard [Thu, 18 Jul 2019 09:40:48 +0000 (10:40 +0100)]
[IPRA][ARM] Spill extra registers at -Oz

When optimising for code size at the expense of performance, it is often
worth saving and restoring some of r0-r3, if IPRA will be able to take
advantage of them. This doesn't cost any extra code size if we already
have a PUSH/POP pair, and increases the number of available registers
across any calls to the function.

We already have an optimisation which tries fold the subtract/add of the
SP into the PUSH/POP by using extra registers, which somewhat conflicts
with this. I've made the new optimisation less aggressive in cases where
the existing one is likely to trigger, which gives better results than
either of these optimisations by themselves.

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

2 years ago[Alignment][NFC] Deprecate getMaxAlignment
Guillaume Chatelet [Wed, 18 Mar 2020 09:50:38 +0000 (10:50 +0100)]
[Alignment][NFC] Deprecate getMaxAlignment

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: jholewinski, arsenm, dschuff, jyknight, sdardis, nemanjai, jvesely, nhaehnle, sbc100, jgravelle-google, hiraditya, aheejin, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, kerbowa, llvm-commits

Tags: #llvm

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

2 years ago[NFC][PowerPC] Add a new MIR file to test if-converter pass
Kang Zhang [Wed, 18 Mar 2020 13:39:49 +0000 (13:39 +0000)]
[NFC][PowerPC] Add a new MIR file to test if-converter pass

2 years ago[NFC] Add missing REQUIRES clause to a test
Danila Malyutin [Wed, 18 Mar 2020 13:25:21 +0000 (16:25 +0300)]
[NFC] Add missing REQUIRES clause to a test

2 years ago[hip] Revise `GlobalDecl` constructors. NFC.
Michael Liao [Wed, 18 Mar 2020 05:43:20 +0000 (01:43 -0400)]
[hip] Revise `GlobalDecl` constructors. NFC.

Summary:
- https://reviews.llvm.org/D68578 revises the `GlobalDecl` constructors
  to ensure all GPU kernels have `ReferenceKenelKind` initialized
  properly with an explicit constructor and static one. But, there are
  lots of places using the implicit constructor triggering the assertion
  on non-GPU kernels. That's found in compilation of many tests and
  workloads.
- Fixing all of them may change more code and, more importantly, all of
  them assumes the default kernel reference kind. This patch changes
  that constructor to tell `CUDAGlobalAttr` and construct `GlobalDecl`
  properly.

Reviewers: yaxunl

Subscribers: cfe-commits

Tags: #clang

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

2 years ago[ARM] Track epilogue instructions with FrameDestroy flag (NFC)
Oliver Stannard [Thu, 18 Jul 2019 14:58:33 +0000 (15:58 +0100)]
[ARM] Track epilogue instructions with FrameDestroy flag (NFC)

Rather than trying to work out which instructions are part of the
epilogue by examining them, we can just mark them with the FrameDestroy
flag, like we do in the AArch64 backend.

2 years ago[mlir] NFC: Fix trivial typos in documents
Kazuaki Ishizaki [Wed, 18 Mar 2020 09:38:55 +0000 (18:38 +0900)]
[mlir] NFC: Fix trivial typos in documents

Fix trivial typos

Reviewers: mravishankar, antiagainst, ftynse

Reviewed By: ftynse

Subscribers: ftynse, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, Joonsoo, bader, llvm-commits

Tags: #llvm

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

2 years ago[lldb/Target] Support more than 2 symbols in StackFrameRecognizer
Med Ismail Bennani [Fri, 13 Mar 2020 22:56:35 +0000 (23:56 +0100)]
[lldb/Target] Support more than 2 symbols in StackFrameRecognizer

This patch changes the way the StackFrame Recognizers match a certain
frame.

Until now, recognizers could be registered with a function
name but also an alternate symbol.
This change is motivated by a test failure for the Assert frame
recognizer on Linux. Depending the version of the libc, the abort
function (triggered by an assertion), could have more than two
signatures (i.e. `raise`, `__GI_raise` and `gsignal`).

Instead of only checking the default symbol name and the alternate one,
lldb will iterate over a list of symbols to match against.

rdar://60386577

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[OPENMP50]Codegen for detach clause.
Alexey Bataev [Wed, 18 Mar 2020 12:29:39 +0000 (08:29 -0400)]
[OPENMP50]Codegen for detach clause.

Implemented codegen for detach clause in task directives.

2 years ago[llvm][SVE] Addressing mode for FF/NF loads.
Francesco Petrogalli [Mon, 9 Mar 2020 19:32:29 +0000 (19:32 +0000)]
[llvm][SVE] Addressing mode for FF/NF loads.

Summary:
This patch adds addressing mode computation for the following SVE
instructions:

* ldff1{s}<T1> { <Zt>.<T2> }, <Pg>/Z, [<Xn|SP>{, <Xm>{, lsl #imm}}]
* ldnf1{s}<T1> { <Zt>.<T2> }, <Pg>/Z, [<Xn|SP>{, #<imm>, mul vl}]

Reviewers: andwar, sdesmalen, rengolin, efriedma

Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

2 years ago[AArch64][SVE] Change pointer type of nontemporal load/store intrinsics
Sander de Smalen [Wed, 18 Mar 2020 11:19:25 +0000 (11:19 +0000)]
[AArch64][SVE] Change pointer type of nontemporal load/store intrinsics

Summary:
This fixes a discrepancy between the non-temporal loads/store
intrinsics and other SVE load intrinsics (such as nf/ff), so
that Clang can use the same code to generate these intrinsics.

Reviewers: andwar, kmclaughlin, rengolin, efriedma

Reviewed By: efriedma

Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

2 years agoFix possible assertion when using PBQP with debug info
Danila Malyutin [Tue, 17 Mar 2020 15:16:39 +0000 (18:16 +0300)]
Fix possible assertion when using PBQP with debug info

Skip debug instructions before calling functions not expecting them.
In particular, LIS.getInstructionIndex(*mi) would fail if mi was a debg instr.

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

2 years ago[DebugInfo] Fix multi-byte entry values in call site values
David Stenberg [Wed, 18 Mar 2020 10:32:03 +0000 (11:32 +0100)]
[DebugInfo] Fix multi-byte entry values in call site values

Summary:
In D67768/D67492 I added support for entry values having blocks larger
than one byte, but I now noticed that the DIE implementation I added there
was broken. The takeNodes() function, that moves the entry value block
from a temporary buffer to the output buffer, would destroy the input
iterator when transferring the first node, meaning that only that node
was moved.

In practice, this meant that when emitting a call site value using a
DW_OP_entry_value operation with a DWARF register number larger than 31,
that multi-byte DW_OP_regx expression would be truncated.

Reviewers: djtodoro, aprantl, vsk

Reviewed By: djtodoro

Subscribers: llvm-commits

Tags: #debug-info, #llvm

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

2 years ago[SCCP] Precommit some additional tests for integer ranges.
Florian Hahn [Wed, 18 Mar 2020 11:33:38 +0000 (11:33 +0000)]
[SCCP] Precommit some additional tests for integer ranges.

2 years ago[InstCombine][X86] simplifyX86varShift - convert variable in-range per-element shift...
Simon Pilgrim [Wed, 18 Mar 2020 11:26:30 +0000 (11:26 +0000)]
[InstCombine][X86] simplifyX86varShift - convert variable in-range per-element shift amounts to generic shifts (PR40391)

AVX2/AVX512 per-element shifts can be replaced with generic shifts if the shift amounts are guaranteed to be in-range (upper bits are known zero).

2 years agoReland D75470 [SVE] Auto-generate builtins and header for svld1.
Sander de Smalen [Wed, 18 Mar 2020 11:07:20 +0000 (11:07 +0000)]
Reland D75470 [SVE] Auto-generate builtins and header for svld1.

Reworked the patch to avoid sharing a header (SVETypeFlags.h) between
include/clang/Basic and utils/TableGen/SveEmitter.cpp. Now the patch
generates the enum/flags which is included in TargetBuiltins.h.

Also renamed one of the SveEmitter options to be in line with MVE.

Summary:

This is a first patch in a series for the SveEmitter to generate the arm_sve.h
header file and builtins.

I've tried my best to strip down this patch as best as I could, but there
are still a few changes that are not necessarily exercised by the load intrinsics
in this patch, mostly around the SVEType class which has some common logic to
represent types from a type and prototype string. I thought it didn't make
much sense to remove that from this patch and split it up.

2 years ago[ARM,MVE] Add intrinsics for the VQDMLAH family.
Simon Tatham [Wed, 11 Mar 2020 12:48:52 +0000 (12:48 +0000)]
[ARM,MVE] Add intrinsics for the VQDMLAH family.

Summary:
These are complicated integer multiply+add instructions with extra
saturation, taking the high half of a double-width product, and
optional rounding. There's no sensible way to represent that in
standard IR, so I've converted the clang builtins directly to
target-specific intrinsics.

Reviewers: dmgreen, MarkMurrayARM, miyuki, ostannard

Reviewed By: miyuki

Subscribers: kristof.beyls, hiraditya, cfe-commits

Tags: #clang

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

2 years ago[ARM,MVE] Add intrinsics and isel for MVE integer VMLA.
Simon Tatham [Wed, 11 Mar 2020 12:48:36 +0000 (12:48 +0000)]
[ARM,MVE] Add intrinsics and isel for MVE integer VMLA.

Summary:
These instructions compute multiply+add in integers, with one of the
operands being a splat of a scalar. (VMLA and VMLAS differ in whether
the splat operand is a multiplier or the addend.)

I've represented these in IR using existing standard IR operations for
the unpredicated forms. The predicated forms are done with target-
specific intrinsics, as usual.

When operating on n-bit vector lanes, only the bottom n bits of the
i32 scalar operand are used. So we have to tell that to isel lowering,
to allow it to remove a pointless sign- or zero-extension instruction
on that input register. That's done in `PerformIntrinsicCombine`, but
first I had to enable `PerformIntrinsicCombine` for MVE targets
(previously all the intrinsics it handled were for NEON), and make it
a method of `ARMTargetLowering` so that it can get at
`SimplifyDemandedBits`.

Reviewers: dmgreen, MarkMurrayARM, miyuki, ostannard

Reviewed By: dmgreen

Subscribers: kristof.beyls, hiraditya, danielkiss, cfe-commits

Tags: #clang

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

2 years agoFix ac1d23ed7de01fb3 interaction with gold plugin
serge-sans-paille [Wed, 18 Mar 2020 10:38:44 +0000 (11:38 +0100)]
Fix ac1d23ed7de01fb3 interaction with gold plugin

Correctly set RelocationModel, thanks @modocache for spotting this.

Related to differential revision: https://reviews.llvm.org/D75579

2 years ago[InstCombine][X86] Tests for variable but in-range per-element shift amounts (PR40391)
Simon Pilgrim [Wed, 18 Mar 2020 10:28:17 +0000 (10:28 +0000)]
[InstCombine][X86] Tests for variable but in-range per-element shift amounts (PR40391)

These shifts are masked to be inrange so we should be able to replace them with generic shifts.

2 years ago[SCCP] Use constant ranges for select, if cond is overdefined.
Florian Hahn [Wed, 18 Mar 2020 09:25:24 +0000 (09:25 +0000)]
[SCCP] Use constant ranges for select, if cond is overdefined.

For selects with an unknown condition, we can approximate the result by
merging the state of both options. This automatically takes care of
the case where on operand is undef.

Reviewers: davide, efriedma, mssimpso

Reviewed By: efriedma

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

2 years ago[NFC][ARM] Add thumb triple to test
Sam Parker [Wed, 18 Mar 2020 09:15:19 +0000 (09:15 +0000)]
[NFC][ARM] Add thumb triple to test

Test the costs of selects for thumbv8m.base too.

2 years ago[clang] Fix crash on visiting null nestedNameSpecifier.
Haojian Wu [Tue, 17 Mar 2020 20:39:19 +0000 (21:39 +0100)]
[clang] Fix crash on visiting null nestedNameSpecifier.

Summary: Fix https://github.com/clangd/clangd/issues/293

Reviewers: sammccall

Subscribers: ilya-biryukov, kadircet, usaxena95, cfe-commits

Tags: #clang

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

2 years ago[Alignment][NFC] Deprecate getTransientStackAlignment
Guillaume Chatelet [Tue, 17 Mar 2020 17:27:59 +0000 (18:27 +0100)]
[Alignment][NFC] Deprecate getTransientStackAlignment

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: jholewinski, hiraditya, llvm-commits

Tags: #llvm

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

2 years agoCET for Exception Handle
Pengfei Wang [Wed, 18 Mar 2020 04:39:49 +0000 (21:39 -0700)]
CET for Exception Handle

Summary:
Bug fix for https://bugs.llvm.org/show_bug.cgi?id=45182
Exception handle may indirectly jump to catch pad, So we should add ENDBR instruction before catch pad instructions.

Reviewers: craig.topper, hjl.tools, LuoYuanke, annita.zhang, pengfei

Reviewed By: LuoYuanke

Subscribers: hiraditya, llvm-commits

Patch By: Xiang Zhang (xiangzhangllvm)

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

2 years ago[libc] Add sigaction
Alex Brachet [Wed, 18 Mar 2020 05:08:59 +0000 (01:08 -0400)]
[libc] Add sigaction

Summary: This patch adds `sigaction` and the `sa_restorer` signal trampoline function `__restore_rt`

Reviewers: sivachandra, MaskRay, PaulkaToast

Reviewed By: sivachandra

Subscribers: gchatelet, mgorny, tschuett, libc-commits

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

2 years agoRevert "AMDGPU/GlobalISel: Fully handle 0 dmask case during legalize"
Vitaly Buka [Wed, 18 Mar 2020 04:13:48 +0000 (21:13 -0700)]
Revert "AMDGPU/GlobalISel: Fully handle 0 dmask case during legalize"

The patch introduced use-after-poison.

This reverts commit d0fe13ecf9a474bfc50f748895f001d292baf396.

2 years ago[mlir][DialectConversion] Print the operation being legalized if it has no regions
River Riddle [Wed, 18 Mar 2020 04:04:54 +0000 (21:04 -0700)]
[mlir][DialectConversion] Print the operation being legalized if it has no regions

This helps when looking at the debug log and understanding what properties the invalid operation has when legalization fails.

2 years agoPR45133: Don't crash if the active member of a union changes while it's
Richard Smith [Wed, 18 Mar 2020 03:31:57 +0000 (20:31 -0700)]
PR45133: Don't crash if the active member of a union changes while it's
in the process of being initialized.

2 years ago[DAGCombine] Respect the uses when combine FMA for a*b+/-c*d
QingShan Zhang [Wed, 18 Mar 2020 03:34:27 +0000 (03:34 +0000)]
[DAGCombine] Respect the uses when combine FMA for a*b+/-c*d

If it is a*b-c*d, it could be also folded into fma(a, b, -c*d) or fma(-c, d, a*b).
This patch is trying to respect the uses of a*b and c*d to make the best choice.

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

2 years ago[mlir] Update DRR patterns to notify the rewriter why a pattern fails to match.
River Riddle [Wed, 18 Mar 2020 03:10:27 +0000 (20:10 -0700)]
[mlir] Update DRR patterns to notify the rewriter why a pattern fails to match.

Summary:
This adds support in RewriterGen for calling into the new `PatternRewriter::notifyMatchFailure` hook. This lets derived pattern rewriters display this information to users, an example from DialectConversion is shown below:

```

Legalizing operation : 'std.and'(0x60e0000066a0) {
  * Fold {
  } -> FAILURE : unable to fold

  * Pattern : 'std.and -> (spv.BitwiseAnd)' {
    ** Failure : operand 0 of op 'std.and' failed to satisfy constraint: '8/16/32/64-bit integer or vector of 8/16/32/64-bit integer values of length 2/3/4'
  } -> FAILURE : pattern failed to match

  * Pattern : 'std.and -> (spv.LogicalAnd)' {
    ** Failure : operand 0 of op 'std.and' failed to satisfy constraint: 'bool or vector of bool values of length 2/3/4'
  } -> FAILURE : pattern failed to match
} -> FAILURE : no matched legalization pattern

```

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

2 years ago[mlir][NFC] Replace all usages of PatternMatchResult with LogicalResult
River Riddle [Wed, 18 Mar 2020 03:07:55 +0000 (20:07 -0700)]
[mlir][NFC] Replace all usages of PatternMatchResult with LogicalResult

This also replaces usages of matchSuccess/matchFailure with success/failure respectively.

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

2 years ago[mlir][Vector] Mostly-NFC - Restructure options for lowering to LLVM Matrix Intrinsics
Nicolas Vasilache [Wed, 18 Mar 2020 02:51:21 +0000 (22:51 -0400)]
[mlir][Vector] Mostly-NFC - Restructure options for lowering to LLVM Matrix Intrinsics

Summary:
This revision restructures the calling of vector transforms to make it more flexible to ask for lowering through LLVM matrix intrinsics.
This also makes sure we bail out in degenerate cases (i.e. 1) in which LLVM complains about not being able to scalarize.

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

2 years ago[MLIR] Add support for out of tree external projects using MLIR
Stephen Neuendorffer [Thu, 12 Mar 2020 05:35:58 +0000 (22:35 -0700)]
[MLIR] Add support for out of tree external projects using MLIR

LLVM has a documented mechanism for passing configuration information
to an out of tree project using cmake.  See
https://llvm.org/docs/CMake.html#embedding-llvm-in-your-project.  This
patch adds similar support for MLIR.

Using this requires something like:

cmake_minimum_required(VERSION 3.4.3)
project(SimpleProject)

find_package(MLIR REQUIRED CONFIG)

include_directories(${LLVM_INCLUDE_DIRS})
include_directories(${MLIR_INCLUDE_DIRS})
link_directories(${LLVM_BUILD_LIBRARY_DIR})
add_definitions(${LLVM_DEFINITIONS})

set(CMAKE_MODULE_PATH
  ${LLVM_CMAKE_DIR}
  ${MLIR_CMAKE_DIR}
  )
include(AddLLVM)
include(TableGen)
include(AddMLIR)

add_executable(test-opt test-opt.cpp)
llvm_update_compile_flags(test-opt)

get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS)
message(dialects=${dialect_libs})
set(LIBS
  ${dialect_libs}
  ${conversion_libs}
  MLIRLoopOpsTransforms
  MLIRLoopAnalysis
  MLIRAnalysis
  MLIRDialect
  MLIREDSC
  MLIROptLib
  MLIRParser
  MLIRPass
  MLIRQuantizerFxpMathConfig
  MLIRQuantizerSupport
  MLIRQuantizerTransforms
  MLIRSPIRV
  MLIRSPIRVTestPasses
  MLIRSPIRVTransforms
  MLIRTransforms
  MLIRTransformUtils
  MLIRTestDialect
  MLIRTestIR
  MLIRTestPass
  MLIRTestTransforms
  MLIRSupport
  MLIRIR
  MLIROptLib
  LLVMSupport
  LLVMCore
  LLVMAsmParser
  )
target_link_libraries(test-opt ${LIBS})

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

2 years agoRevert "Support repeated machine outlining"
Jin Lin [Wed, 18 Mar 2020 01:33:55 +0000 (18:33 -0700)]
Revert "Support repeated machine outlining"

This reverts commit ab2dcff309f99614983db7ef6ee4bf43d24dcc30.

2 years agoSupport repeated machine outlining
Jin Lin [Tue, 17 Mar 2020 22:40:26 +0000 (15:40 -0700)]
Support repeated machine outlining

Summary: The following change is to allow the machine outlining can be applied for Nth times, where N is specified by the compiler option. By default the value of N is 1. The motivation is that the repeated machine outlining can further reduce code size.  Please refer to the presentation "Improving Swift Binary Size via Link Time Optimization" in LLVM Developers' Meeting in 2019.

Reviewers: aschwaighofer, tellenbach, paquette

Reviewed By: paquette

Subscribers: tellenbach, hiraditya, llvm-commits, jinlin

Tags: #llvm

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

2 years agoRevert "Avoid emitting unreachable SP adjustments after `throw`"
Nico Weber [Wed, 18 Mar 2020 00:40:44 +0000 (20:40 -0400)]
Revert "Avoid emitting unreachable SP adjustments after `throw`"

This reverts commit 65b21282c710afe9c275778820c6e3c1cf46734b.
Breaks sanitizer bots (https://reviews.llvm.org/D75712#1927668)
and causes https://crbug.com/1062021 (which may or may not
be a compiler bug, not clear yet).

2 years ago[libc] Add AOR testing dependencies for buildbot workers.
Paula Toth [Wed, 18 Mar 2020 00:42:39 +0000 (17:42 -0700)]
[libc] Add AOR testing dependencies for buildbot workers.

Summary: These dependencies are needed for testing on the buildbots until we migrate AORs into libc.

Reviewers: sivachandra

Reviewed By: sivachandra

Subscribers: MaskRay, tschuett, libc-commits

Tags: #libc-project

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

2 years agoFix `-Wunused-variable` warning. NFC.
Michael Liao [Wed, 18 Mar 2020 00:15:50 +0000 (20:15 -0400)]
Fix `-Wunused-variable` warning. NFC.

2 years agoAMDGPU/GlobalISel: Fix verifier errors on image atomics
Matt Arsenault [Wed, 18 Mar 2020 00:06:02 +0000 (20:06 -0400)]
AMDGPU/GlobalISel: Fix verifier errors on image atomics

2 years ago[lldb/Bindings] Check that process isn't None before calling is_alive.
Jonas Devlieghere [Tue, 17 Mar 2020 23:59:46 +0000 (16:59 -0700)]
[lldb/Bindings] Check that process isn't None before calling is_alive.

Make sure that `process` is not None before calling is_alive. Otherwise
this might result in an AttributeError: 'NoneType' object has no
attribute 'is_alive'.

Although lldb.process and friends could already be None in the past, for
example after leaving an interactive scripting session, the issue became
more prevalent after `fc1fd6bf9fcfac412b10b4193805ec5de0e8df57`.

I audited the other interface files for usages of target, process,
thread and frame, but this seems the only place where a global is used
from an SB class.

2 years ago[AMDGPU] Print DWARF register numbers in AMDGPUInstPrinter
Scott Linder [Mon, 16 Mar 2020 21:12:09 +0000 (17:12 -0400)]
[AMDGPU] Print DWARF register numbers in AMDGPUInstPrinter

Summary:
Explanation is in a comment in the diff, but essentially printing a
physical register name here is ambiguous. Until we can implement
printing a DWARF register name here just use the encoding directly.

Tags: #llvm

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

2 years agoDisable loader-uninitialized tests on Windows
Jon Chesterfield [Tue, 17 Mar 2020 23:33:12 +0000 (23:33 +0000)]
Disable loader-uninitialized tests on Windows

2 years ago[lldb/PlatformDarwin] Return POSIX path from FindXcodeContentsDirectoryInPath
Jonas Devlieghere [Tue, 17 Mar 2020 22:31:47 +0000 (15:31 -0700)]
[lldb/PlatformDarwin] Return POSIX path from FindXcodeContentsDirectoryInPath

Always return a POSIX-style path from FindXcodeContentsDirectoryInPath
so that the output is identical on all host platforms.

2 years ago[mlir][NFC] Renamed VectorOps to Vector
Rob Suderman [Tue, 17 Mar 2020 22:24:27 +0000 (15:24 -0700)]
[mlir][NFC] Renamed VectorOps to Vector

Summary: Renamed VectorOps to Vector to avoid the redundant Ops suffix.

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

2 years ago[mlir][NFC] Rename QuantOps to Quant
Rob Suderman [Tue, 17 Mar 2020 21:56:52 +0000 (14:56 -0700)]
[mlir][NFC] Rename QuantOps to Quant

Summary:
Renamed QuantOps to Quant to avoid the Ops suffix. All dialects will contain
ops, so the Ops suffix is redundant.

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

2 years agoFix arm build broken by D74361 by dropping align from filecheck pattern
Jon Chesterfield [Tue, 17 Mar 2020 22:14:40 +0000 (22:14 +0000)]
Fix arm build broken by D74361 by dropping align from filecheck pattern

2 years ago[clangd] Extend findTarget()'s dependent name heuristic to handle enumerators
Nathan Ridge [Thu, 12 Mar 2020 22:22:44 +0000 (18:22 -0400)]
[clangd] Extend findTarget()'s dependent name heuristic to handle enumerators

Fixes https://github.com/clangd/clangd/issues/296

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

2 years ago[codegen] Fix one more case where `getGlobalDecl` should be used. NFC.
Michael Liao [Tue, 17 Mar 2020 21:37:59 +0000 (17:37 -0400)]
[codegen] Fix one more case where `getGlobalDecl` should be used. NFC.

- After https://reviews.llvm.org/D68578, the implicit conversion from
  `FunctionDecl` to `GlobalDecl` needs replacing with `getGlobalDecl`;
  otherwise, assertion is triggered.

2 years ago[mlir] Add target for Shape dialect
Jacques Pienaar [Tue, 17 Mar 2020 20:34:52 +0000 (13:34 -0700)]
[mlir] Add target for Shape dialect

Summary:
Add targets and basic printing/parsing of types in Shape dialect.

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

2 years ago[libc++] Move some misplaced compile-time flags
Louis Dionne [Tue, 17 Mar 2020 21:51:02 +0000 (17:51 -0400)]
[libc++] Move some misplaced compile-time flags

Some compilation-only flags were in %flags, but they should have been
in %compile_flags only.

2 years ago[MC] Recalculate fragment offsets after relaxation
Jian Cai [Fri, 13 Mar 2020 01:09:19 +0000 (18:09 -0700)]
[MC] Recalculate fragment offsets after relaxation

Summary:
The current relaxation implementation is not correctly adjusting the
size and offsets of fragements in one section based on changes in size
of another if the layout order of the two happened to be such that the
former was visited before the later. Therefore, we need to invalidate
the fragments in all sections after each iteration of relaxation, and
possibly further relax some of them in the next ieration. This fixes
PR#45190.

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

2 years ago[lldb/PlatformDarwin] Be more robust in computing the SDK path with xcrun
Jonas Devlieghere [Tue, 17 Mar 2020 21:28:34 +0000 (14:28 -0700)]
[lldb/PlatformDarwin] Be more robust in computing the SDK path with xcrun

The current implementation isn't very resilient when it comes to the
output of xcrun. Currently it cannot deal with:

 - Trailing newlines.
 - Leading newlines and errors/warnings before the Xcode path.
 - Xcode not being named Xcode.app.

This extract the logic into a helper in PlatformDarwin and fixes those
issues. It's also the first step towards removing code duplication
between the different platforms and downstream Swift.

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

2 years agoAdd some libc++ revisions to .git-blame-ignore-revs
Louis Dionne [Tue, 17 Mar 2020 21:29:59 +0000 (17:29 -0400)]
Add some libc++ revisions to .git-blame-ignore-revs

2 years ago[TargetLowering] Only demand a rotation's modulo amount bits
Simon Pilgrim [Tue, 17 Mar 2020 21:20:57 +0000 (21:20 +0000)]
[TargetLowering] Only demand a rotation's modulo amount bits

ISD::ROTL/ROTR rotation values are guaranteed to act as a modulo amount, so for power-of-2 bitwidths we only need the lowest bits.

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

2 years ago[Clang] Undef attribute for global variables
Jon Chesterfield [Tue, 17 Mar 2020 21:22:04 +0000 (21:22 +0000)]
[Clang] Undef attribute for global variables

Summary:
[Clang] Attribute to allow defining undef global variables

Initializing global variables is very cheap on hosted implementations. The
C semantics of zero initializing globals work very well there. It is not
necessarily cheap on freestanding implementations. Where there is no loader
available, code must be emitted near the start point to write the appropriate
values into memory.

At present, external variables can be declared in C++ and definitions provided
in assembly (or IR) to achive this effect. This patch provides an attribute in
order to remove this reason for writing assembly for performance sensitive
freestanding implementations.

A close analogue in tree is LDS memory for amdgcn, where the kernel is
responsible for initializing the memory after it starts executing on the gpu.
Uninitalized variables in LDS are observably cheaper than zero initialized.

Patch is loosely based on the cuda __shared__ and opencl __local variable
implementation which also produces undef global variables.

Reviewers: kcc, rjmccall, rsmith, glider, vitalybuka, pcc, eugenis, vlad.tsyrklevich, jdoerfert, gregrodgers, jfb, aaron.ballman

Reviewed By: rjmccall, aaron.ballman

Subscribers: Anastasia, aaron.ballman, davidb, Quuxplusone, dexonsmith, cfe-commits

Tags: #clang

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

2 years ago[lit] NFC: Fix typo in log statement
Louis Dionne [Tue, 17 Mar 2020 20:49:56 +0000 (16:49 -0400)]
[lit] NFC: Fix typo in log statement

2 years agoDon't call anyone lazy in the documentation.
Aaron Ballman [Tue, 17 Mar 2020 20:32:43 +0000 (16:32 -0400)]
Don't call anyone lazy in the documentation.

2 years ago[pstl] A hot fix for exclusive_scan (+ lost enable_if in declaration)
Mikhail Dvorskiy [Tue, 17 Mar 2020 20:03:02 +0000 (16:03 -0400)]
[pstl] A hot fix for exclusive_scan (+ lost enable_if in declaration)

It fixes an ambiguity issue in case of a user has a custom policy and
calls a version of exclusive_scan with binary operation.

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

2 years agoPR45207: Fix crash if constrained-type-specifier annotation forms a
Richard Smith [Tue, 17 Mar 2020 20:15:39 +0000 (13:15 -0700)]
PR45207: Fix crash if constrained-type-specifier annotation forms a
template_id annotation when parsing a type.

2 years ago[SCCP] Split up callsite handling, only propagate result on change (NFC)
Florian Hahn [Tue, 17 Mar 2020 20:01:09 +0000 (20:01 +0000)]
[SCCP] Split up callsite handling, only propagate result on change (NFC)

Functions include their arguments in the use-list. Changed function
values mean that the result of the function changed. We only need
to update the call sites with the new function result and do not
have to propagate the call arguments.

To do so, this patch splits up the visitCallSite into handleCallResult
and handleCallArguments and updates markUsersAsChanged to only update
call results for functions.

Reviewers: efriedma, davide

Reviewed By: efriedma

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

2 years ago[libc] Resolve race condition in sub-process test runner.
Paula Toth [Tue, 17 Mar 2020 19:59:21 +0000 (12:59 -0700)]
[libc] Resolve race condition in sub-process test runner.

Summary:
There seems to be a race condition between the pipe closing and the child process death. Likely these two events are not atomic on some versions of linux.

With the removal of `WNOHANG` we eliminate the race condition, however if the child closes the pipe intentionally then it could result in the test runner hanging. I find this situation less likely, where as I experience failures locally with this race condition rather consistently.

Reviewers: sivachandra, abrachet

Reviewed By: sivachandra, abrachet

Subscribers: MaskRay, jfb, tschuett, libc-commits

Tags: #libc-project

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

2 years ago[ELF][test] Delete unneeded --no-threads
Fangrui Song [Tue, 17 Mar 2020 19:51:21 +0000 (12:51 -0700)]
[ELF][test] Delete unneeded --no-threads

2 years ago[libc++] Bugfix to std::binomial_distribution<int>
Atmn Patel [Tue, 17 Mar 2020 19:52:36 +0000 (15:52 -0400)]
[libc++] Bugfix to std::binomial_distribution<int>

The current implementation of binomial_distribution is not guaranteed to
converge for certain extreme configurations of the engine and distribution.
This is due to a mistake in the implementation of the algorithm from the
given reference paper. The algorithm in the paper is guaranteed to
terminate but has redundant statements. The current implementation
simplified away the redundancy into a while loop, but it excludes the
return condition of the case where a good sample cannot be returned for
the particular sample being used from the uniform distribution, which is
what causes the infinite loop. This change guarantees termination by
recognizing that a good sample cannot be returned and returning 0 after
breaking the loop. This is also in contrast to the paper because the
return value as specified in the paper violates basic checks in at least
a subset of the extreme cases where the current implementation fails to
terminate. This default return value of 0 is satisfactory for the
extreme case known so far.

Since this is only meant to affect extreme cases where the algorithm
does not terminate anyways, the behavior is expected to remain exactly
the same for all non-extreme cases that have been terminating so far.

Fixes https://llvm.org/PR44847

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

2 years ago[DwarfDebug] Fix an assertion error when emitting call site info that combines two...
Vedant Kumar [Tue, 17 Mar 2020 01:11:36 +0000 (18:11 -0700)]
[DwarfDebug] Fix an assertion error when emitting call site info that combines two DW_OP_stack_values

When compiling

```
struct S {
  float w;
};
void f(long w, long b);
void g(struct S s) {
  int w = s.w;
  f(w, w*4);
}
```

I get Assertion failed: ((!CombinedExpr || CombinedExpr->isValid()) && "Combined debug expression is invalid").

That's because we combine two epxressions that both end in DW_OP_stack_value:

```
(lldb) p Expr->dump()
!DIExpression(DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_LLVM_convert, 64, DW_ATE_signed, DW_OP_stack_value)
(lldb) p Param.Expr->dump()
!DIExpression(DW_OP_constu, 4, DW_OP_mul, DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_LLVM_convert, 64, DW_ATE_signed, DW_OP_stack_value)
(lldb) p CombinedExpr->isValid()
(bool) $0 = false
(lldb) p CombinedExpr->dump()
!DIExpression(4097, 32, 5, 4097, 64, 5, 16, 4, 30, 4097, 32, 5, 4097, 64, 5, 159, 159)
```

I believe that in this particular case combining two stack values is
safe, but I didn't want to sink the special handling into
DIExpression::append() because I do want everyone to think about what
they are doing.

Patch by Adrian Prantl.

Fixes PR45181.
rdar://problem/60383095

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

2 years ago[gn build] Port 080dd10f7df
LLVM GN Syncbot [Tue, 17 Mar 2020 19:45:39 +0000 (19:45 +0000)]
[gn build] Port 080dd10f7df

2 years agoMove RDF from Hexagon to Codegen
Scott Constable [Tue, 17 Mar 2020 18:45:11 +0000 (11:45 -0700)]
Move RDF from Hexagon to Codegen

RDF is designed to be target agnostic. Therefore it would be useful to have it available for other targets, such as X86.

Based on a previous patch by Krzysztof Parzyszek

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

2 years ago[libc++] Use env to set the tool's environment on Darwin
Louis Dionne [Tue, 17 Mar 2020 19:40:31 +0000 (15:40 -0400)]
[libc++] Use env to set the tool's environment on Darwin