platform/upstream/llvm.git
4 years ago[ARM] MVE sext of a load is free
David Green [Fri, 16 Aug 2019 15:13:37 +0000 (15:13 +0000)]
[ARM] MVE sext of a load is free

MVE also has some sext of loads, which will be free just as scalar
instructions are.

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

llvm-svn: 369118

4 years ago[InstCombine] Shift amount reassociation in bittest: trunc-of-shl (PR42399)
Roman Lebedev [Fri, 16 Aug 2019 15:10:41 +0000 (15:10 +0000)]
[InstCombine] Shift amount reassociation in bittest: trunc-of-shl (PR42399)

Summary:
This is continuation of D63829 / https://bugs.llvm.org/show_bug.cgi?id=42399

I thought naive pattern would solve my issue, but nope, it involved truncation,
thus more folds needed.. This isn't really the fold i'm interested in,
i need trunc-of-lshr, but i'we decided to start with `shl` because it's simpler.

In this case, no extra legality checks are needed:
https://rise4fun.com/Alive/CAb

We should be careful about not increasing instruction count,
since we need to produce `zext` because `and` is done in wider type.

Reviewers: spatel, nikic, xbolva00

Reviewed By: spatel

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 369117

4 years ago[X86][SSE] Add shuffled load tests from PR16739
Simon Pilgrim [Fri, 16 Aug 2019 14:47:59 +0000 (14:47 +0000)]
[X86][SSE] Add shuffled load tests from PR16739

llvm-svn: 369116

4 years agoRevert rL369112 : [X86][SSE] Add shuffled load tests from PR16739
Simon Pilgrim [Fri, 16 Aug 2019 14:31:45 +0000 (14:31 +0000)]
Revert rL369112 : [X86][SSE] Add shuffled load tests from PR16739

I left typos in this from a WIP copy - reverting and I'll recommit.

llvm-svn: 369115

4 years ago[RISCV] Convert registers from unsigned to Register
Luis Marques [Fri, 16 Aug 2019 14:27:50 +0000 (14:27 +0000)]
[RISCV] Convert registers from unsigned to Register

Only in public interfaces that have not yet been converted should there remain
registers with unsigned type.

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

llvm-svn: 369114

4 years ago[lldb][NFC] Allow for-ranges on StringList
Raphael Isemann [Fri, 16 Aug 2019 14:27:35 +0000 (14:27 +0000)]
[lldb][NFC] Allow for-ranges on StringList

llvm-svn: 369113

4 years ago[X86][SSE] Add shuffled load tests from PR16739
Simon Pilgrim [Fri, 16 Aug 2019 14:26:11 +0000 (14:26 +0000)]
[X86][SSE] Add shuffled load tests from PR16739

llvm-svn: 369112

4 years ago[AArch64InstrInfo] Stop getInstSizeInBytes returning non-zero for meta instructions.
Paul Walker [Fri, 16 Aug 2019 14:17:52 +0000 (14:17 +0000)]
[AArch64InstrInfo] Stop getInstSizeInBytes returning non-zero for meta instructions.

Summary:
AArch64InstrInfo::getInstSizeInBytes is incorrectly treating meta
instructions (e.g. CFI_INSTRUCTION) as normal instructions and
giving them a size of 4.

This results in branch relaxation calculating block sizes wrong.
Branch relaxation also considers alignment and thus a single
mistake can result in later blocks being incorrectly sized even
when they themselves do not contain meta instructions.

The net result is we might not relax a branch whose destination is
not within range.

Reviewers: nickdesaulniers, peter.smith

Reviewed By: peter.smith

Subscribers: javed.absar, kristof.beyls, llvm-commits

Tags: #llvm

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

llvm-svn: 369111

4 years ago[X86] Remove unused include. NFCI.
Simon Pilgrim [Fri, 16 Aug 2019 14:05:46 +0000 (14:05 +0000)]
[X86] Remove unused include. NFCI.

We don't use anything from TargetOptions.h directly and its included via TargetLowering.h anyhow.

llvm-svn: 369110

4 years ago[libcxxabi] __cxa_guard_require: test guard byte with != 0 instead of == 1
Fangrui Song [Fri, 16 Aug 2019 13:54:44 +0000 (13:54 +0000)]
[libcxxabi] __cxa_guard_require: test guard byte with != 0 instead of == 1

llvm-svn: 369109

4 years ago[ARM] Correct register for narrowing and widening MVE loads and stores.
David Green [Fri, 16 Aug 2019 13:42:39 +0000 (13:42 +0000)]
[ARM] Correct register for narrowing and widening MVE loads and stores.

The widening and narrowing MVE instructions like VLDRH.32 are only permitted to
use low tGPR registers. This means that if they are used for a stack slot,
where the register used is only decided during frame setup, we need to be able
to correctly pick a thumb1 register over a normal GPR.

This attempts to add the required logic into eliminateFrameIndex and
rewriteT2FrameIndex, only picking the FrameReg if it is a valid register for
the operands register class, and picking a valid scratch register for the
register class.

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

llvm-svn: 369108

4 years ago[x86] fix fdiv test; NFC
Sanjay Patel [Fri, 16 Aug 2019 13:31:23 +0000 (13:31 +0000)]
[x86] fix fdiv test; NFC

The test was just added with rL369106, but forgot to update the instruction
along with the test name.

llvm-svn: 369107

4 years ago[x86] add tests for fdiv with variable operands; NFC
Sanjay Patel [Fri, 16 Aug 2019 13:23:52 +0000 (13:23 +0000)]
[x86] add tests for fdiv with variable operands; NFC

D66050 proposes to change the estimate sequence, but we
don't seem to have test coverage for the common case.

llvm-svn: 369106

4 years ago[clangd] suppress -Wparentheses warning: suggest parentheses around ‘&&’ within ‘||’
Haojian Wu [Fri, 16 Aug 2019 13:20:51 +0000 (13:20 +0000)]
[clangd] suppress -Wparentheses warning: suggest parentheses around ‘&&’ within ‘||’

llvm-svn: 369105

4 years agoRevert [CodeGen] Do the Simple Early Return in block-placement pass to optimize the...
Florian Hahn [Fri, 16 Aug 2019 13:19:29 +0000 (13:19 +0000)]
Revert [CodeGen] Do the Simple Early Return in block-placement pass to optimize the blocks

This reverts r368997 (git commit 2a903c0b679bae1919f9fc01f78e4bc6cff2add0)

It looks like this commit adds invalid predecessors to MBBs. The example
below fails the verifier after MachineBlockPlacement (run llc
-verify-machineinstrs):

@global.4 = external constant i8*

declare i32 @zot(...)

define i16* @snork.67() personality i8* bitcast (i32 (...)* @zot to i8*) {
bb:
  invoke void undef()
          to label %bb5 unwind label %bb4

bb4:                                              ; preds = %bb
  %tmp = landingpad { i8*, i32 }
          catch i8* null
  unreachable

bb5:                                              ; preds = %bb
  %tmp6 = load i32, i32* null, align 4
  %tmp7 = icmp eq i32 %tmp6, 0
  br i1 %tmp7, label %bb14, label %bb8

bb8:                                              ; preds = %bb11, %bb5
  invoke void undef()
          to label %bb9 unwind label %bb11

bb9:                                              ; preds = %bb8
  %tmp10 = invoke i16* undef()
          to label %bb14 unwind label %bb11

bb11:                                             ; preds = %bb9, %bb8
  %tmp12 = landingpad { i8*, i32 }
          cleanup
          catch i8* bitcast (i8** @global.4 to i8*)
  %tmp13 = icmp ult i64 undef, undef
  br i1 %tmp13, label %bb8, label %bb14

bb14:                                             ; preds = %bb11, %bb9, %bb5
  %tmp15 = phi i16* [ null, %bb5 ], [ null, %bb11 ], [ %tmp10, %bb9 ]
  ret i16* %tmp15
}

llvm-svn: 369104

4 years ago[DAGCombiner] Add simple folds for SMULFIX/UMULFIX/SMULFIXSAT
Bjorn Pettersson [Fri, 16 Aug 2019 13:16:48 +0000 (13:16 +0000)]
[DAGCombiner] Add simple folds for SMULFIX/UMULFIX/SMULFIXSAT

Summary:
Add the following DAGCombiner folds for mulfix being
one of SMULFIX/UMULFIX/SMULFIXSAT:
  (mulfix x, undef, scale) -> 0
  (mulfix x, 0, scale) -> 0

Also added canonicalization of constants to RHS.

Reviewers: RKSimon, craig.topper, spatel

Reviewed By: RKSimon

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 369103

4 years ago[X86] Add test case for future MULFIX DAG combine folds. NFC
Bjorn Pettersson [Fri, 16 Aug 2019 13:16:38 +0000 (13:16 +0000)]
[X86] Add test case for future MULFIX DAG combine folds. NFC

Add some test cases displaying the lack of DAG combine
folds for SMULFIX/UMULFIX/SMULFIXSAT when either
multiplicand is undef or zero.

It seems like widening vector legalization for X86 can
introduce fixed point multiplication of undef values.
So that is one way that such operations could appear
during ISel.

Multiplication with zero is probably more unlikely, and
could potentially be handled by InstCombine. But I do
not think it would hurt to do such folds in DAGCombiner.

This patch only adds the test case. The folds will be
added in a follow up patch.

llvm-svn: 369102

4 years ago[ARM] Don't pretend we know how to generate MVE VLDn
David Green [Fri, 16 Aug 2019 13:06:49 +0000 (13:06 +0000)]
[ARM] Don't pretend we know how to generate MVE VLDn

We don't yet know how to generate these instructions for MVE. And in the case
of VLD3, we don't even have the instruction. For the moment don't tell the
vectoriser that we have VLD4, just to end up serialising the results.

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

llvm-svn: 369101

4 years ago[clangd] Simplify code of ClangdLSPServer::onCommand
Ilya Biryukov [Fri, 16 Aug 2019 12:46:41 +0000 (12:46 +0000)]
[clangd] Simplify code of ClangdLSPServer::onCommand

Summary:
By inlining a complicated lambda into its single call-site.

Also ensure we call Reply() exactly once even if tweaks return both
ShowMessage and ApplyEdit effects.

Reviewers: hokein

Reviewed By: hokein

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 369100

4 years agoFix typos in LibASTImporter.rst
Gabor Marton [Fri, 16 Aug 2019 12:21:49 +0000 (12:21 +0000)]
Fix typos in LibASTImporter.rst

llvm-svn: 369099

4 years ago[ASTImporter] Import ctor initializers after setting flags.
Balazs Keri [Fri, 16 Aug 2019 12:10:03 +0000 (12:10 +0000)]
[ASTImporter] Import ctor initializers after setting flags.

Summary:
Code to import "ctor initializers" at import of functions
is moved to be after the flags in the newly created function
are imported. This fixes an error when the already created but
incomplete (flags are not set) function declaration is accessed.

Reviewers: martong, shafik, a_sidorin, a.sidorin

Reviewed By: shafik

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

Tags: #clang

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

llvm-svn: 369098

4 years ago[RISCV] Allow parsing of bare symbols with offsets
Lewis Revill [Fri, 16 Aug 2019 12:00:56 +0000 (12:00 +0000)]
[RISCV] Allow parsing of bare symbols with offsets

This patch allows symbols followed by an expression for an offset to be
parsed as bare symbols.

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

llvm-svn: 369097

4 years agoRevert "[CallGraph] Refine call graph for indirect calls with !callees metadata"
Benjamin Kramer [Fri, 16 Aug 2019 10:59:18 +0000 (10:59 +0000)]
Revert "[CallGraph] Refine call graph for indirect calls with !callees metadata"

This reverts commit r369025. Crashes clang, test case is on the mailing
list.

llvm-svn: 369096

4 years ago[RISCV] Lower inline asm constraint A for RISC-V
Lewis Revill [Fri, 16 Aug 2019 10:28:34 +0000 (10:28 +0000)]
[RISCV] Lower inline asm constraint A for RISC-V

This allows arguments with the constraint A to be lowered to input nodes
for RISC-V, which implies a memory address stored in a register.

This patch adds the minimal amount of code required to get operands with
the right constraints to compile.

https://reviews.llvm.org/D54296

llvm-svn: 369095

4 years ago[SLPVectorizer] Silence null dereference warning. NFCI.
Simon Pilgrim [Fri, 16 Aug 2019 10:28:23 +0000 (10:28 +0000)]
[SLPVectorizer] Silence null dereference warning. NFCI.

cppcheck + MSVC analyzer both over zealously warn that we might dereference a null Bundle pointer - add an assertion to check for null to silence the warning, plus its a good idea to check that we succeeded in finding a schedule bundle anyway....

llvm-svn: 369094

4 years ago[RISCV] Add inline asm constraint A for RISC-V
Lewis Revill [Fri, 16 Aug 2019 10:23:56 +0000 (10:23 +0000)]
[RISCV] Add inline asm constraint A for RISC-V

This allows the constraint A to be used in inline asm for RISC-V, which
allows an address held in a register to be used.

This patch adds the minimal amount of code required to get operands with
the right constraints to compile.

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

llvm-svn: 369093

4 years ago[DebugInfo] Handle complex expressions with spills in LiveDebugValues
Jeremy Morse [Fri, 16 Aug 2019 10:04:17 +0000 (10:04 +0000)]
[DebugInfo] Handle complex expressions with spills in LiveDebugValues

In r369026 we disabled spill-recognition in LiveDebugValues for anything
that has a complex expression. This is because it's hard to recover the
complex expression once the spill location is baked into it.

This patch re-enables spill-recognition and slightly adjusts the DBG_VALUE
insts that LiveDebugValues tracks: instead of tracking the last DBG_VALUE
for a variable, it tracks the last _unspilt_ DBG_VALUE. The spill-restore
code is then able to access and copy the original complex expression; but
the rest of LiveDebugValues has to be aware of the slight semantic shift,
and produce a new spilt location if a spilt location is propagated between
blocks.

The test added produces an incorrect variable location (see FIXME), which
will be the subject of future work.

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

llvm-svn: 369092

4 years agoAssumptionCache: remove old affected values after RAUW.
Tim Northover [Fri, 16 Aug 2019 09:34:27 +0000 (09:34 +0000)]
AssumptionCache: remove old affected values after RAUW.

If they're left in the cache then they can't be removed efficiently when the
cache is notified to unlink a @llvm.assume call, and that can lead to values
from different functions entirely remaining there.

llvm-svn: 369091

4 years ago[clangd] Added highlighting for non type templates.
Johan Vikstrom [Fri, 16 Aug 2019 09:30:21 +0000 (09:30 +0000)]
[clangd] Added highlighting for non type templates.

Summary: Non type templates were not being highlighted. This highlights
them as TemplateParameters.

Reviewers: hokein, ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 369090

4 years ago[clangd] Remove Bind, use C++14 lambda captures instead. NFC
Ilya Biryukov [Fri, 16 Aug 2019 09:20:01 +0000 (09:20 +0000)]
[clangd] Remove Bind, use C++14 lambda captures instead. NFC

llvm-svn: 369089

4 years ago[ValueTracking] Fix recurrence detection to check both PHI operands.
Florian Hahn [Fri, 16 Aug 2019 09:15:02 +0000 (09:15 +0000)]
[ValueTracking] Fix recurrence detection to check both PHI operands.

Summary:
Currently we fail to compute known bits for recurrences where the
first incoming value is the start value of the recurrence.

Instead of exiting the loop when the first incoming value is not
the step of the recurrence, continue to check the second incoming
value.

The original code uses a loop to handle both cases, but incorrectly
exits instead of continuing.

Reviewers: lebedev.ri, spatel, nikic

Reviewed By: lebedev.ri

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 369088

4 years ago[X86] Manually reimplement getTargetInsertSubreg in X86DAGToDAGISel::matchBitExtract...
Craig Topper [Fri, 16 Aug 2019 04:47:44 +0000 (04:47 +0000)]
[X86] Manually reimplement getTargetInsertSubreg in X86DAGToDAGISel::matchBitExtract so we can call insertDAGNode on the target constant.

This is needed to maintain the topological sort order.

Fixes PR42992.

llvm-svn: 369084

4 years ago[lldb-server] Disable a test on Windows until it can be fixed
Aaron Smith [Fri, 16 Aug 2019 03:49:41 +0000 (03:49 +0000)]
[lldb-server] Disable a test on Windows until it can be fixed

llvm-svn: 369083

4 years agoRemove the temporary code. NFC.
Igor Kudrin [Fri, 16 Aug 2019 03:40:04 +0000 (03:40 +0000)]
Remove the temporary code. NFC.

That should have been done in rL368156 but somehow was missed.

llvm-svn: 369082

4 years ago[clang-tidy] Migrate objc-super-self to use isDerivedFrom 🚛
Stephane Moore [Fri, 16 Aug 2019 02:27:58 +0000 (02:27 +0000)]
[clang-tidy] Migrate objc-super-self to use isDerivedFrom 🚛

Summary:
This migrates objc-super-self to `isDerivedFrom` as it now supports
matching Objective-C interface declarations.

Test Notes:
Ran clang tools tests.

Reviewers: aaron.ballman, gribozavr

Reviewed By: aaron.ballman

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

llvm-svn: 369081

4 years agoRevert r368987, it caused PR43016.
Nico Weber [Fri, 16 Aug 2019 02:21:21 +0000 (02:21 +0000)]
Revert r368987, it caused PR43016.

llvm-svn: 369080

4 years agoDisable stack_trace_compressor_fuzzer.
Mitch Phillips [Fri, 16 Aug 2019 02:03:33 +0000 (02:03 +0000)]
Disable stack_trace_compressor_fuzzer.

Should hopefully fix the remainder of the buildbot issues. Just disabling this
for now with a comment that I'm working on it. Can actually fix the real problem
when I'm at a real computer.

llvm-svn: 369079

4 years ago[analyzer] Analysis: Silence checkers
Csaba Dabis [Fri, 16 Aug 2019 01:53:14 +0000 (01:53 +0000)]
[analyzer] Analysis: Silence checkers

Summary:
This patch introduces a new `analyzer-config` configuration:
`-analyzer-config silence-checkers`
which could be used to silence the given checkers.

It accepts a semicolon separated list, packed into quotation marks, e.g:
`-analyzer-config silence-checkers="core.DivideZero;core.NullDereference"`

It could be used to "disable" core checkers, so they model the analysis as
before, just if some of them are too noisy it prevents to emit reports.

This patch also adds support for that new option to the scan-build.
Passing the option `-disable-checker core.DivideZero` to the scan-build
will be transferred to `-analyzer-config silence-checkers=core.DivideZero`.

Reviewed By: NoQ, Szelethus

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

llvm-svn: 369078

4 years ago[PowerPC] add testcases for folding frame offset - NFC
Chen Zheng [Fri, 16 Aug 2019 01:52:50 +0000 (01:52 +0000)]
[PowerPC] add testcases for folding frame offset - NFC

llvm-svn: 369077

4 years ago[clang-tidy] Migrate objc-forbidden-subclassing to use isDerivedFrom 🚛
Stephane Moore [Fri, 16 Aug 2019 01:52:17 +0000 (01:52 +0000)]
[clang-tidy] Migrate objc-forbidden-subclassing to use isDerivedFrom 🚛

Summary:
This migrates objc-forbidden-subclassing to `isDerivedFrom` as it now
supports matching Objective-C interface declarations.

Test Notes:
Ran clang tools tests.

Reviewers: aaron.ballman, gribozavr

Reviewed By: aaron.ballman

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

llvm-svn: 369076

4 years ago[clang-doc] Serialize inherited attributes and methods
Diego Astiazaran [Fri, 16 Aug 2019 00:10:49 +0000 (00:10 +0000)]
[clang-doc] Serialize inherited attributes and methods

clang-doc now serializes the inherited attributes and methods, not only the name of the base class.
All inherited are tracked, if B:A and C:B, info of A is included in C.
This data is stored in attribute Bases in a RecordInfo.
Previously tracked inheritance data, stored in Parents and VParents, hasn't been removed to reduce review load.

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

llvm-svn: 369075

4 years agogn build: Merge r369064
Nico Weber [Fri, 16 Aug 2019 00:04:48 +0000 (00:04 +0000)]
gn build: Merge r369064

llvm-svn: 369074

4 years agogn build: Merge r369061
Nico Weber [Fri, 16 Aug 2019 00:04:42 +0000 (00:04 +0000)]
gn build: Merge r369061

llvm-svn: 369073

4 years ago[DebugLine] Don't try to guess the path style
Jonas Devlieghere [Thu, 15 Aug 2019 23:53:15 +0000 (23:53 +0000)]
[DebugLine] Don't try to guess the path style

In r368879 I made an attempt to guess the path style from the files in
the line table. After some consideration I now think this is a poor
idea. This patch undoes that behavior and instead adds an optional
argument to specify the path style. This allows us to make that decision
elsewhere where we have more information. In case of LLDB based on the
Unit.

llvm-svn: 369072

4 years agoMoved binary off add_llvm_executable.
Mitch Phillips [Thu, 15 Aug 2019 23:50:05 +0000 (23:50 +0000)]
Moved binary off add_llvm_executable.
Used add_executable instead, as this allows a standalone compiler-rt to build,
as the add_llvm_executable build target isn't accessible in a standalone CRT
preparation.

llvm-svn: 369071

4 years ago[GlobalISel] CSEMIRBuilder: Add support for G_GEP
Volkan Keles [Thu, 15 Aug 2019 23:45:45 +0000 (23:45 +0000)]
[GlobalISel] CSEMIRBuilder: Add support for G_GEP

Summary:
This patch adds G_GEP to `shouldCSEOpc` so that it can be CSEd. It also refactors
`translateGetElementPtr` by replacing `createGenericVirtualRegister` calls with types.

Reviewers: aditya_nandakumar, arsenm, dsanders, paquette, aemerson

Reviewed By: aditya_nandakumar

Subscribers: wdng, rovka, javed.absar, hiraditya, Petar.Avramovic, llvm-commits

Tags: #llvm

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

llvm-svn: 369070

4 years ago[ARM][LowOverheadLoops] Fix generated code for "revert".
Eli Friedman [Thu, 15 Aug 2019 23:35:53 +0000 (23:35 +0000)]
[ARM][LowOverheadLoops] Fix generated code for "revert".

Two issues:

1. t2CMPri shouldn't use CPSR if it isn't predicated. This doesn't
really have any visible effect at the moment, but it might matter in the
future.
2. The t2CMPri generated for t2WhileLoopStart might need to use a
register that isn't LR.

My team found this because we have a patch to track register liveness
late in the pass pipeline. I'll look into upstreaming it to help catch
issues like this earlier.

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

llvm-svn: 369069

4 years ago[clang-doc] Sort index elements case insensitive
Diego Astiazaran [Thu, 15 Aug 2019 23:32:12 +0000 (23:32 +0000)]
[clang-doc] Sort index elements case insensitive

Implement logic to compare the references of the index case insensitive.

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

llvm-svn: 369068

4 years agoRe-instate 369051.
Mitch Phillips [Thu, 15 Aug 2019 23:28:33 +0000 (23:28 +0000)]
Re-instate 369051.

Looks like I accidentally reverted r369051 to the old
CMake-version-specific flag when committing 369055.

llvm-svn: 369067

4 years ago[NewPM][PassInstrumentation] Fix test added in r369024.
David L. Jones [Thu, 15 Aug 2019 23:24:14 +0000 (23:24 +0000)]
[NewPM][PassInstrumentation] Fix test added in r369024.

llvm-lto2 doesn't treat "-" as stdout, so the test added in r369024 creates a
file named "-.0". This patch makes the test look more like other tests that use
llvm-lto2.

llvm-svn: 369066

4 years ago[clang-doc] Fix use of source-root flag
Diego Astiazaran [Thu, 15 Aug 2019 23:20:42 +0000 (23:20 +0000)]
[clang-doc] Fix use of source-root flag

The value, if any, of --source-root flag was not being used.
This has been fixed and the logic was moved to the ClangDocContext
contructor.

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

llvm-svn: 369065

4 years ago[Support] Re-introduce the RWMutexImpl for macOS < 10.12
Jonas Devlieghere [Thu, 15 Aug 2019 23:07:20 +0000 (23:07 +0000)]
[Support] Re-introduce the RWMutexImpl for macOS < 10.12

In r369018, Benjamin replaced the custom RWMutex implementation with
their C++14 counterpart. Unfortunately, std::shared_timed_mutex is only
available on macOS 10.12 and later. This prevents LLVM from compiling
even on newer versions of the OS when you have an older deployment
target. This patch reintroduced the old RWMutexImpl but guards it by the
macOS availability macro.

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

llvm-svn: 369064

4 years ago[clang-doc] Fix bitcode writer for access specifiers
Diego Astiazaran [Thu, 15 Aug 2019 23:04:27 +0000 (23:04 +0000)]
[clang-doc] Fix bitcode writer for access specifiers

Bitcode writer was not emitting the corresponding record for the Access attribute of a FunctionInfo. This has been added.
AS_none was being used as the default value for any AcesssSpecifier attribute
(in FunctionInfo and MemberTypeInfo), this has been changed to AS_public
because this is the enum value that evaluates to 0.
The bitcode writer doesn't write values that are 0 so if an attribute
was set to AS_public, this value is not written and after reading the
bitcode it would have the default value which is AS_none. This is why
the default value is now AS_public.

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

llvm-svn: 369063

4 years agoMove isPointerOffset function to ValueTracking (NFC).
Evgeniy Stepanov [Thu, 15 Aug 2019 22:58:28 +0000 (22:58 +0000)]
Move isPointerOffset function to ValueTracking (NFC).

Summary: To be reused in MemTag sanitizer.

Reviewers: pcc, vitalybuka, ostannard

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 369062

4 years ago[Bugpoint redesign] Added Pass to Remove Global Variables
Diego Trevino Ferrer [Thu, 15 Aug 2019 22:54:09 +0000 (22:54 +0000)]
[Bugpoint redesign] Added Pass to Remove Global Variables

Summary:
This pass tries to remove Global Variables, as well as their derived uses. For example if a variable `@x` is used by `%call1` and `%call2`, both these uses and the definition of `@x` are deleted. Moreover if `%call1` or `%call2` are used elsewhere those uses are also deleted, and so on recursively.

I'm still uncertain if this pass should remove derived uses, I'm open to suggestions.

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

> llvm-svn: 368918

llvm-svn: 369061

4 years ago[Bugpoint redesign] Output option can now print to STDOUT
Diego Trevino Ferrer [Thu, 15 Aug 2019 22:39:43 +0000 (22:39 +0000)]
[Bugpoint redesign] Output option can now print to STDOUT

Summary:
This also changes all the outs() statements to errs() so the output and
progress streams don't get mixed.

This has been added because D64176 had flaky tests, which I believe were because the reduced file was being catted into `FileCheck`, instead of being pass from STDOUT directly.

Reviewers: chandlerc, dblaikie, xbolva00

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 369060

4 years agoRevert "[Support] Re-introduce the RWMutexImpl for macOS < 10.12"
Jonas Devlieghere [Thu, 15 Aug 2019 22:24:21 +0000 (22:24 +0000)]
Revert "[Support] Re-introduce the RWMutexImpl for macOS < 10.12"

This doesn't work (yet).

llvm-svn: 369059

4 years ago[AIX] For XL, pick GCC-compatible std & default warning options
Hubert Tong [Thu, 15 Aug 2019 22:23:53 +0000 (22:23 +0000)]
[AIX] For XL, pick GCC-compatible std & default warning options

Summary:
LLVM now requires C++14. For IBM XL compilers with C++14 support, this
can be done with the GCC-style options. The relevant block in the CMake
file is split up into smaller parts as part of this patch to allow the
common cases to be shared.

Reviewers: jfb, jasonliu, daltenty, xingxue

Reviewed By: jfb, xingxue

Subscribers: mstorsjo, mgorny, dexonsmith, llvm-commits

Tags: #llvm

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

llvm-svn: 369058

4 years ago[SDAG] Minor code cleanup/standardization of atomic accessors [NFC]
Philip Reames [Thu, 15 Aug 2019 22:21:14 +0000 (22:21 +0000)]
[SDAG] Minor code cleanup/standardization of atomic accessors [NFC]

llvm-svn: 369057

4 years ago[Support] Re-introduce the RWMutexImpl for macOS < 10.12
Jonas Devlieghere [Thu, 15 Aug 2019 22:19:38 +0000 (22:19 +0000)]
[Support] Re-introduce the RWMutexImpl for macOS < 10.12

In r369018, Benjamin replaced the custom RWMutex implementation with
their C++14 counterpart. Unfortunately, std::shared_timed_mutex is only
available on macOS 10.12 and later. This prevents LLVM from compiling
even on newer versions of the OS when you have an older deployment
target. This patch reintroduced the old RWMutexImpl but guards it by the
macOS availability macro.

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

llvm-svn: 369056

4 years agoGuard fuzzer build behind Clang-only flags.
Mitch Phillips [Thu, 15 Aug 2019 22:15:46 +0000 (22:15 +0000)]
Guard fuzzer build behind Clang-only flags.

Should fix sanitizer buildbots and any one else who's building
compiler-rt using gcc.

llvm-svn: 369055

4 years ago[Utils][NFC] Copy bisect usage documents from commit msg into script.
Jinsong Ji [Thu, 15 Aug 2019 22:07:59 +0000 (22:07 +0000)]
[Utils][NFC] Copy bisect usage documents from commit msg into script.

Copy the message into script, so that new users won't need to dig into
commit messages to figure out how to use.

The message are copied directly from Michael's commit message in
https://reviews.llvm.org/rL214610.

llvm-svn: 369054

4 years agoAdd missing MIR serialization text for AArch64II::MO_TAGGED.
Evgeniy Stepanov [Thu, 15 Aug 2019 22:03:55 +0000 (22:03 +0000)]
Add missing MIR serialization text for AArch64II::MO_TAGGED.

Reviewers: pcc

Subscribers: javed.absar, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 369053

4 years agoStop-hooks weren't getting called on step-out. Fix that.
Jim Ingham [Thu, 15 Aug 2019 21:37:52 +0000 (21:37 +0000)]
Stop-hooks weren't getting called on step-out. Fix that.

There was a little bit of logic in the StopInfoBreakpoint::PerformAction
that would null out the StopInfo once we had a completed plan so that the
next call to GetStopInfo would replace it with the StopInfoThreadPlan.

But the stop-hooks check for whether a thread stopped for a reason didn't
trigger this conversion.  So I added an API to do that directly, and then
called it where before we just reset the StopInfo.

<rdar://problem/54270767>

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

llvm-svn: 369052

4 years agoRemove CMake >= v3.13 target_link_options.
Mitch Phillips [Thu, 15 Aug 2019 21:34:13 +0000 (21:34 +0000)]
Remove CMake >= v3.13 target_link_options.
Instead, use set_target_properties.

llvm-svn: 369051

4 years ago[MemorySSA] Remove restrictive asserts.
Alina Sbirlea [Thu, 15 Aug 2019 21:20:08 +0000 (21:20 +0000)]
[MemorySSA] Remove restrictive asserts.

The verification I added has overly restrictive asserts.
Unreachable blocks can have any incoming value in practice, after an
update due to a "replaceAllUses" call when the repalced entry is
LiveOnEntry.

llvm-svn: 369050

4 years ago[Rewrite][NFC] Add FIXMEs and tests for RemoveLineIfEmpty bug
Joel E. Denny [Thu, 15 Aug 2019 21:17:48 +0000 (21:17 +0000)]
[Rewrite][NFC] Add FIXMEs and tests for RemoveLineIfEmpty bug

I'd like to add these comments to warn others of problems I
encountered when trying to use `RemoveLineIfEmpty`.  I originally
tried to fix the problem, but I realized I could implement the
functionality more easily and efficiently in my calling code where I
can make the simplifying assumption that there are no prior edits to
the line from which text is being removed.  While I've lost the
motivation to write a fix, which doesn't look easy, I figure a warning
to others is better than silence.

I've added a unit test to demonstrate the problem.  I don't know how
to mark it as an expected failure, so I just marked it disabled.

Reviewed By: jkorous

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

llvm-svn: 369049

4 years ago[GWP-ASan] Implement stack frame compression.
Mitch Phillips [Thu, 15 Aug 2019 21:09:09 +0000 (21:09 +0000)]
[GWP-ASan] Implement stack frame compression.

Summary:
This patch introduces stack frame compression to GWP-ASan. Each stack frame is
variable-length integer encoded as the difference between frame[i] and
frame[i - 1]. Furthermore, we use zig-zag encoding on the difference to ensure
that negative differences are also encoded into a relatively small number of
bytes.

Examples of what the compression looks like can be seen in
`gwp_asan/tests/compression.cpp`.

This compression can reduce the memory consumption cost of stack traces by
~50%.

Reviewers: vlad.tsyrklevich

Reviewed By: vlad.tsyrklevich

Subscribers: mgorny, #sanitizers, llvm-commits, eugenis, morehouse

Tags: #sanitizers, #llvm

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

llvm-svn: 369048

4 years agogn build: Merge r369039
Nico Weber [Thu, 15 Aug 2019 21:00:33 +0000 (21:00 +0000)]
gn build: Merge r369039

llvm-svn: 369047

4 years agogn build: Merge r369018
Nico Weber [Thu, 15 Aug 2019 21:00:26 +0000 (21:00 +0000)]
gn build: Merge r369018

llvm-svn: 369046

4 years agoFix nm on GCC 5.1 after the C++14 move
JF Bastien [Thu, 15 Aug 2019 20:38:42 +0000 (20:38 +0000)]
Fix nm on GCC 5.1 after the C++14 move

Summary:
As in D66306, fix the invocation of std::sort with std::function by not using
std::function, since it's easier to read and is broken in libstdc++ from GCC 5.1
(see https://gcc.gnu.org/PR65942).

Reviewers: thakis

Subscribers: jkorous, mgrang, dexonsmith, rupprecht, llvm-commits

Tags: #llvm

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

llvm-svn: 369045

4 years agoMark the test as unsupported on darwin, NFC.
Alexey Bataev [Thu, 15 Aug 2019 20:31:47 +0000 (20:31 +0000)]
Mark the test as unsupported on darwin, NFC.

The bundler may fail on darwin, mark the test as not compatible.

llvm-svn: 369044

4 years ago[Sema] Implement DR2386 for C++17 structured binding
Reid Kleckner [Thu, 15 Aug 2019 19:45:28 +0000 (19:45 +0000)]
[Sema] Implement DR2386 for C++17 structured binding

Allow implementations to provide complete definitions of
std::tuple_size<T>, but to omit the 'value' member to signal that T is
not tuple-like. The Microsoft standard library implements
std::tuple_size<const T> this way.

If the value member exists, clang still validates that it is an ICE, but
if it does not, then the type is considered to not be tuple-like.

Fixes PR33236

Reviewers: rsmith

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

llvm-svn: 369043

4 years ago[WebAssembly] Correctly handle va_arg of zero-sized structures
Guanzhong Chen [Thu, 15 Aug 2019 19:33:36 +0000 (19:33 +0000)]
[WebAssembly] Correctly handle va_arg of zero-sized structures

Summary:
D66168 passes size 0 structs indirectly, while the wasm backend expects it to
be passed directly. This causes subsequent variadic arguments to be read
incorrectly.

This diff changes it so that size 0 structs are passed directly.

Reviewers: dschuff, tlively, sbc100

Reviewed By: dschuff

Subscribers: jgravelle-google, aheejin, sunfish, cfe-commits

Tags: #clang

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

llvm-svn: 369042

4 years agoApply llvm-prefer-register-over-unsigned from clang-tidy to LLVM
Daniel Sanders [Thu, 15 Aug 2019 19:22:08 +0000 (19:22 +0000)]
Apply llvm-prefer-register-over-unsigned from clang-tidy to LLVM

Summary:
This clang-tidy check is looking for unsigned integer variables whose initializer
starts with an implicit cast from llvm::Register and changes the type of the
variable to llvm::Register (dropping the llvm:: where possible).

Partial reverts in:
X86FrameLowering.cpp - Some functions return unsigned and arguably should be MCRegister
X86FixupLEAs.cpp - Some functions return unsigned and arguably should be MCRegister
X86FrameLowering.cpp - Some functions return unsigned and arguably should be MCRegister
HexagonBitSimplify.cpp - Function takes BitTracker::RegisterRef which appears to be unsigned&
MachineVerifier.cpp - Ambiguous operator==() given MCRegister and const Register
PPCFastISel.cpp - No Register::operator-=()
PeepholeOptimizer.cpp - TargetInstrInfo::optimizeLoadInstr() takes an unsigned&
MachineTraceMetrics.cpp - MachineTraceMetrics lacks a suitable constructor

Manual fixups in:
ARMFastISel.cpp - ARMEmitLoad() now takes a Register& instead of unsigned&
HexagonSplitDouble.cpp - Ternary operator was ambiguous between unsigned/Register
HexagonConstExtenders.cpp - Has a local class named Register, used llvm::Register instead of Register.
PPCFastISel.cpp - PPCEmitLoad() now takes a Register& instead of unsigned&

Depends on D65919

Reviewers: arsenm, bogner, craig.topper, RKSimon

Reviewed By: arsenm

Subscribers: RKSimon, craig.topper, lenary, aemerson, wuzish, jholewinski, MatzeB, qcolombet, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, wdng, nhaehnle, sbc100, jgravelle-google, kristof.beyls, hiraditya, aheejin, kbarton, fedor.sergeev, javed.absar, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, tpr, PkmX, jocewei, jsji, Petar.Avramovic, asbirlea, Jim, s.egerton, llvm-commits

Tags: #llvm

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

llvm-svn: 369041

4 years ago[Hexagon] Fix instruction selection for vselect v4i8
Krzysztof Parzyszek [Thu, 15 Aug 2019 19:20:09 +0000 (19:20 +0000)]
[Hexagon] Fix instruction selection for vselect v4i8

llvm-svn: 369040

4 years agoRevert [Bugpoint redesign] Added Pass to Remove Global Variables
Diego Trevino Ferrer [Thu, 15 Aug 2019 19:08:15 +0000 (19:08 +0000)]
Revert [Bugpoint redesign] Added Pass to Remove Global Variables

This reverts r368918 because it was unstable!

It broke these builds:
 * http://lab.llvm.org:8011/builders/lld-x86_64-ubuntu-fast/builds/4649
 * http://lab.llvm.org:8011/builders/clang-ppc64be-linux-lnt/builds/29966
 * http://lab.llvm.org:8011/builders/clang-ppc64be-linux-lnt/builds/29964

But surprisingly this passed:
 * http://lab.llvm.org:8011/builders/clang-ppc64be-linux-lnt/builds/29965

llvm-svn: 369039

4 years agoMVT: Add v3i16/v3f16 vectors
Matt Arsenault [Thu, 15 Aug 2019 18:58:25 +0000 (18:58 +0000)]
MVT: Add v3i16/v3f16 vectors

AMDGPU has some buffer intrinsics which theoretically could use
this. Some of the generated tables include the 3 and 4 element vector
versions of these rounded to 64-bits, which is ambiguous. Add these to
help the table disambiguate these.

Assertion change is for the path odd sized vectors now take for R600.
v3i16 is widened to v4i16, which then needs to be promoted to v4i32.

llvm-svn: 369038

4 years ago[NFC] Add a couple of dump routines for RegisterPressure helper classes
Philip Reames [Thu, 15 Aug 2019 18:49:39 +0000 (18:49 +0000)]
[NFC] Add a couple of dump routines for RegisterPressure helper classes

llvm-svn: 369037

4 years ago[ValueTracking] Look through ptrmask intrinsics during getUnderlyingObject.
Florian Hahn [Thu, 15 Aug 2019 18:39:56 +0000 (18:39 +0000)]
[ValueTracking] Look through ptrmask intrinsics during getUnderlyingObject.

Reviewers: nlopes, efriedma, hfinkel, sanjoy, aqjune, jdoerfert

Reviewed By: jdoerfert

Subscribers: jdoerfert, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 369036

4 years agoRename this file from cx2.c to c2x.c; NFC.
Aaron Ballman [Thu, 15 Aug 2019 18:37:30 +0000 (18:37 +0000)]
Rename this file from cx2.c to c2x.c; NFC.

llvm-svn: 369035

4 years agoChange test to use uint64_t to support compiling for 32-bit architectures.
Adrian Prantl [Thu, 15 Aug 2019 18:37:11 +0000 (18:37 +0000)]
Change test to use uint64_t to support compiling for 32-bit architectures.

llvm-svn: 369034

4 years agoAllow standards-based attributes to have leading and trailing underscores.
Aaron Ballman [Thu, 15 Aug 2019 18:35:44 +0000 (18:35 +0000)]
Allow standards-based attributes to have leading and trailing underscores.

This gives library implementers a way to use standards-based attributes that do not conflict with user-defined macros of the same name. Attributes in C2x require this behavior normatively (C2x 6.7.11p4), but there's no reason to not have the same behavior in C++, especially given that such attributes may be used by a C library consumed by a C++ compilation.

llvm-svn: 369033

4 years ago[NFC] Added tests for 'select with ctlz to cttz' fold
David Bolvansky [Thu, 15 Aug 2019 18:23:37 +0000 (18:23 +0000)]
[NFC] Added tests for 'select with ctlz to cttz' fold

llvm-svn: 369032

4 years ago[X86] Add custom type legalization for bitcasting mmx to v2i32/v4i16/v8i8 to use...
Craig Topper [Thu, 15 Aug 2019 18:23:37 +0000 (18:23 +0000)]
[X86] Add custom type legalization for bitcasting mmx to v2i32/v4i16/v8i8 to use movq2dq instead of going through memory.

llvm-svn: 369031

4 years agoAdd LLVMLibC proposal to docs/index.rst.
Siva Chandra [Thu, 15 Aug 2019 18:08:11 +0000 (18:08 +0000)]
Add LLVMLibC proposal to docs/index.rst.

Reviewers: rupprecht

Subscribers: arphaman, llvm-commits

Tags: #llvm

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

llvm-svn: 369030

4 years agoLink libpthread into LLVMCore.so
Benjamin Kramer [Thu, 15 Aug 2019 18:06:30 +0000 (18:06 +0000)]
Link libpthread into LLVMCore.so

After r369018 the compiler can inline pthread calls into users of
RWMutex.

llvm-svn: 369029

4 years agoFix the test, NFC.
Alexey Bataev [Thu, 15 Aug 2019 17:53:49 +0000 (17:53 +0000)]
Fix the test, NFC.

llvm-svn: 369028

4 years agoRevert "MemoryBuffer: Add a missing error-check to getOpenFileImpl"
Pavel Labath [Thu, 15 Aug 2019 17:52:40 +0000 (17:52 +0000)]
Revert "MemoryBuffer: Add a missing error-check to getOpenFileImpl"

This reverts commit r368977 because it broke a couple of tests in lldb.

llvm-svn: 369027

4 years ago[DebugInfo] Avoid crash from dropped fragments in LiveDebugValues
Jeremy Morse [Thu, 15 Aug 2019 17:49:46 +0000 (17:49 +0000)]
[DebugInfo] Avoid crash from dropped fragments in LiveDebugValues

This patch avoids a crash caused by DW_OP_LLVM_fragments being dropped
from DIExpressions by LiveDebugValues spill-restore code. The appearance
of a previously unseen fragment configuration confuses LDV, as documented
in PR42773, and reproduced by the test function this patch adds (Crashes
on a x86_64 debug build).

To avoid this, on spill restore, we now use fragment information from the
spilt-location-expression.

In addition, when spilling, we now don't spill any DBG_VALUE with a complex
expression, as it can't be safely restored and will definitely lead to an
incorrect variable location. The discussion of this is in D65368.

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

llvm-svn: 369026

4 years ago[CallGraph] Refine call graph for indirect calls with !callees metadata
Mark Lacey [Thu, 15 Aug 2019 17:47:53 +0000 (17:47 +0000)]
[CallGraph] Refine call graph for indirect calls with !callees metadata

For indirect call sites having a small set of possible callees,
!callees metadata can be used to indicate what those callees are.
This patch updates the call graph and lazy call graph analyses so
that they consider this metadata when encountering call sites. For
the call graph, it adds a new external call graph node to the graph
for each unique !callees metadata node. A call graph edge connects
an indirect call site with the external node associated with the
!callees metadata that is attached to it. And there is an edge from
this external node to each of the callees indicated by the metadata.
Similarly, for the lazy call graph, the patch adds Ref edges from a
caller to the possible callees indicated by the metadata.

The primary purpose of the patch is to facilitate iterating over the
functions in a module such that all of the callees indicated by a
given !callees metadata node will be visited prior to the functions
containing call sites annotated by that node. This property is
required by optimizations performing a bottom-up traversal of the
SCC DAG. For example, the inliner can be made to inline through an
indirect call. If the call site is annotated with !callees metadata,
this patch ensures that the inliner will have visited all of the
callees prior to the caller, allowing it to reliably compute the
cost of inlining one or more of the potential callees.

Original patch by @mssimpso. I've made some small changes to get it
to apply, build, and pass tests on the top of tree, as well as
some minor tweaks to formatting and functionality.

Subscribers: mehdi_amini, hiraditya, llvm-commits, mssimpso

Tags: #llvm

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

llvm-svn: 369025

4 years ago[NewPM][PassInstrumentation] IR printing support for (Thin)LTO
Taewook Oh [Thu, 15 Aug 2019 17:47:44 +0000 (17:47 +0000)]
[NewPM][PassInstrumentation] IR printing support for (Thin)LTO

Summary: IR printing has not been correctly supported with (Thin)LTO if the new pass manager is enabled. Previously we only get outputs from backend(codegen) passes, as they are still under legacy pass manager even when the new pass manager is enabled. This patch addresses the issue and enables IR printing for optimization passes with new pass manager + (Thin)LTO setting.

Reviewers: fedor.sergeev, philip.pfaffe

Subscribers: mehdi_amini, inglorion, hiraditya, steven_wu, dexonsmith, dang, llvm-commits

Tags: #llvm

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

llvm-svn: 369024

4 years agoFix lld on GCC 5.1 after the C++14 move
JF Bastien [Thu, 15 Aug 2019 17:47:19 +0000 (17:47 +0000)]
Fix lld on GCC 5.1 after the C++14 move

Summary:
libstdc++ in GCC 5.1 has some bugs. The move to C++14 in D66195 triggered one
such bug caused by the new constexpr support in C++14, and the implementation
doing SFINAE wrong with the comparator to std::stable_sort.

Here's a small repro: https://godbolt.org/z/2QC3-n

The fix is to inline the lambdas directly into the llvm::stable_sort call
instead of erasing them through a std::function. The code is more readable as
well.

Reviewers: thakis, ruiu, espindola

Subscribers: emaste, arichardson, MaskRay, jkorous, dexonsmith, llvm-commits

Tags: #llvm

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

llvm-svn: 369023

4 years ago[X86] Improve cost model for subvector extraction of less than 128-bit vectors
Craig Topper [Thu, 15 Aug 2019 17:29:42 +0000 (17:29 +0000)]
[X86] Improve cost model for subvector extraction of less than 128-bit vectors

Now that we're using widening legalization. We need to improve our extract_subvector cost model for these types. This patch begins by modeling these as a subvector extract followed by a permute. I've left FIXMEs in the code for future improvements.

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

llvm-svn: 369022

4 years ago[sanitizer_common] Always use posix_spawn on Darwin
Julian Lettner [Thu, 15 Aug 2019 17:25:10 +0000 (17:25 +0000)]
[sanitizer_common] Always use posix_spawn on Darwin

On Darwin we have two external symbolizers: atos and llvm-symbolizer.
atos was changed to use posix_spawn (instead of fork+execv) in a
previous commit [1]. Let's use posix_spawn for llvm-symbolizer as well.

Our hope is that eventually we can transition to posix_spawn on other
platforms too.

[1] 399408a92f1dbbefeb708f718b0d8eb62dfa9f09

llvm-svn: 369021

4 years agoTest commit #2.
George Karpenkov [Thu, 15 Aug 2019 17:17:21 +0000 (17:17 +0000)]
Test commit #2.

llvm-svn: 369020

4 years ago[Driver][Bundler] Improve bundling of object files.
Alexey Bataev [Thu, 15 Aug 2019 17:15:35 +0000 (17:15 +0000)]
[Driver][Bundler] Improve bundling of object files.

Summary:
Previously, object files were bundled using partial linking. It resulted
in the following structure of the bundled objects:
```
<host_code>
clang-offload-bundle
__CLANG_OFFLOAD_BUNDLE__<target>
<target_code>
```
But when we tried to unbundle object files, it worked correctly only for
the target objects. The host object remains bundled. It produced a lot of
junk sections in the host object files and in some cases may caused
incorrect linking.

Patch improves bundling of the object files. After this patch the
bundled object looks like this:

```
<host_code>
clang-offload-bundle
__CLANG_OFFLOAD_BUNDLE__<target>
<target_code>
__CLANG_OFFLOAD_BUNDLE__<host>
<host_code>
```

With this structure we are able to unbundle the host object files too so
that after unbundling they are the same as were before.
The host section is bundled twice. The bundled section is used to
unbundle the original host section.

Reviewers: yaxunl, tra, jlebar, hfinkel, jdoerfert

Subscribers: caomhin, kkwli0, cfe-commits

Tags: #clang

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

llvm-svn: 369019

4 years ago[Support] Base RWMutex on std::shared_timed_mutex (C++14)
Benjamin Kramer [Thu, 15 Aug 2019 16:55:23 +0000 (16:55 +0000)]
[Support] Base RWMutex on std::shared_timed_mutex (C++14)

This should have the same semantics. We use std::shared_mutex instead on
MSVC and C++17, std::shared_timed_mutex is less efficient than our
custom implementation on Windows, std::shared_mutex should be faster.

llvm-svn: 369018

4 years ago[LLVM][Alignment] Fix MSVC potential division by 0 warning (PR42911)
Simon Pilgrim [Thu, 15 Aug 2019 16:34:23 +0000 (16:34 +0000)]
[LLVM][Alignment] Fix MSVC potential division by 0 warning (PR42911)

Original Patch by @gchatelet (Guillaume Chatelet)

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

llvm-svn: 369016

4 years ago[BUNDLER]Improve the test, NFC.
Alexey Bataev [Thu, 15 Aug 2019 16:28:24 +0000 (16:28 +0000)]
[BUNDLER]Improve the test, NFC.

Summary:
Make the test more portable and do not rely on the pre-bundled object
file.

Reviewers: Hahnfeld, hfinkel, jdoerfert

Subscribers: caomhin, kkwli0, cfe-commits

Tags: #clang

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

llvm-svn: 369015