2 years ago[Driver][Darwin] Improve tests for -nostdinc & friends
Louis Dionne [Tue, 4 Feb 2020 23:34:28 +0000 (18:34 -0500)]
[Driver][Darwin] Improve tests for -nostdinc & friends

The tests were slightly underspecifying the current behavior of Clang.

2 years ago[lldb/Reproducers] Add underscore to varaibles in LLDB_RECORD macros
Jonas Devlieghere [Wed, 5 Feb 2020 00:21:31 +0000 (16:21 -0800)]
[lldb/Reproducers] Add underscore to varaibles in LLDB_RECORD macros

Rename all variables used in the LLDB_RECORD macros to start with an
underscore to avoid conflicts with the arguments being recorded.

2 years ago[lldb/Reproducers] Change record logging to mirror replay logging
Jonas Devlieghere [Wed, 5 Feb 2020 00:10:10 +0000 (16:10 -0800)]
[lldb/Reproducers] Change record logging to mirror replay logging

Pretty printing the return value, although a good idea in theory, turned
out to be more confusing than anything else because they require
printing the log statement after the arguments and resulting value have
been serialized.

This changes the logging to behave more like how deserialization is
traced, although a bit more verbose because some of the serializers are
are calling each other.

2 years ago[X86] Add custom lowering for lrint/llrint to either cvtss2si/cvtsd2si or fist.
Craig Topper [Tue, 4 Feb 2020 23:25:16 +0000 (15:25 -0800)]
[X86] Add custom lowering for lrint/llrint to either cvtss2si/cvtsd2si or fist.

lrint/llrint are defined as rounding using the current rounding
mode. Numbers that can't be converted raise FE_INVALID and an
implementation defined value is returned. They may also write to

I believe this means we can use cvtss2si/cvtsd2si or fist to
convert as long as -fno-math-errno is passed on the command line.
Clang will leave them as libcalls if errno is enabled so they
won't become ISD::LRINT/LLRINT in SelectionDAG.

For 64-bit results on a 32-bit target we can't use cvtss2si/cvtsd2si
but we can use fist since it can write to a 64-bit memory location.
Though maybe we could consider using vcvtps2qq/vcvtpd2qq on avx512dq

gcc also does this optimization.

I think we might be able to do this with STRICT_LRINT/LLRINT as
well, but I've left that for future work.

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

2 years agoFix x86 32bits MLIR build (NFC)
Dimitry Andric [Tue, 4 Feb 2020 23:57:02 +0000 (23:57 +0000)]
Fix x86 32bits MLIR build (NFC)

This is fixing a build error:

error: non-constant-expression cannot be narrowed from type 'unsigned int' to 'Region::iterator::difference_type' (aka 'int') in initializer list

Fix pr44767

2 years agoFix -Wunused-result warnings in LLDB
Reid Kleckner [Tue, 4 Feb 2020 23:50:44 +0000 (15:50 -0800)]
Fix -Wunused-result warnings in LLDB

These try_lock usages intentionally ignore the result, as commented.

Similar to 4d23764dddc23e74ad165086d7f471a3e0e52bf8, which was reviewed

2 years ago[compiler-rt] fix OpenBSD and Solaris build with sigaltstack interception
Evgenii Stepanov [Tue, 4 Feb 2020 23:50:44 +0000 (15:50 -0800)]
[compiler-rt] fix OpenBSD and Solaris build with sigaltstack interception

`sigaltstack` interception is implemented D73816. This updated OpenBSD and Solaris bits to fix the build errors.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: fedor.sergeev, krytarowski, emaste, eugenis, dberris, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

Patch by Igor Sugak.

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

2 years ago[Support] Fix warnings in ARMTargetParser.cpp
Reid Kleckner [Tue, 4 Feb 2020 23:48:22 +0000 (15:48 -0800)]
[Support] Fix warnings in ARMTargetParser.cpp

2 years ago[lldb] Rename Type::ResolveClangType to Type::ResolveCompilerType
Alex Langford [Tue, 4 Feb 2020 23:40:43 +0000 (15:40 -0800)]
[lldb] Rename Type::ResolveClangType to Type::ResolveCompilerType

This is not specific to clang types. It operates on CompilerTypes in

2 years ago[lldb] Delete commented-out code
Alex Langford [Tue, 4 Feb 2020 22:59:20 +0000 (14:59 -0800)]
[lldb] Delete commented-out code

2 years agoAvoid many std::tie/tuple instantiations in ASTImporter
Reid Kleckner [Tue, 4 Feb 2020 23:22:15 +0000 (15:22 -0800)]
Avoid many std::tie/tuple instantiations in ASTImporter

To factor the error checking, use importChecked instead of importSeq.
This avoids repeating the names of all of the imported child nodes once,
and allows errors to be checked with a single conditional as it is with

  peak memory: 601.63MB
  real: 0m19.172s
  obj size: 8,352kb

  peak memory: 954.11MB
  real: 0m26.188s
  obj size: 10,000kb

The speed is not as impressive as I hoped, but the memory use reduction
is impressive, and seems worth it.

Reviewed By: martong, shafik

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

2 years ago[X86] Give KSET0* and KSET1* pseudos the same scheduler resource usage as KXOR/KXNOR.
Craig Topper [Tue, 4 Feb 2020 20:37:19 +0000 (12:37 -0800)]
[X86] Give KSET0* and KSET1* pseudos the same scheduler resource usage as KXOR/KXNOR.

These aren't recognized as idioms by the CPU so they still use
execution resources. We just use the pseudo to force the input
register to k0.

2 years ago[SEH] Remove CATCHPAD SDNode and X86::EH_RESTORE MachineInstr
Reid Kleckner [Thu, 30 Jan 2020 23:15:57 +0000 (15:15 -0800)]
[SEH] Remove CATCHPAD SDNode and X86::EH_RESTORE MachineInstr

The CATCHPAD node mostly existed to be selected into the EH_RESTORE
instruction, which sets the frame back up when 32-bit Windows exceptions
return to the parent function. However, creating this MachineInstr early
increases the risk that other passes will come along and insert
instructions that use the stack before ESP and EBP are restored. That
happened in PR44697.

Instead of representing these in the instruction stream early, delay it
until PEI. Mark the blocks where this needs to happen as EHPads, but not
funclet entry blocks. Passes after PEI have to be careful not to hoist
instructions that can use stack across frame setup instructions, so this
should be relatively reliable.

Fixes PR44697

Reviewed By: hans

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

2 years ago[Concepts] Add missing CXXThisScope to function template constraint substitution
Saar Raz [Tue, 4 Feb 2020 22:51:40 +0000 (00:51 +0200)]
[Concepts] Add missing CXXThisScope to function template constraint substitution

We did not have a CXXThisScope around constraint checking of functions and
function template specializations, causing a crash when checking a constraint
that had a 'this' (bug 44689).

Recommit after fixing test.

2 years ago[lldb/Reproducers] Add missing SBFile methods to the registry
Jonas Devlieghere [Tue, 4 Feb 2020 23:09:53 +0000 (15:09 -0800)]
[lldb/Reproducers] Add missing SBFile methods to the registry

SBFile::Read and SBFile::Write were missing from the registry.

2 years agoRevert "[Concepts] Add missing CXXThisScope to function template constraint substitution"
Saar Raz [Tue, 4 Feb 2020 22:58:02 +0000 (00:58 +0200)]
Revert "[Concepts] Add missing CXXThisScope to function template constraint substitution"

This reverts commit 0c67cfdb114b4c2f5c7ec374cf12118c7fa9d768 which has a broken test.

2 years ago[Concepts] Add missing CXXThisScope to function template constraint substitution
Saar Raz [Tue, 4 Feb 2020 22:51:40 +0000 (00:51 +0200)]
[Concepts] Add missing CXXThisScope to function template constraint substitution

We did not have a CXXThisScope around constraint checking of functions and
function template specializations, causing a crash when checking a constraint
that had a 'this' (bug 44689)

2 years ago[OpenMP] Add Flush directive to OpenMPIRBuilder
Kiran Chandramohan [Tue, 4 Feb 2020 21:43:40 +0000 (21:43 +0000)]
[OpenMP] Add Flush directive to OpenMPIRBuilder

Add support for Flush in the OMPIRBuilder. This patch also adds changes
to clang to use the OMPIRBuilder when '-fopenmp-enable-irbuilder'
commandline option is used.

Reviewed By: jdoerfert

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

2 years ago[lldb] Remove unused references to ClangExpressionDeclMap
Alex Langford [Tue, 4 Feb 2020 22:40:51 +0000 (14:40 -0800)]
[lldb] Remove unused references to ClangExpressionDeclMap

2 years ago[compiler-rt] [netbsd] Fix build after "implement sigaltstack interception"
Kamil Rytarowski [Tue, 4 Feb 2020 22:30:05 +0000 (23:30 +0100)]
[compiler-rt] [netbsd] Fix build after "implement sigaltstack interception"

Fallout after: https://reviews.llvm.org/D73816

2 years ago[lldb] Remove clang classes from lldb-forward.h
Alex Langford [Mon, 3 Feb 2020 23:55:18 +0000 (15:55 -0800)]
[lldb] Remove clang classes from lldb-forward.h

lldb-forward.h is convenient in many ways, but having clang-based
class forward declarations in there makes it easy to proliferate uses of clang
outside of plugins. Removing them makes you much more conscious of when
you're using something from clang and marks where we're using things
from clang in non-plugins.

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

2 years ago[cmake] Fix clang builds with BUILD_SHARED=ON and CLANG_LINK_CLANG_DYLIB=ON
Tom Stellard [Tue, 4 Feb 2020 21:06:54 +0000 (13:06 -0800)]
[cmake] Fix clang builds with BUILD_SHARED=ON and CLANG_LINK_CLANG_DYLIB=ON

We were linking all the clang objects and shared libraries into
libclang-cpp.so, which was causing the command line options to be
registered twice.

Reviewers: beanz, mgorny

Reviewed By: beanz, mgorny

Subscribers: merge_guards_bot, mgorny, cfe-commits

Tags: #clang

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

2 years ago[lldb/Unittest] Fix the modules build by including TypeSystemClang.h
Jonas Devlieghere [Tue, 4 Feb 2020 22:05:15 +0000 (14:05 -0800)]
[lldb/Unittest] Fix the modules build by including TypeSystemClang.h

This should fix the modules build on the GreenDragon bot.

2 years agoRe-land "[lldb] [testsuite] generalize `DWARFASTParserClangTests` based on `DWARFExpr...
Jonas Devlieghere [Tue, 4 Feb 2020 21:59:29 +0000 (13:59 -0800)]
Re-land "[lldb] [testsuite] generalize `DWARFASTParserClangTests` based on `DWARFExpressionTest`'s YAML"

2 years ago[libomptarget] Implement wavefront functions for amdgcn
Jon Chesterfield [Tue, 4 Feb 2020 21:55:26 +0000 (21:55 +0000)]
[libomptarget] Implement wavefront functions for amdgcn

Summary: [libomptarget] Implement wavefront functions for amdgcn

Reviewers: jdoerfert, ABataev, grokos, arsenm

Reviewed By: arsenm

Subscribers: saiislam, wdng, arsenm, jvesely, openmp-commits

Tags: #openmp

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

2 years ago[compiler-rt] Fix sanitizer_common build for FreeBSD
Dimitry Andric [Tue, 4 Feb 2020 21:50:05 +0000 (22:50 +0100)]
[compiler-rt] Fix sanitizer_common build for FreeBSD

This was broken by 28c91219c7e2, which added `struct_stack_t_sz` only to

2 years agoRevert: [lldb] [testsuite] generalize `DWARFASTParserClangTests` based on `DWARFExpre...
Jan Kratochvil [Tue, 4 Feb 2020 21:48:27 +0000 (22:48 +0100)]
Revert: [lldb] [testsuite] generalize `DWARFASTParserClangTests` based on `DWARFExpressionTest`'s YAML

It is causing a failure on OSX, to be investigated more.

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

2 years ago[clang-tidy] Fix "expression is redundant [misc-redundant-expression]" warning. NFCI...
Simon Pilgrim [Tue, 4 Feb 2020 21:36:11 +0000 (21:36 +0000)]
[clang-tidy] Fix "expression is redundant [misc-redundant-expression]" warning. NFCI. (PR44768)

We only accept tok::TokenKind::comment enum values so no need to add other cases. Seems to be a cut+paste typo.

2 years agoAMDGPU: Fix isAlwaysUniform for simple asm SGPR results
Matt Arsenault [Tue, 4 Feb 2020 20:25:48 +0000 (15:25 -0500)]
AMDGPU: Fix isAlwaysUniform for simple asm SGPR results

We were handling the case where the result was a struct with an
extracted SGPR component, but not for the simple case.

2 years ago[lldb/Reproducers] Treat SB classes pass by value as const references
Jonas Devlieghere [Tue, 4 Feb 2020 21:18:12 +0000 (13:18 -0800)]
[lldb/Reproducers] Treat SB classes pass by value as const references

Unless trivially copyable, SB classes that are passed by value should be
treated as const references by the reproducer infrastructure and their
address should be serialized. This is already the case on the
serialization side, but not on the deserialization side. This fixes that
by removing the NotImplementedTag.

2 years ago[lldb/Reproducers] Instrument SBFile
Jonas Devlieghere [Tue, 4 Feb 2020 21:17:12 +0000 (13:17 -0800)]
[lldb/Reproducers] Instrument SBFile

Currently SBFile isn't really instrumented, which was causing trouble
when capturing and replaying the Python test suite. The class is
particularly tricky because one of its constructors takes a FileSP which
isn't instrumented. Until we have proper shadowing in place, we'll
simply always record a nullptr.

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

2 years agoFix "expression is redundant [misc-redundant-expression]" warning (PR44768)
Simon Pilgrim [Tue, 4 Feb 2020 21:23:50 +0000 (21:23 +0000)]
Fix "expression is redundant [misc-redundant-expression]" warning (PR44768)

Be more specific that getOperandConstraint should return -1 or a uint8_t value

2 years agoAMDGPU/GlobalISel: Select G_SEXT_INREG
Matt Arsenault [Sat, 25 Jan 2020 00:38:53 +0000 (19:38 -0500)]

2 years agoAMDGPU/GlobalISel: Do a better job splitting 64-bit G_SEXT_INREG
Matt Arsenault [Sat, 25 Jan 2020 14:31:09 +0000 (09:31 -0500)]
AMDGPU/GlobalISel: Do a better job splitting 64-bit G_SEXT_INREG

We don't need to expand to full shifts for the > 32-bit case. This
just switches to a sext_inreg of the high half.

2 years agoAMDGPU/GlobalISel: Legalize G_SEXT_INREG
Matt Arsenault [Tue, 4 Feb 2020 21:06:34 +0000 (16:06 -0500)]
AMDGPU/GlobalISel: Legalize G_SEXT_INREG

Split the VALU 64-bit case in RegBankSelect.

2 years ago[AMDGPU] Fix infinite loop with fma combines
Austin Kerbow [Tue, 4 Feb 2020 01:08:26 +0000 (17:08 -0800)]
[AMDGPU] Fix infinite loop with fma combines

https://reviews.llvm.org/D72312 introduced an infinite loop which involves
DAGCombiner::visitFMA and AMDGPUTargetLowering::performFNegCombine.

fma( a, fneg(b), fneg(c) ) => fneg( fma (a, b, c) ) => fma( a, fneg(b), fneg(c) ) ...

This only breaks with types where 'isFNegFree' returns flase, e.g. v4f32.
Reproducing the issue also needs the attribute 'no-signed-zeros-fp-math',
and no source mods allowed on one of the users of the Op.

This fix makes changes to indicate that it is not free to negate a fma if it
has users with source mods.

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

2 years ago[sanitizer] Add missing declarations for sigaltstack syscall wrappers.
Evgenii Stepanov [Tue, 4 Feb 2020 20:21:06 +0000 (12:21 -0800)]
[sanitizer] Add missing declarations for sigaltstack syscall wrappers.

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

2 years agoAMDGPU/GlobalISel: Remove extension legality hacks
Matt Arsenault [Tue, 21 Jan 2020 21:47:27 +0000 (16:47 -0500)]
AMDGPU/GlobalISel: Remove extension legality hacks

The legalization has improved since this was added, and the tests
relying on this no longer need it.

2 years ago[hip] Properly populate macros based on host processor.
Michael Liao [Mon, 3 Feb 2020 20:35:18 +0000 (15:35 -0500)]
[hip] Properly populate macros based on host processor.

- The device compilation needs to have a consistent source code compared
  to the corresponding host compilation. If macros based on the
  host-specific target processor is not properly populated, the device
  compilation may fail due to the inconsistent source after the
  preprocessor. So far, only the host triple is used to build the
  macros. If a detailed host CPU target or certain features are
  specified, macros derived from them won't be populated properly, e.g.
  `__SSE3__` won't be added unless `+sse3` feature is present. On
  Windows compilation compatible with MSVC, that missing macros result
  in that intrinsics are not included and cause device compilation
  failure on the host-side source.

- This patch addresses this issue by introducing two `cc1` options,
  i.e., `-aux-target-cpu` and `-aux-target-feature`. If a specific host
  CPU target or certain features are specified, the compiler driver will
  append them during the construction of the offline compilation
  actions. Then, the toolchain in `cc1` phase will populate macros

- An internal option `--gpu-use-aux-triple-only` is added to fall back
  the original behavior to help diagnosing potential issues from the new

Reviewers: tra, yaxunl

Subscribers: cfe-commits

Tags: #clang

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

2 years agoPR44761: Fix fallback to later tiebreakers if two non-template functions
Richard Smith [Tue, 4 Feb 2020 20:20:34 +0000 (12:20 -0800)]
PR44761: Fix fallback to later tiebreakers if two non-template functions
are equally constrained.

2 years agoAdditional testcase for 0130b6cb5a8.
Richard Smith [Tue, 4 Feb 2020 19:43:15 +0000 (11:43 -0800)]
Additional testcase for 0130b6cb5a8.

2 years agoTry to fix windows build bot after 008e7bf92343b8bd6ebade5b3ddcfe4bb4e29f8d
Tyker [Tue, 4 Feb 2020 20:17:47 +0000 (21:17 +0100)]
Try to fix windows build bot after 008e7bf92343b8bd6ebade5b3ddcfe4bb4e29f8d

2 years agoRecommit "[X86] Use X86ISD::SUB instead of X86ISD::CMP in some places."
Craig Topper [Tue, 4 Feb 2020 19:25:24 +0000 (11:25 -0800)]
Recommit "[X86] Use X86ISD::SUB instead of X86ISD::CMP in some places."

This time with correct types for the data result from the SUB.

Original commit message:

Our normal lowering for ISD::SETCC uses X86ISD::SUB to enable
CSE unless the RHS is 0. optimizeCompareInstr called by the peephole
pass can turn subs with unused results into cmps to clean this up.

This commit makes other places that create X86ISD::CMP have the
same behavior.

2 years ago[mlir] Print types to the OpAsmPrinter instead of the raw_ostream.
River Riddle [Tue, 4 Feb 2020 20:17:14 +0000 (12:17 -0800)]
[mlir] Print types to the OpAsmPrinter instead of the raw_ostream.

This allows for reusing the internal state of the printer, which is more
efficient and also allows for using type aliases

2 years ago[InlineCost] Add flag to allow changing the default inline cost
Teresa Johnson [Tue, 4 Feb 2020 18:37:53 +0000 (10:37 -0800)]
[InlineCost] Add flag to allow changing the default inline cost

It can be useful to tune the default inline threshold without overriding other inlining thresholds (e.g. in code compiled for size).

The existing `-inline-threshold` flag overrides other thresholds, so it is insufficient in codebases where there is a mix of code compiled for size and speed.

Patch by Michael Holman <michael.holman@microsoft.com>

Reviewers: eraman, tejohnson

Reviewed By: tejohnson

Subscribers: tejohnson, mtrofin, davidxl, hiraditya, haicheng, llvm-commits

Tags: #llvm

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

2 years agoAMDGPU/GlobalISel: Custom lower G_FEXP
Matt Arsenault [Sat, 25 Jan 2020 01:53:26 +0000 (20:53 -0500)]
AMDGPU/GlobalISel: Custom lower G_FEXP

2 years agoAMDGPU/GlobalISel: Legalize s16 G_FEXP2
Matt Arsenault [Sat, 25 Jan 2020 02:21:03 +0000 (21:21 -0500)]
AMDGPU/GlobalISel: Legalize s16 G_FEXP2

2 years ago[libc] Fix typo in header generation docs.
Paula Toth [Tue, 4 Feb 2020 18:39:16 +0000 (10:39 -0800)]
[libc] Fix typo in header generation docs.

Reviewers: sivachandra, abrachet

Reviewed By: sivachandra, abrachet

Subscribers: libc-commits, MaskRay, tschuett

Tags: #libc-project, #llvm

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

2 years ago[C++20] Add consteval-specific semantic for functions
Tyker [Tue, 4 Feb 2020 18:23:33 +0000 (19:23 +0100)]
[C++20] Add consteval-specific semantic for functions

 - Calls to consteval function are now evaluated in constant context but IR is still generated for them.
 - Add diagnostic for taking address of a consteval function in non-constexpr context.
 - Add diagnostic for address of consteval function accessible at runtime.
 - Add tests

Reviewers: rsmith, aaron.ballman

Reviewed By: rsmith

Subscribers: mgrang, riccibruno, cfe-commits

Tags: #clang

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

2 years agolibclc/asin: Switch to amd builtins version of asin
Aaron Watry [Sun, 2 Feb 2020 01:54:45 +0000 (19:54 -0600)]
libclc/asin: Switch to amd builtins version of asin

Fixes a wimpy-mode CTS failure for asin(float).

Passes non-wimpy for both float/double on RX580.

Signed-off-by: Aaron Watry <awatry@gmail.com>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
2 years agoCodeGenPrepare: Reorder check for cold and shouldOptimizeForSize
Matt Arsenault [Fri, 31 Jan 2020 19:35:53 +0000 (14:35 -0500)]
CodeGenPrepare: Reorder check for cold and shouldOptimizeForSize

shouldOptimizeForSize is showing up in a profile, spending around 10%
of the pass time in one function. This should probably not be so slow,
but the much cheaper attribute check should be done first anyway.

2 years ago[mlir] [VectorOps] refined description of vector.contract
aartbik [Mon, 3 Feb 2020 21:27:41 +0000 (13:27 -0800)]
[mlir] [VectorOps] refined description of vector.contract

A few details were missing in the description. These
changes makes the documented code "compile".

Reviewers: nicolasvasilache, andydavis1

Reviewed By: nicolasvasilache, andydavis1

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

Tags: #llvm

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

2 years ago[clang-format] Allow a comment to follow a C# attribute specifier
Jonathan Coe [Tue, 4 Feb 2020 18:26:47 +0000 (18:26 +0000)]
[clang-format] Allow a comment to follow a C# attribute specifier

Summary: Add comments to the list of tokens that can follow the ']' at the end of a C# attribute specifier to prevent comments after attribute specifiers from being formatted as continuations.

Reviewers: MyDeveloperDay, krasimir

Reviewed By: MyDeveloperDay

Tags: #clang-format

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

2 years agoAMDGPU: Split denormal mode tracking bits
Matt Arsenault [Tue, 3 Dec 2019 07:01:21 +0000 (12:31 +0530)]
AMDGPU: Split denormal mode tracking bits

Prepare to accurately track the future denormal-fp-math attribute
changes. The way to actually set these separately is not wired in yet.

This is just a mechanical change, and mostly still assumes the input
and output mode match. This should be refined for some cases. For
example, fcanonicalize lowering should use the flushing variant if
either input or output flushing is enabled

2 years ago[lldb/test] Skip TestBasicEntryValuesX86_64 due to llvm.org/PR44774
Vedant Kumar [Tue, 4 Feb 2020 18:43:44 +0000 (10:43 -0800)]
[lldb/test] Skip TestBasicEntryValuesX86_64 due to llvm.org/PR44774

2 years ago[lldb/StackFrameList] Convert assert to defensive check in SynthesizeTailCallFrames
Vedant Kumar [Tue, 4 Feb 2020 18:12:47 +0000 (10:12 -0800)]
[lldb/StackFrameList] Convert assert to defensive check in SynthesizeTailCallFrames

In order to synthesize tail call frames, the stack frame list must not
be empty (otherwise, there is no "previous" frame to infer a tail call

This case is hard to hit. To trigger it, we must first fail to push
`unwind_frame_sp` because we either fail to get its SymbolContext, or
given its SymbolContext the GetParentOfInlineScope call fails. This
causes m_concrete_frames_fetched to be incremented while m_frames
remains empty. Then, the next frame in the stack may fail within
SynthesizeTailCallFrames. This crash arose during a kernel debugging


2 years ago[mlir] Fix clang 5 warning for missing braces
Jacques Pienaar [Tue, 4 Feb 2020 18:34:42 +0000 (10:34 -0800)]
[mlir] Fix clang 5 warning for missing braces

2 years ago[test] yaml2obj -docnum => --docnum=
Fangrui Song [Tue, 4 Feb 2020 18:03:14 +0000 (10:03 -0800)]
[test] yaml2obj -docnum => --docnum=

Make usage more consistent, and make it possible to enable LongOptionsUseDoubleDash.

2 years agoAMDGPU: Cleanup SMRD buffer selection
Matt Arsenault [Thu, 30 Jan 2020 16:03:17 +0000 (11:03 -0500)]
AMDGPU: Cleanup SMRD buffer selection

The usage of the Imm out argument from SelectSMRDOffset is pretty
confusing. Stop trying to reject CI immediates in the case where the
offset field can be used. It's not an illegal way to encode the
immediate, so just prefer the better encoding pattern with

We probably don't even really need the different opcodes for the
different offset types anymore, but that will be more work to cleanup.

The SMRD non-buffer load patterns could also use a cleanup to be done

2 years agoGlobalISel: Fold SmallVector resizes into constructors
Matt Arsenault [Tue, 4 Feb 2020 15:34:22 +0000 (10:34 -0500)]
GlobalISel: Fold SmallVector resizes into constructors

2 years ago[X86] Fix missing load latencies (PR36894)
Simon Pilgrim [Tue, 4 Feb 2020 18:01:38 +0000 (18:01 +0000)]
[X86] Fix missing load latencies (PR36894)

We weren't account for load latencies in the SSE42/AES/CLMUL schedule classes

2 years agoTry to fix buildbot failure
Matt Arsenault [Tue, 4 Feb 2020 18:06:55 +0000 (13:06 -0500)]
Try to fix buildbot failure

2 years ago[clang][NFC] Expand some `auto`s and add another test for matcher `isExpandedFromMacro`.
Yitzhak Mandelbaum [Tue, 4 Feb 2020 17:32:06 +0000 (12:32 -0500)]
[clang][NFC] Expand some `auto`s and add another test for matcher `isExpandedFromMacro`.

Summary: Spells out some `auto`s explicitly and adds another test for the matcher `isExpandedFromMacro`.

Reviewers: aaron.ballman

Subscribers: gribozavr, cfe-commits

Tags: #clang

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

2 years ago[BFI] Add a debug check for unknown block queries.
Hiroshi Yamauchi [Mon, 3 Feb 2020 20:22:03 +0000 (12:22 -0800)]
[BFI] Add a debug check for unknown block queries.

Add a debug check for frequency queries for unknown blocks (typically blocks
that are created after BFI is computed but their frequencies are not
communicated to BFI.)

This is useful for detecting and debugging missed BFI updates.

This is debug build only and disabled behind a flag.

Reviewers: davidxl

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

2 years ago[InstCombine] add FIXME comment to shuffle transform; NFC
Sanjay Patel [Tue, 4 Feb 2020 17:59:23 +0000 (12:59 -0500)]
[InstCombine] add FIXME comment to shuffle transform; NFC

Existing tests:
...should verify that the underlying analysis doesn't improve
too much without updating this user code.

2 years agoSeparately track input and output denormal mode
Matt Arsenault [Thu, 7 Nov 2019 01:10:52 +0000 (17:10 -0800)]
Separately track input and output denormal mode

AMDGPU and x86 at least both have separate controls for whether
denormal results are flushed on output, and for whether denormals are
implicitly treated as 0 as an input. The current DAGCombiner use only
really cares about the input treatment of denormals.

2 years ago[clang] fix lib/ASTMatchers for BUILD_SHARED_LIBS=ON
Stephen Neuendorffer [Tue, 4 Feb 2020 17:45:28 +0000 (09:45 -0800)]
[clang] fix lib/ASTMatchers for BUILD_SHARED_LIBS=ON

2 years ago[X86] -fpatchable-function-entry=N,0: place patch label after ENDBR{32,64}
Fangrui Song [Fri, 31 Jan 2020 02:16:09 +0000 (18:16 -0800)]
[X86] -fpatchable-function-entry=N,0: place patch label after ENDBR{32,64}

Similar to D73680 (AArch64 BTI).

A local linkage function whose address is not taken does not need ENDBR32/ENDBR64. Placing the patch label after ENDBR32/ENDBR64 has the advantage that code does not need to differentiate whether the function has an initial ENDBR.

Also, add 32-bit tests and test that .cfi_startproc is at the function
entry. The line information has a general implementation and is tested
by AArch64/patchable-function-entry-empty.mir

Reviewed By: nickdesaulniers

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

2 years ago[Driver] Change -fmax-tokens $arg to -fmax-tokens=$arg
Fangrui Song [Tue, 4 Feb 2020 01:07:41 +0000 (17:07 -0800)]
[Driver] Change -fmax-tokens $arg to -fmax-tokens=$arg

Reviewed By: hans

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

2 years ago[ARM] Correct missing newline after outputting .tlsdescseq directive.
David Spickett [Tue, 4 Feb 2020 16:52:41 +0000 (16:52 +0000)]
[ARM] Correct missing newline after outputting .tlsdescseq directive.

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

2 years agoscudo: Simplify getClassIdBySize() logic. NFCI.
Peter Collingbourne [Mon, 3 Feb 2020 23:35:35 +0000 (15:35 -0800)]
scudo: Simplify getClassIdBySize() logic. NFCI.

By subtracting 1 from Size at the beginning we can simplify the
subsequent calculations. This also saves 4 instructions on aarch64
and 9 instructions on x86_64, but seems to be perf neutral.

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

2 years ago[BPF] use base lvalue type for preserve_{struct,union}_access_index metadata
Yonghong Song [Sun, 2 Feb 2020 22:54:16 +0000 (14:54 -0800)]
[BPF] use base lvalue type for preserve_{struct,union}_access_index metadata

Linux commit
uses "#pragma clang attribute push (__attribute__((preserve_access_index)),
      apply_to = record)"
to apply CO-RE relocations to all records including the following pattern:
  #pragma clang attribute push (__attribute__((preserve_access_index)), apply_to = record)
  typedef struct {
    int a;
  } __t;
  #pragma clang attribute pop
  int test(__t *arg) { return arg->a; }

The current approach to use struct type in the relocation record will
result in an anonymous struct, which make later type matching difficult
    in bpf loader. In fact, current BPF backend will fail the above program
with assertion:
  clang: ../lib/Target/BPF/BPFAbstractMemberAccess.cpp:796: ...
     Assertion `TypeName.size()' failed.

The patch use the base lvalue type for the "base" value to annotate
preservee_{struct,union}_access_index intrinsics. In the above example,
the type will be "__t" which preserved the type name.

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

2 years ago[NFC][LangRef][FPEnv] Fix whitespace for denormal-fp-math/denormal-fp-math-f32
Cameron McInally [Tue, 4 Feb 2020 17:10:43 +0000 (11:10 -0600)]
[NFC][LangRef][FPEnv] Fix whitespace for denormal-fp-math/denormal-fp-math-f32

Fix incorrect spacing for `denormal-fp-math` and `denormal-fp-math-f32`. No
other changes.

2 years ago[MLIR] Fixes for shared library dependencies.
Stephen Neuendorffer [Wed, 1 Jan 2020 01:23:01 +0000 (17:23 -0800)]
[MLIR] Fixes for shared library dependencies.


This patch is a step towards enabling BUILD_SHARED_LIBS=on, which
builds most libraries as DLLs instead of statically linked libraries.
The main effect of this is that incremental build times are greatly
reduced, since usually only one library need be relinked in response
to isolated code changes.

The bulk of this patch is fixing incorrect usage of cmake, where library
dependencies are listed under add_dependencies rather than under
target_link_libraries or under the LINK_LIBS tag.  Correct usage should be
like this:

add_dependencies(MLIRfoo MLIRfooIncGen)
target_link_libraries(MLIRfoo MLIRlib1 MLIRlib2)

A separate issue is that in cmake, dependencies between static libraries
are automatically included in dependencies.  In the above example, if MLIBlib1
depends on MLIRlib2, then it is sufficient to have only MLIRlib1 in the
target_link_libraries.  When compiling with shared libraries, it is necessary
to have both MLIRlib1 and MLIRlib2 specified if MLIRfoo uses symbols from both.

Reviewers: mravishankar, antiagainst, nicolasvasilache, vchuravy, inouehrs, mehdi_amini, jdoerfert

Reviewed By: nicolasvasilache, mehdi_amini

Subscribers: Joonsoo, merge_guards_bot, jholewinski, mgorny, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, csigg, arpith-jacob, mgester, lucyrfox, herhut, aartbik, liufengdb, llvm-commits

Tags: #llvm

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

2 years ago[BPF] handle typedef of struct/union for CO-RE relocations
Yonghong Song [Sun, 2 Feb 2020 05:00:00 +0000 (21:00 -0800)]
[BPF] handle typedef of struct/union for CO-RE relocations

Linux commit
uses "#pragma clang attribute push (__attribute__((preserve_access_index)),
      apply_to = record)"
to apply CO-RE relocations to all records including the following pattern:
  #pragma clang attribute push (__attribute__((preserve_access_index)), apply_to = record)
  typedef struct {
    int a;
  } __t;
  #pragma clang attribute pop
  int test(__t *arg) { return arg->a; }

The current approach to use struct/union type in the relocation record will
result in an anonymous struct, which make later type matching difficult
in bpf loader. In fact, current BPF backend will fail the above program
with assertion:
  clang: ../lib/Target/BPF/BPFAbstractMemberAccess.cpp:796: ...
     Assertion `TypeName.size()' failed.

clang will change to use the type of the base of the member access
which will preserve the typedef modifier for the
preserve_{struct,union}_access_index intrinsics in the above example.
Here we adjust BPF backend to accept that the debuginfo
type metadata may be 'typedef' and handle them properly.

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

2 years ago[clang] Add matcher to identify macro expansions.
Yitzhak Mandelbaum [Mon, 3 Feb 2020 21:21:02 +0000 (16:21 -0500)]
[clang] Add matcher to identify macro expansions.

This revision adds a matcher `isExpandedFromMacro` that determines whether a
statement is (transitively) expanded from a given macro.

Reviewers: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

2 years agoPowerPC: Remove redundancy in ternary for predicate selection
Justin Hibbits [Tue, 4 Feb 2020 16:33:39 +0000 (10:33 -0600)]
PowerPC: Remove redundancy in ternary for predicate selection

rG2c4620ad57b8 inadvertently added redundancies in selection of GT and
LE predicates for SPE.  Correct this.

Partially addresses PR 44768.

2 years ago[ARM][AsmParser] Make assembly directives case insensitive
David Spickett [Mon, 27 Jan 2020 13:47:09 +0000 (13:47 +0000)]
[ARM][AsmParser] Make assembly directives case insensitive

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

2 years ago[clangd] Don't assert when completing a lambda variable inside the lambda.
Sam McCall [Tue, 4 Feb 2020 13:42:06 +0000 (14:42 +0100)]
[clangd] Don't assert when completing a lambda variable inside the lambda.

This is a fairly ugly hack - we back off several features for any variable
whose type isn't deduced, to avoid computing/caching linkage.
Better suggestions welcome.

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

Reviewers: kadircet, kbobyrev

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

Tags: #clang

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

2 years agoReland "[clangd] Mechanism to make update debounce responsive to rebuild speed."
Sam McCall [Tue, 4 Feb 2020 14:41:39 +0000 (15:41 +0100)]
Reland "[clangd] Mechanism to make update debounce responsive to rebuild speed."

This reverts commit ed98994f64b8fe6443aef57a5faa953e86d9fc0e.
Removed the accidental double-mutex-unlock.

2 years ago[VE] half fptrunc+store&load+fpext
Kazushi (Jam) Marukawa [Tue, 4 Feb 2020 15:55:20 +0000 (16:55 +0100)]
[VE] half fptrunc+store&load+fpext

fp16 (half) load+fpext and fptrunc+store isel legalization and tests.
Also, ExternalSymbolSDNode operand printing (tested by fp16 lowering).

Reviewed By: arsenm

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

2 years ago[SystemZ] Add 'REQUIRES:' or '-mtriple' to some newly added tests.
Jonas Paulsson [Tue, 4 Feb 2020 15:51:42 +0000 (16:51 +0100)]
[SystemZ]  Add 'REQUIRES:' or '-mtriple' to some newly added tests.

Needed to fix buildbots.

2 years ago[SystemZ] Support -msoft-float
Jonas Paulsson [Fri, 3 Jan 2020 23:39:07 +0000 (00:39 +0100)]
[SystemZ]  Support -msoft-float

This is needed when building the Linux kernel.

Review: Ulrich Weigand

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

2 years agoRevert "DebugInfo: Add missing test coverage for DW_OP_convert in loclists"
Nico Weber [Tue, 4 Feb 2020 15:10:04 +0000 (10:10 -0500)]
Revert "DebugInfo: Add missing test coverage for DW_OP_convert in loclists"

This reverts commit 5327b917e3bd0b3db352cb5a61eea7409f2d1972.
Already fails on non-Linux at this commit.

2 years agoRevert "DebugInfo: Check DW_OP_convert in loclists with Split DWARF"
Nico Weber [Tue, 4 Feb 2020 15:05:49 +0000 (10:05 -0500)]
Revert "DebugInfo: Check DW_OP_convert in loclists with Split DWARF"
and follow-ups.

This reverts commit 1ced28cbe75ff81f35ac2c71e941041eb3afcd00.
This reverts commit 4f281f047457ce3f1870a93253476222314f420b.
This reverts commit 552a8fe12bd1822f48dda2e9e8728a179f82d356.

The test fails on non-Linux.

2 years ago[DebugInfo] Re-instate LiveDebugVariables scope trimming
Jeremy Morse [Tue, 4 Feb 2020 14:19:42 +0000 (14:19 +0000)]
[DebugInfo] Re-instate LiveDebugVariables scope trimming

This patch reverts part of r362750 / D62650, which stopped
LiveDebugVariables from trimming leading variable location ranges down
to only covering those instructions that are in scope. I've observed some
circumstances where the number of DBG_VALUEs in a function can be
amplified in an un-necessary way, to cover more instructions that are
out of scope, leading to very slow compile times. Trimming the range
of instructions that the variables cover solves the slow compile times.

The specific problem that r362750 tries to fix is addressed by the
assignment to RStart that I've added. Any variable location that begins
at the first instruction of a block will now be considered to begin at the
start of the block. While these sound the same, the have different
SlotIndexes, and the register allocator may shoehorn additional
instructions in between the two. The test added in the past
(wrong_debug_loc_after_regalloc.ll) still works with this modification.

live-debug-variables.ll has a range trimmed to not cover the prologue of
the function, while dbg-addr-dse.ll has a DBG_VALUE sink past one
instruction with no DebugLoc, which is expected behaviour.

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

2 years ago[ARM] Make ARM::ArchExtKind use 64-bit underlying type (part 2), NFCI
Mikhail Maltsev [Tue, 4 Feb 2020 14:48:10 +0000 (14:48 +0000)]
[ARM] Make ARM::ArchExtKind use 64-bit underlying type (part 2), NFCI

After following Simon's suggestion about additional testing posted at
https://reviews.llvm.org/D73906, I found several more places that
need to be updated.

Reviewers: simon_tatham, dmgreen, ostannard, eli.friedman

Reviewed By: simon_tatham

Subscribers: merge_guards_bot, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

2 years agoRevert "[clangd] Mechanism to make update debounce responsive to rebuild speed."
Sam McCall [Tue, 4 Feb 2020 14:33:53 +0000 (15:33 +0100)]
Revert "[clangd] Mechanism to make update debounce responsive to rebuild speed."

This reverts commit 92570718a86cc4c23108b596002114ab25857b14.
Breaking tests:

2 years ago[Polly] Fix compilation after 105642af5eef: include PassManagerImpl.h
Krzysztof Parzyszek [Tue, 4 Feb 2020 14:18:40 +0000 (08:18 -0600)]
[Polly] Fix compilation after 105642af5eef: include PassManagerImpl.h

2 years ago[clangd] Increase stack size of the new threads on macOS
Sam McCall [Tue, 4 Feb 2020 14:08:11 +0000 (15:08 +0100)]
[clangd] Increase stack size of the new threads on macOS

Summary: By default it's 512K, which is way to small for clang parser to run on. There is no way to do it via platform-independent API, so it's implemented via pthreads directly in clangd/Threading.cpp.

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

Patch by Dmitry Kozhevnikov!

Reviewers: ilya-biryukov, sammccall, arphaman

Reviewed By: ilya-biryukov, sammccall, arphaman

Subscribers: dexonsmith, umanwizard, jfb, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

2 years ago[InstCombine] add more splat tests with undef elements; NFC
Sanjay Patel [Tue, 4 Feb 2020 14:01:16 +0000 (09:01 -0500)]
[InstCombine] add more splat tests with undef elements; NFC

2 years ago[lldb] [testsuite] Fixup: generalize `DWARFASTParserClangTests` based on `DWARFExpres...
Jan Kratochvil [Tue, 4 Feb 2020 14:02:10 +0000 (15:02 +0100)]
[lldb] [testsuite] Fixup: generalize `DWARFASTParserClangTests` based on `DWARFExpressionTest`'s YAML

The testcase did not compile now because of an upstream change in the

For: https://reviews.llvm.org/D73279

2 years ago[mlir][spirv] Wrap debug-only method in #ifndef NDEBUG
Lei Zhang [Tue, 4 Feb 2020 13:56:28 +0000 (08:56 -0500)]
[mlir][spirv] Wrap debug-only method in #ifndef NDEBUG

2 years ago[Linalg] Add tiling of Linalg to parallel loops.
Alexander Belyaev [Tue, 4 Feb 2020 13:11:10 +0000 (14:11 +0100)]
[Linalg] Add tiling of Linalg to parallel loops.

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

2 years ago[mlir][spirv] Add resource limits into target environment
Lei Zhang [Fri, 31 Jan 2020 15:23:41 +0000 (10:23 -0500)]
[mlir][spirv] Add resource limits into target environment

This commit adds two resource limits, max_compute_workgroup_size
and max_compute_workgroup_invocations as resource limits to
the target environment. They are not used at the current moment,
but they will affect the SPIR-V CodeGen. Adding for now to have
a proper target environment modelling.

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

2 years ago[lldb] [testsuite] generalize `DWARFASTParserClangTests` based on `DWARFExpressionTes...
Jan Kratochvil [Tue, 4 Feb 2020 13:33:29 +0000 (14:33 +0100)]
[lldb] [testsuite] generalize `DWARFASTParserClangTests` based on `DWARFExpressionTest`'s YAML

YAMLModuleTester from DWARFExpressionTest can be reused for more

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

2 years ago[lldb] Increase LINK_INTERFACE_MULTIPLICITY for Debug builds
Jan Kratochvil [Tue, 4 Feb 2020 13:30:27 +0000 (14:30 +0100)]
[lldb] Increase LINK_INTERFACE_MULTIPLICITY for Debug builds

On Fedora 30 x86_64 with

It does not affect Release builds.

lldb/source/Expression/IRInterpreter.cpp:1471: error: undefined reference to 'lldb_private::ThreadPlanCallFunctionUsingABI::ThreadPlanCallFunctionUsingABI(lldb_private::Thread&, lldb_private::Address const&, llvm::Type&, llvm::Type&, llvm::ArrayRef<lldb_private::ABI::CallArgument>, lldb_private::EvaluateExpressionOptions const&)'
lldb/source/Expression/LLVMUserExpression.cpp:148: error: undefined reference to 'lldb_private::ThreadPlanCallUserExpression::ThreadPlanCallUserExpression(lldb_private::Thread&, lldb_private::Address&, llvm::ArrayRef<unsigned long>, lldb_private::EvaluateExpressionOptions const&, std::shared_ptr<lldb_private::UserExpression>&)'

Pavel Labath has suggest LINK_INTERFACE_MULTIPLICITY could be further

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

2 years ago[InstCombine] add splat tests with undef elements; NFC
Sanjay Patel [Tue, 4 Feb 2020 12:59:12 +0000 (07:59 -0500)]
[InstCombine] add splat tests with undef elements; NFC

2 years ago[InstCombine] fix operands of shouldChangeType() for casted phi transform
Sanjay Patel [Tue, 4 Feb 2020 12:02:01 +0000 (07:02 -0500)]
[InstCombine] fix operands of shouldChangeType() for casted phi transform

This is a bug noted in the recent D72733 and seen
in the similar transform just above the changed source code.

I added tests with illegal types and zexts to show the bug -
we could transform legal phi ops to illegal, etc. I did not add
tests with trunc because we won't see any diffs on those patterns.
That is because InstCombiner::SliceUpIllegalIntegerPHI() appears to
do those transforms independently of datalayout. It can also create
more casts than are present in existing code.

There are some existing regression tests that do not include a
datalayout that would be altered by this fix. I assumed that the
lack of a datalayout in those regression files is an oversight, so
I added the minimal layout (make i32 legal) necessary to preserve
behavior on those tests.

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

2 years ago[Matrix] Mark matrix memory intrinsics as argmemonly/write|read mem.
Florian Hahn [Tue, 4 Feb 2020 12:23:42 +0000 (12:23 +0000)]
[Matrix] Mark matrix memory intrinsics as argmemonly/write|read mem.

matrix.columnwise.load and matrix.columnwise.store only access memory
through the argument pointers. Also matrix.columnwise.store only writes