platform/upstream/llvm.git
4 years ago[OpenMP][Tool] Improving stack trace for Archer
Joachim Protze [Tue, 14 Jan 2020 08:12:48 +0000 (22:12 -1000)]
[OpenMP][Tool] Improving stack trace for Archer

The OpenMP runtime is not instrumented, so entering the runtime leaves no hint
on the source line of the pragma on ThreadSanitizer's function stack.

This patch adds function entry/exit annotations for OpenMP parallel regions,
and synchronization regions (barrier, taskwait, taskgroup).

Reviewed By: jdoerfert

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

4 years ago[ELF] Delete unintended --force-bti
Fangrui Song [Tue, 14 Jan 2020 07:56:47 +0000 (23:56 -0800)]
[ELF] Delete unintended --force-bti

4 years ago[OpenMP][Tool] Make tests for archer dependent on TSan
Joachim Protze [Tue, 14 Jan 2020 07:44:06 +0000 (21:44 -1000)]
[OpenMP][Tool] Make tests for archer dependent on TSan

If the openmp project is built standalone, the test compiler is feature tested for an available -fsanitize=thread flag.
If the openmp project is built as part of llvm, the target tsan is needed to test archer.

An additional line (requires tsan) was introduced to the tests, this patch updates the line numbers for the race.

Follow-up for 77ad98c

Reviewed By: jdoerfert

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

4 years ago[ELF] Add -z force-ibt and -z shstk for Intel Control-flow Enforcement Technology
Fangrui Song [Wed, 11 Dec 2019 02:05:36 +0000 (18:05 -0800)]
[ELF] Add -z force-ibt and -z shstk for Intel Control-flow Enforcement Technology

This patch is a joint work by Rui Ueyama and me based on D58102 by Xiang Zhang.

It adds Intel CET (Control-flow Enforcement Technology) support to lld.
The implementation follows the draft version of psABI which you can
download from https://github.com/hjl-tools/x86-psABI/wiki/X86-psABI.

CET introduces a new restriction on indirect jump instructions so that
you can limit the places to which you can jump to using indirect jumps.

In order to use the feature, you need to compile source files with
-fcf-protection=full.

* IBT is enabled if all input files are compiled with the flag. To force enabling ibt, pass -z force-ibt.
* SHSTK is enabled if all input files are compiled with the flag, or if -z shstk is specified.

IBT-enabled executables/shared objects have two PLT sections, ".plt" and
".plt.sec".  For the details as to why we have two sections, please read
the comments.

Reviewed By: xiangzhangllvm

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

4 years ago[MC] Don't resolve relocations referencing STB_LOCAL STT_GNU_IFUNC
Fangrui Song [Tue, 14 Jan 2020 07:35:57 +0000 (23:35 -0800)]
[MC] Don't resolve relocations referencing STB_LOCAL STT_GNU_IFUNC

4 years ago[PowerPC] [NFC] set instruction number as 1st priority of lsr cost model.
Zheng Chen [Tue, 14 Jan 2020 07:18:21 +0000 (02:18 -0500)]
[PowerPC] [NFC] set instruction number as 1st priority of lsr cost model.

4 years ago[MLIR] Fix broken link locations after move to monorepo
Daniel Galvez [Tue, 14 Jan 2020 07:13:42 +0000 (07:13 +0000)]
[MLIR] Fix broken link locations after move to monorepo

I used the codemod python tool to do this with the following commands:

codemod 'tensorflow/mlir/blob/master/include' 'llvm/llvm-project/blob/master/mlir/include'
codemod 'tensorflow/mlir/blob/master' 'llvm/llvm-project/blob/master/mlir'
codemod 'tensorflow/mlir' 'llvm-project/llvm'

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

4 years ago[X86] Copy the nofpexcept flag when folding a load into an instruction using the...
Craig Topper [Tue, 14 Jan 2020 06:02:45 +0000 (22:02 -0800)]
[X86] Copy the nofpexcept flag when folding a load into an instruction using the load folding tables./

4 years ago[X86] Add test to show that nofpexcept flag is not preserved by stack reload folding.
Craig Topper [Tue, 14 Jan 2020 05:39:12 +0000 (21:39 -0800)]
[X86] Add test to show that nofpexcept flag is not preserved by stack reload folding.

4 years ago[clang] [test] Fix riscv-toolchain-extra to be less picky about paths
Michał Górny [Mon, 13 Jan 2020 09:13:44 +0000 (10:13 +0100)]
[clang] [test] Fix riscv-toolchain-extra to be less picky about paths

Fix riscv-toolchain-extra tests to pass when CLANG_RESOURCE_DIR is set
to another value than the default.

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

4 years ago[mlir] [VectorOps] fixed typo in verifier of slice op
Aart Bik [Mon, 13 Jan 2020 23:58:49 +0000 (15:58 -0800)]
[mlir] [VectorOps] fixed typo in verifier of slice op

Reviewers: nicolasvasilache, andydavis1, rriddle

Reviewed By: nicolasvasilache, rriddle

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

Tags: #llvm

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

4 years ago[lldb/Utility] Add std::move to make placate clang 3.8
Jonas Devlieghere [Tue, 14 Jan 2020 02:23:39 +0000 (18:23 -0800)]
[lldb/Utility] Add std::move to make placate clang 3.8

This fixes an error thrown by clang 3.8 that no viable conversion from
returned value to the function return type.

4 years agotry to fix InterfaceStubs/lambda.cpp on Windows after bd8c8827d96f0
Nico Weber [Tue, 14 Jan 2020 02:22:46 +0000 (21:22 -0500)]
try to fix InterfaceStubs/lambda.cpp on Windows after bd8c8827d96f0

4 years ago[LanguageRuntime] Retire an unused member function. NFCI.
Davide Italiano [Tue, 14 Jan 2020 01:37:39 +0000 (17:37 -0800)]
[LanguageRuntime] Retire an unused member function. NFCI.

4 years ago[llvm-exegesis] Initialize const bitvector member
Jonas Devlieghere [Tue, 14 Jan 2020 01:31:07 +0000 (17:31 -0800)]
[llvm-exegesis] Initialize const bitvector member

This causes an error with older versions of clang: constructor for
'llvm::exegesis::InstructionsCache' must explicitly initialize the const
member 'BVC'

4 years ago[GlobalISel] Change representation of shuffle masks in MachineOperand.
Eli Friedman [Mon, 13 Jan 2020 23:32:45 +0000 (15:32 -0800)]
[GlobalISel] Change representation of shuffle masks in MachineOperand.

We're planning to remove the shufflemask operand from ShuffleVectorInst
(D72467); fix GlobalISel so it doesn't depend on that Constant.

The change to prelegalizercombiner-shuffle-vector.mir happens because
the input contains a literal "-1" in the mask (so the parser/verifier
weren't really handling it properly). We now treat it as equivalent to
"undef" in all contexts.

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

4 years agoRe-enable testing of .s tests under test/CodeGen/X86.
Richard Smith [Tue, 14 Jan 2020 00:12:50 +0000 (16:12 -0800)]
Re-enable testing of .s tests under test/CodeGen/X86.

These were temporarily disabled in 2013 and we apparently forgot to
ever turn them back on again.

Fix spelling of flag to llvm-mc in recently-added test that wasn't
actually being run due to this.

4 years ago[mlir] NFC: Remove unused variable.
River Riddle [Tue, 14 Jan 2020 00:15:06 +0000 (16:15 -0800)]
[mlir] NFC: Remove unused variable.

4 years ago[mlir] Add support for attaching a visibility to symbols.
River Riddle [Mon, 13 Jan 2020 23:54:08 +0000 (15:54 -0800)]
[mlir] Add support for attaching a visibility to symbols.

Summary:
The visibility defines the structural reachability of the symbol within the IR. Symbols can define one of three visibilities:

* Public
The symbol \may be accessed from outside of the visible IR. We cannot assume that we can observe all of the uses of this symbol.

* Private
The symbol may only be referenced from within the operations in the current symbol table, via SymbolRefAttr.

* Nested
The symbol may be referenced by operations in symbol tables above the current symbol table, as long as each symbol table parent also defines a non-private symbol. This allows or referencing the symbol from outside of the defining symbol table, while retaining the ability for the compiler to see all uses.

These properties help to reason about the properties of a symbol, and will be used in a follow up to implement a dce pass on dead symbols.

A few examples of what this would look like in the IR are shown below:

  module @public_module {
    // This function can be accessed by 'live.user'
    func @nested_function() attributes { sym_visibility = "nested" }

    // This function cannot be accessed outside of 'public_module'
   func @private_function() attributes { sym_visibility = "private" }
  }

  // This function can only be accessed from within this module.
  func @private_function() attributes { sym_visibility = "private" }

  // This function may be referenced externally.
  func @public_function()

  "live.user"() {uses = [@public_module::@nested_function,
                                      @private_function,
                                      @public_function]} : () -> ()

Depends On D72043

Reviewed By: mehdi_amini

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

4 years ago[DebugInfo] Add another level to DebugInfoKind called Constructor
Amy Huang [Mon, 13 Jan 2020 23:54:54 +0000 (15:54 -0800)]
[DebugInfo] Add another level to DebugInfoKind called Constructor

The option will limit debug info by only emitting complete class
type information when its constructor is emitted.
This patch changes comparisons with LimitedDebugInfo to use the new
level instead.

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

4 years ago[mlir] Update the CallGraph for nested symbol references, and simplify CallableOpInte...
River Riddle [Mon, 13 Jan 2020 23:46:40 +0000 (15:46 -0800)]
[mlir] Update the CallGraph for nested symbol references, and simplify CallableOpInterface

Summary:
This enables tracking calls that cross symbol table boundaries. It also simplifies some of the implementation details of CallableOpInterface, i.e. there can only be one region within the callable operation.

Depends On D72042

Reviewed By: jpienaar

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

4 years ago[mlir] Update the use-list algorithms in SymbolTable to support nested references.
River Riddle [Mon, 13 Jan 2020 23:23:01 +0000 (15:23 -0800)]
[mlir] Update the use-list algorithms in SymbolTable to support nested references.

Summary: This updates the use list algorithms to support querying from a specific symbol, allowing for the collection and detection of nested references. This works by walking the parent "symbol scopes" and applying the existing algorithm at each level.

Reviewed By: jpienaar

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

4 years ago[lldb-server] Prefer target_include_directories
Alex Langford [Mon, 13 Jan 2020 22:53:05 +0000 (14:53 -0800)]
[lldb-server] Prefer target_include_directories

In the documentation of `include_directories`, it notes that
`target_include_directories` is preferred because it affects
specific targets intead of propagating include search paths
to the entire project.

4 years ago[PGO][CHR] Guard against 0-to-0 branch weight and avoid division by zero crash.
Hiroshi Yamauchi [Mon, 13 Jan 2020 22:19:45 +0000 (14:19 -0800)]
[PGO][CHR] Guard against 0-to-0 branch weight and avoid division by zero crash.

Summary: This fixes a crash in internal builds under SamplePGO.

Reviewers: davidxl

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[clang][IFS][test] Fixing mangled name of a test for Darwin.
Puyan Lotfi [Mon, 13 Jan 2020 21:48:59 +0000 (16:48 -0500)]
[clang][IFS][test] Fixing mangled name of a test for Darwin.

Darwin adds an extra '_' before every C/global function mangled name and
because of this, this test was breaking on Darwin.

This is a fix for commit: https://reviews.llvm.org/D71301

4 years agoRevert "[DWARF5][DebugInfo]: Added support for DebugInfo generation for auto return...
Amy Huang [Mon, 13 Jan 2020 21:55:51 +0000 (13:55 -0800)]
Revert "[DWARF5][DebugInfo]: Added support for DebugInfo generation for auto return type for C++ member functions."

This reverts commit c958639098a8702b831952b1a1a677ae19190a55, which
causes a crash. See https://reviews.llvm.org/D70524 for details.

4 years ago[mlir] Remove unnecessary assert for single region.
River Riddle [Mon, 13 Jan 2020 21:44:30 +0000 (13:44 -0800)]
[mlir] Remove unnecessary assert for single region.

This was left over debugging.

4 years agoPR44514: Fix recovery from noexcept with non-convertible expressions
Erich Keane [Mon, 13 Jan 2020 15:45:17 +0000 (07:45 -0800)]
PR44514: Fix recovery from noexcept with non-convertible expressions

We currently treat noexcept(not-convertible-to-bool) as 'none', which
results in the typeloc info being a different size, and causing an
assert later on in the process.  In order to make recovery less
destructive, replace this with noexcept(false) and a constructed 'false'
expression.

Bug Report: https://bugs.llvm.org/show_bug.cgi?id=44514

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

4 years ago[ThinLTO/WPD] Fix index-based WPD for alias vtables
Teresa Johnson [Thu, 5 Dec 2019 01:15:10 +0000 (17:15 -0800)]
[ThinLTO/WPD] Fix index-based WPD for alias vtables

Summary:
A recent fix in D69452 fixed index based WPD in the presence of
available_externally vtables. It added a cast of the vtable def
summary to a GlobalVarSummary. However, in some cases one def may be an
alias, in which case we need to get the base object before casting,
otherwise we will crash.

Reviewers: evgeny777, steven_wu, aganea

Subscribers: mehdi_amini, inglorion, hiraditya, dexonsmith, arphaman, llvm-commits

Tags: #llvm

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

4 years ago[ItaniumCXXABI] Make tls wrappers properly comdat
Martin Storsjö [Mon, 16 Dec 2019 22:20:32 +0000 (00:20 +0200)]
[ItaniumCXXABI] Make tls wrappers properly comdat

Just marking a symbol as weak_odr/linkonce_odr isn't enough for
actually tolerating multiple copies of it at linking on windows,
it has to be made a proper comdat; make it comdat for all platforms
for consistency.

This should hopefully fix
https://bugzilla.mozilla.org/show_bug.cgi?id=1566288.

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

4 years ago[InstCombine] add FMF to tests for more coverage; NFC
Sanjay Patel [Mon, 13 Jan 2020 21:28:28 +0000 (16:28 -0500)]
[InstCombine] add FMF to tests for more coverage; NFC

4 years agoImplement VectorType conditional operator GNU extension.
Erich Keane [Thu, 5 Dec 2019 14:17:39 +0000 (06:17 -0800)]
Implement VectorType conditional operator GNU extension.

GCC supports the conditional operator on VectorTypes that acts as a
'select' in C++ mode. This patch implements the support. Types are
converted as closely to GCC's behavior as possible, though in a few
places consistency with our existing vector type support was preferred.

Note that this implementation is different from the OpenCL version in a
number of ways, so it unfortunately required a different implementation.

First, the SEMA rules and promotion rules are significantly different.

Secondly, GCC implements COND[i] != 0 ? LHS[i] : RHS[i] (where i is in
the range 0- VectorSize, for each element).  In OpenCL, the condition is
COND[i] < 0 ? LHS[i]: RHS[i].

In the process of implementing this, it was also required to make the
expression COND ? LHS : RHS type dependent if COND is type dependent,
since the type is now dependent on the condition.  For example:

    T ? 1 : 2;

Is not typically type dependent, since the result can be deduced from
the operands.  HOWEVER, if T is a VectorType now, it could change this
to a 'select' (basically a swizzle with a non-constant mask) with the 1
and 2 being promoted to vectors themselves.

While this is a change, it is NOT a standards incompatible change. Based
on my (and D. Gregor's, at the time of writing the code) reading of the
standard, the expression is supposed to be type dependent if ANY
sub-expression is type dependent.

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

4 years ago[mlir] Change the syntax of AffineMapAttr and IntegerSetAttr to avoid conflicts with...
River Riddle [Mon, 13 Jan 2020 21:12:37 +0000 (13:12 -0800)]
[mlir] Change the syntax of AffineMapAttr and IntegerSetAttr to avoid conflicts with function types.

Summary: The current syntax for AffineMapAttr and IntegerSetAttr conflict with function types, making it currently impossible to round-trip function types(and e.g. FuncOp) in the IR. This revision changes the syntax for the attributes by wrapping them in a keyword. AffineMapAttr is wrapped with `affine_map<>` and IntegerSetAttr is wrapped with `affine_set<>`.

Reviewed By: nicolasvasilache, ftynse

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

4 years ago[LegalizeIntegerTypes][X86] Add support for expanding input of STRICT_SINT_TO_FP...
Craig Topper [Mon, 13 Jan 2020 20:40:15 +0000 (12:40 -0800)]
[LegalizeIntegerTypes][X86] Add support for expanding input of STRICT_SINT_TO_FP/STRICT_UINT_TO_FP into a libcall.

Needed to support i128->fp128 on 32-bit X86.

Add full set of strict sint_to_fp/uint_to_fp conversion tests for fp128.

4 years ago[lldb] Revert ddf044290ede for TestProcessAPI.py
Raphael Isemann [Mon, 13 Jan 2020 21:09:18 +0000 (22:09 +0100)]
[lldb] Revert ddf044290ede for TestProcessAPI.py

It seems ddf044290ede7d7fd47f4f673e3e628f551a8aac caused the test to
time out on the Windows bot, but it's unclear to me why.

4 years ago[clang][IFS] Prevent Clang-IFS from Leaking symbols from inside a block.
Puyan Lotfi [Mon, 13 Jan 2020 20:22:08 +0000 (15:22 -0500)]
[clang][IFS] Prevent Clang-IFS from Leaking symbols from inside a block.

Built libdispatch with clang interface stubs. Ran into some block
related issues. Basically VarDecl symbols can leak out because I wasn't
checking the case where a VarDecl is contained inside a BlockDecl
(versus a method or function).

This patch checks that a VarDecl is not a child decl of a BlockDecl.
This patch also does something very similar for c++ lambdas as well.

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

4 years ago[NFC][clang][IFS] Adding braces to if-statement as prep for D71301.
Puyan Lotfi [Mon, 13 Jan 2020 20:19:56 +0000 (15:19 -0500)]
[NFC][clang][IFS] Adding braces to if-statement as prep for D71301.

Just trying to make https://reviews.llvm.org/D71301 look cleaner.

4 years agoFix a test case by adding -fno-delayed-template-parsing.
Aaron Ballman [Mon, 13 Jan 2020 21:01:50 +0000 (16:01 -0500)]
Fix a test case by adding -fno-delayed-template-parsing.

4 years ago[InstCombine] add tests for select --> copysign; NFC
Sanjay Patel [Mon, 13 Jan 2020 20:24:18 +0000 (15:24 -0500)]
[InstCombine] add tests for select --> copysign; NFC

This is testing for another (possibly final) transform suggested in:
https://bugs.llvm.org/show_bug.cgi?id=44153

4 years ago[Dsymutil][Debuginfo][NFC] #3 Refactor dsymutil to separate DWARF optimizing part.
Alexey Lapshin [Thu, 9 Jan 2020 13:02:50 +0000 (16:02 +0300)]
[Dsymutil][Debuginfo][NFC] #3 Refactor dsymutil to separate DWARF optimizing part.

Summary:
This is the next portion of patches for dsymutil.

Create DwarfEmitter interface to generate all debug info tables.
Put DwarfEmitter into DwarfLinker library and make tools/dsymutil/DwarfStreamer
to be child of DwarfEmitter.

It passes check-all testing. MD5 checksum for clang .dSYM bundle matches
for the dsymutil with/without that patch.

Reviewers: JDevlieghere, friss, dblaikie, aprantl

Reviewed By: JDevlieghere

Subscribers: merge_guards_bot, hiraditya, thegameg, probinson, llvm-commits

Tags: #llvm, #debug-info

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

4 years ago[LTO] Constify lto::Config reference passed to backends (NFC)
Teresa Johnson [Mon, 13 Jan 2020 20:23:34 +0000 (12:23 -0800)]
[LTO] Constify lto::Config reference passed to backends (NFC)

The lto::Config object saved on the global LTO object should not be
updated by any of the LTO backends. Otherwise we could run into
interference between threads utilizing it. Motivated by some proposed
changes that would have caused it to get modified in the ThinLTO
backends.

4 years agoRework be15dfa88fb1 such that it works with GlobalISel which doesn't use EVT
Daniel Sanders [Mon, 13 Jan 2020 19:58:05 +0000 (11:58 -0800)]
Rework be15dfa88fb1 such that it works with GlobalISel which doesn't use EVT

Summary:
be15dfa88fb1 broke GlobalISel's usage of getSetCCInverse() which currently
appears to be limited to our out-of-tree backend. GlobalISel doesn't use
EVT's and isn't able to derive them from the information it has as it
doesn't distinguish between integer and floating point types (that
distinction is made by operations rather than values). Bring back the
bool version of getSetCCInverse() in a way that doesn't break the intent
of be15dfa88fb1 but also allows GlobalISel to continue using it.

Reviewers: spatel, bogner, arichardson

Reviewed By: arichardson

Subscribers: rovka, hiraditya, Petar.Avramovic, llvm-commits

Tags: #llvm

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

4 years ago[Clang] Always set -z now linker option on Fuchsia
Petr Hosek [Fri, 22 Nov 2019 00:25:14 +0000 (16:25 -0800)]
[Clang] Always set -z now linker option on Fuchsia

This should be the default on Fuchsia.

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

4 years ago[lldb-server] Remove dead CMake code
Alex Langford [Sat, 11 Jan 2020 00:10:06 +0000 (16:10 -0800)]
[lldb-server] Remove dead CMake code

No files in lldb-server are including a header from a plugin without the
whole path to the header relative to the lldb source directory. There is
no need to include the specific directories as a result.

4 years ago[clangd] Include expression in DecltypeTypeLoc sourcerange while building SelectionTree
Kadir Cetinkaya [Mon, 13 Jan 2020 11:09:30 +0000 (12:09 +0100)]
[clangd] Include expression in DecltypeTypeLoc sourcerange while building SelectionTree

Summary:
Currently AST only contains the location for `decltype` keyword,
therefore we were skipping expressions inside decltype while building selection
tree.

This patch extends source range in such cases to contain the expression as well.
A proper fix would require changes to Sema and DecltypeTypeLoc to contain these
location information.

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

Reviewers: sammccall

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

Tags: #clang

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

4 years ago[clangd] Render header of hover card as a heading
Kadir Cetinkaya [Mon, 13 Jan 2020 16:50:23 +0000 (17:50 +0100)]
[clangd] Render header of hover card as a heading

Reviewers: sammccall

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

Tags: #clang

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

4 years ago[gn build] (manually) port b4a99a061f51
Nico Weber [Mon, 13 Jan 2020 19:13:35 +0000 (14:13 -0500)]
[gn build] (manually) port b4a99a061f51

4 years agoRevert "[ThinLTO] Add additional ThinLTO pipeline testing with new PM"
Teresa Johnson [Mon, 13 Jan 2020 19:01:48 +0000 (11:01 -0800)]
Revert "[ThinLTO] Add additional ThinLTO pipeline testing with new PM"

This reverts commit 2af97be8027a0823b88d4b6a07fc5eedb440bc1f.

After attempting to fix bot failures from matching issues (mostly due to
inconsistent printing of "llvm::" prefixes on objects, and
AnalysisManager objects being printed differntly, I am now seeing some
differences I don't understand (real differences in the passes being
printed). Giving up at this point to allow the bots to recover. Will
revisit later.

4 years agoAdd a couple of missed wildcards in debug-pass-manager output checking
Teresa Johnson [Mon, 13 Jan 2020 18:48:12 +0000 (10:48 -0800)]
Add a couple of missed wildcards in debug-pass-manager output checking

Along with the previous fix for bot failures from
2af97be8027a0823b88d4b6a07fc5eedb440bc1f, need to add a wildcard in a
couple of places where my local output did not print "llvm::" but the
bot is.

4 years ago[X86][Disassembler] Fix a bug when disassembling an empty string
Fangrui Song [Mon, 13 Jan 2020 18:34:10 +0000 (10:34 -0800)]
[X86][Disassembler] Fix a bug when disassembling an empty string

readPrefixes() assumes insn->bytes is non-empty. The code path is not
exercised in llvm-mc because llvm-mc does not feed empty input to
MCDisassembler::getInstruction().

This bug is uncovered by a5994c789a2982a770254ae1607b5b4cb641f73c.
An empty string did not crash before because the deleted regionReader()
allowed UINT64_C(-1) as insn->readerCursor.

  Bytes.size() <= Address -> R->Base
  0 <= UINT64_C(-1) - UINT32_C(-1)

4 years ago[llvm][MIRVRegNamerUtils] Adding hashing on FrameIndex MachineOperands.
Puyan Lotfi [Mon, 13 Jan 2020 18:30:20 +0000 (13:30 -0500)]
[llvm][MIRVRegNamerUtils] Adding hashing on FrameIndex MachineOperands.

This patch makes it so that cases where multiple instructions that differ only
in their FrameIndex MachineOperand values no longer collide. For instance:

%1:_(p0) = G_FRAME_INDEX %stack.0
%2:_(p0) = G_FRAME_INDEX %stack.1

Prior to this patch these instructions would collide together.

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

4 years agoHopefully last fix for bot failures
Teresa Johnson [Mon, 13 Jan 2020 18:33:46 +0000 (10:33 -0800)]
Hopefully last fix for bot failures

Hopefully final bot fix for last few failures from
2af97be8027a0823b88d4b6a07fc5eedb440bc1f.

Looks like sometimes the "llvm::" preceeding objects get printed in the
debug pass manager output and sometimes they don't. Replace with
wildcard matching.

4 years agoFix readability-identifier-naming missing member variables
Nathan James [Mon, 13 Jan 2020 18:26:58 +0000 (13:26 -0500)]
Fix readability-identifier-naming missing member variables

Fixes PR41122 (missing fixes for member variables in a destructor) and
PR29005 (does not rename class members in all locations).

4 years agoUnbreak the mlir build after 202ab273e6eca134b69882f100c666fcd3affbcf
Benjamin Kramer [Mon, 13 Jan 2020 18:18:43 +0000 (19:18 +0100)]
Unbreak the mlir build after 202ab273e6eca134b69882f100c666fcd3affbcf

4 years agoTry number 2 for fixing bot failures
Teresa Johnson [Mon, 13 Jan 2020 18:10:29 +0000 (10:10 -0800)]
Try number 2 for fixing bot failures

Additional fixes for bot failures from 2af97be8027a0823b88d4b6a07fc5eedb440bc1f.
Remove more exact matching on AnalyisManagers, as they can vary.
Also allow different orders between LoopAnalysis and
BranchProbabilityAnalysis as that can vary due to both being accessed in
the parameter list of a call.

4 years agoAMDGPU/GlobalISel: Select llvm.amdgcn.ds.ordered.{add|swap}
Matt Arsenault [Sun, 5 Jan 2020 19:26:53 +0000 (14:26 -0500)]
AMDGPU/GlobalISel: Select llvm.amdgcn.ds.ordered.{add|swap}

4 years ago[SelectionDAG] ComputeNumSignBits add getValidMaximumShiftAmountConstant() for ISD...
Simon Pilgrim [Mon, 13 Jan 2020 17:56:15 +0000 (17:56 +0000)]
[SelectionDAG] ComputeNumSignBits add getValidMaximumShiftAmountConstant() for ISD::SHL support

Allows us to handle non-uniform SHL shifts to determine the minimum number of sign bits remaining (based off the maximum shift amount value)

4 years agoAMDGPU/GlobalISel: Set insert point after waterfall loop
Matt Arsenault [Sat, 4 Jan 2020 16:51:50 +0000 (11:51 -0500)]
AMDGPU/GlobalISel: Set insert point after waterfall loop

The current users of the waterfall loop utility functions do not make
use of the restored original insert point. The insertion is either
done, or they set the insert point somewhere else. A future change
will want to insert instructions after the waterfall loop, but
figuring out the point after the loop is more difficult than ensuring
the insert point is there after the loop.

4 years agoAMDGPU/GlobalISel: Add some baseline tests for vector extract
Matt Arsenault [Fri, 3 Jan 2020 15:07:01 +0000 (10:07 -0500)]
AMDGPU/GlobalISel: Add some baseline tests for vector extract

A future change will try to fold constant offsets into the loop which
these will stress.

4 years agoAMDGPU/GlobalISel: Fix branch targets when emitting SI_IF
Matt Arsenault [Mon, 6 Jan 2020 03:09:24 +0000 (22:09 -0500)]
AMDGPU/GlobalISel: Fix branch targets when emitting SI_IF

The branch target needs to be changed depending on whether there is an
unconditional branch or not.

Loops also need to be similarly fixed, but compiling a simple testcase
end to end requires another set of patches that aren't upstream yet.

4 years agoAMDGPU/GlobalISel: Simplify assert
Matt Arsenault [Mon, 13 Jan 2020 16:02:19 +0000 (11:02 -0500)]
AMDGPU/GlobalISel: Simplify assert

4 years ago[X86][SSE] Add sitofp(shl(sext(x),y)) test case with non-uniform shift value
Simon Pilgrim [Mon, 13 Jan 2020 17:20:36 +0000 (17:20 +0000)]
[X86][SSE] Add sitofp(shl(sext(x),y)) test case with non-uniform shift value

Shows that for non-uniform SHL shifts we fail to determine the minimum number of sign bits remaining (based off the maximum shift amount value)

4 years ago[lldb/Docs] Extend description section of the main page
Jonas Devlieghere [Mon, 13 Jan 2020 17:28:54 +0000 (09:28 -0800)]
[lldb/Docs] Extend description section of the main page

The current description is a bit terse. I've copy/pasted the
introduction form the website.

4 years agoFix tests for builtbot failures
Teresa Johnson [Mon, 13 Jan 2020 17:20:19 +0000 (09:20 -0800)]
Fix tests for builtbot failures

Should fix most of the buildbot failures from
2af97be8027a0823b88d4b6a07fc5eedb440bc1f, by loosening up the matching
on the AnalysisProxy output.

Added in --dump-input=fail on the one test that appears to be something
different, so I can hopefully debug it better.

4 years ago[lldb/Scripts] Remove SWIG bot
Jonas Devlieghere [Mon, 13 Jan 2020 17:23:48 +0000 (09:23 -0800)]
[lldb/Scripts] Remove SWIG bot

This is no longer used or maintained.

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

4 years ago[LegalizeTypes] Add SoftenFloatResult support for STRICT_SINT_TO_FP/STRICT_UINT_TO_FP
Andrew Wei [Mon, 13 Jan 2020 16:16:23 +0000 (00:16 +0800)]
[LegalizeTypes] Add SoftenFloatResult support for STRICT_SINT_TO_FP/STRICT_UINT_TO_FP

Some target like arm/riscv with soft-float will have compiling crash when using -fno-unsafe-math-optimization option.
This patch will add the missing strict FP support to SoftenFloatRes_XINT_TO_FP.

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

4 years ago[SelectionDAG] ComputeNumSignBits add getValidMinimumShiftAmountConstant() ISD::SRA...
Simon Pilgrim [Mon, 13 Jan 2020 16:30:09 +0000 (16:30 +0000)]
[SelectionDAG] ComputeNumSignBits add getValidMinimumShiftAmountConstant() ISD::SRA support

Allows us to handle more non-uniform SRA sign bits cases

4 years ago[X86][SSE] Add sitofp(ashr(x,y)) test case with non-uniform shift value
Simon Pilgrim [Mon, 13 Jan 2020 15:49:13 +0000 (15:49 +0000)]
[X86][SSE] Add sitofp(ashr(x,y)) test case with non-uniform shift value

4 years ago[X86] Add AVX2 known signbits codegen tests
Simon Pilgrim [Mon, 13 Jan 2020 15:46:15 +0000 (15:46 +0000)]
[X86] Add AVX2 known signbits codegen tests

4 years ago[Scheduler] Remove superfluous casts. NFC
David Green [Thu, 9 Jan 2020 13:57:53 +0000 (13:57 +0000)]
[Scheduler] Remove superfluous casts. NFC

4 years ago[AArch64][SVE] Add patterns for some arith SVE instructions.
Danilo Carvalho Grael [Tue, 17 Dec 2019 15:42:52 +0000 (10:42 -0500)]
[AArch64][SVE] Add patterns for some arith SVE instructions.

Summary: Add patterns for the following instructions:
- smax, smin, umax, umin

Reviewers: sdesmalen, huntergr, rengolin, efriedma, c-rhodes, mgudim, kmclaughlin

Subscribers: amehsan

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

4 years ago[ThinLTO] Add additional ThinLTO pipeline testing with new PM
Teresa Johnson [Fri, 10 Jan 2020 21:29:01 +0000 (13:29 -0800)]
[ThinLTO] Add additional ThinLTO pipeline testing with new PM

Summary:
I've added some more extensive ThinLTO pipeline testing with the new PM,
motivated by the bug fixed in D72386.

I beefed up llvm/test/Other/new-pm-pgo.ll a little so that it tests
ThinLTO pre and post link with PGO, similar to the testing for the
default pipelines with PGO.

Added new pre and post link PGO tests for both instrumentation and
sample PGO that exhaustively test the pipelines at different
optimization levels via opt.

Added a clang test to exhaustively test the post link pipeline invoked for
distributed builds. I am currently only testing O2 and O3 since these
are the most important for performance.

It would be nice to add similar exhaustive testing for full LTO, and for
the old PM, but I don't have the bandwidth now and this is a start to
cover some of the situations that are not currently default and were
under tested.

Reviewers: wmi

Subscribers: mehdi_amini, inglorion, hiraditya, steven_wu, dexonsmith, jfb, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years ago[DebugInfo] Make debug line address size mismatch non-fatal to parsing
James Henderson [Mon, 13 Jan 2020 16:27:05 +0000 (16:27 +0000)]
[DebugInfo] Make debug line address size mismatch non-fatal to parsing

Reasonable assumptions can be made when a parsed address length does not
match the expected length, so there's no need for this to be fatal.

Reviewed by: ikudrin

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

4 years ago[mlir] m_Constant()
Lorenzo Chelini [Mon, 13 Jan 2020 16:21:04 +0000 (17:21 +0100)]
[mlir] m_Constant()

Summary: Introduce m_Constant() which allows matching a constant operation without forcing the user also to capture the attribute value.

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

4 years ago[mlir] Added missing GPU lowering ops.
Julian Gross [Thu, 9 Jan 2020 08:52:50 +0000 (09:52 +0100)]
[mlir] Added missing GPU lowering ops.

Summary:
This diff adds missing GPU lowering ops to MLIR.

Reviewers: herhut, pifon2a, ftynse

Tags: #pre-merge_beta_testing, #llvm

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

4 years ago[Inlining] Add PreInlineThreshold for the new pass manager
Kazu Hirata [Mon, 13 Jan 2020 14:34:16 +0000 (06:34 -0800)]
[Inlining] Add PreInlineThreshold for the new pass manager

Summary:
This patch makes it easy to try out different preinlining thresholds
with a command-line switch just like -preinline-threshold for the
legacy pass manager.

Reviewers: davidxl

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[mlir][Linalg] Update ReshapeOp::build to be more idiomatic
Nicolas Vasilache [Mon, 13 Jan 2020 03:38:57 +0000 (22:38 -0500)]
[mlir][Linalg] Update ReshapeOp::build to be more idiomatic

Summary:
This diff makes it easier to create a `linalg.reshape` op
and adds an EDSC builder api test to exercise the new builders.

Reviewers: ftynse, jpienaar

Subscribers: mehdi_amini, rriddle, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, llvm-commits

Tags: #llvm

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

4 years ago[Clang][Driver] Re-use the calling process instead of creating a new process for...
Alexandre Ganea [Mon, 13 Jan 2020 15:40:04 +0000 (10:40 -0500)]
[Clang][Driver] Re-use the calling process instead of creating a new process for the cc1 invocation

With this patch, the clang tool will now call the -cc1 invocation directly inside the same process. Previously, the -cc1 invocation was creating, and waiting for, a new process.
This patch therefore reduces the number of created processes during a build, thus it reduces build times on platforms where process creation can be costly (Windows) and/or impacted by a antivirus.
It also makes debugging a bit easier, as there's no need to attach to the secondary -cc1 process anymore, breakpoints will be hit inside the same process.

Crashes or signaling inside the -cc1 invocation will have the same side-effect as before, and will be reported through the same means.

This behavior can be controlled at compile-time through the CLANG_SPAWN_CC1 cmake flag, which defaults to OFF. Setting it to ON will revert to the previous behavior, where any -cc1 invocation will create/fork a secondary process.
At run-time, it is also possible to tweak the CLANG_SPAWN_CC1 environment variable. Setting it and will override the compile-time setting. A value of 0 calls -cc1 inside the calling process; a value of 1 will create a secondary process, as before.

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

4 years ago[RISCV] Handle globals and block addresses in asm operands
Luís Marques [Mon, 13 Jan 2020 15:33:07 +0000 (15:33 +0000)]
[RISCV] Handle globals and block addresses in asm operands

Summary: These seem to be the machine operand types currently needed by the
RISC-V target.

Reviewers: asb, lenary
Reviewed By: lenary
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D72275

4 years agoFix cppcheck uninitialized variable in DiffTree() constructor warning. NFCI.
Simon Pilgrim [Mon, 13 Jan 2020 14:55:51 +0000 (14:55 +0000)]
Fix cppcheck uninitialized variable in DiffTree() constructor warning. NFCI.

4 years agoMerge isVectorType() and getAs<VectorType> calls to silence clang static analyzer...
Simon Pilgrim [Mon, 13 Jan 2020 14:54:02 +0000 (14:54 +0000)]
Merge isVectorType() and getAs<VectorType> calls to silence clang static analyzer warning. NFCI.

4 years agoFix some cppcheck shadow variable warnings. NFCI.
Simon Pilgrim [Mon, 13 Jan 2020 14:41:16 +0000 (14:41 +0000)]
Fix some cppcheck shadow variable warnings. NFCI.

4 years agoFix "pointer is null" static analyzer warnings. NFCI.
Simon Pilgrim [Mon, 13 Jan 2020 14:31:03 +0000 (14:31 +0000)]
Fix "pointer is null" static analyzer warnings. NFCI.

Use castAs<> instead of getAs<> since the pointers are always dereferenced and castAs will perform the null assertion for us.

4 years agoSema::getOwningModule - take const Decl* type.
Simon Pilgrim [Mon, 13 Jan 2020 14:28:49 +0000 (14:28 +0000)]
Sema::getOwningModule - take const Decl* type.

Fixes static analyzer warning that const_cast was being used despite only const methods being called.

4 years agoAdd missing triples to tests in 0c29d3ff2233696f663ae34a8aeda23c750ac68f so they...
Sam McCall [Mon, 13 Jan 2020 14:58:49 +0000 (15:58 +0100)]
Add missing triples to tests in 0c29d3ff2233696f663ae34a8aeda23c750ac68f so they target the right arch.

4 years ago[AArch64] Emit HINT instead of PAC insns in Armv8.2-A or below
Pablo Barrio [Fri, 10 Jan 2020 17:51:21 +0000 (17:51 +0000)]
[AArch64] Emit HINT instead of PAC insns in Armv8.2-A or below

Summary:
The Pointer Authentication Extension (PAC) was added in Armv8.3-A. Some
instructions are implemented in the HINT space to allow compiling code
common to CPUs regardless of whether they feature PAC or not, and still
benefit from PAC protection in the PAC-enabled CPUs.

The 8.3-specific mnemonics were currently enabled in any architecture, and
LLVM was emitting them in assembly files when PAC code generation was
enabled. This was ok for compilations where both LLVM codegen and the
integrated assembler were used. However, the LLVM codegen was not
compatible with other assemblers (e.g. GAS). Given the fact that the
approach from these assemblers (i.e. to disallow Armv8.3-A mnemonics if
compiling for Armv8.2-A or lower) is entirely reasonable, this patch makes
LLVM to emit HINT when building for Armv8.2-A and below, instead of
PACIASP, AUTIASP and friends. Then, LLVM assembly should be compatible
with other assemblers.

Reviewers: samparker, chill, LukeCheeseman

Subscribers: kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[MIPS] Don't emit R_(MICRO)MIPS_JALR relocations against data symbols
Alex Richardson [Mon, 13 Jan 2020 13:52:48 +0000 (13:52 +0000)]
[MIPS] Don't emit R_(MICRO)MIPS_JALR relocations against data symbols

The R_(MICRO)MIPS_JALR optimization only works when used against functions.
Using the relocation against a data symbol (e.g. function pointer) will
cause some linkers that don't ignore the hint in this case (e.g. LLD prior
to commit 5bab291b7b) to generate a relative branch to the data symbol
which crashes at run time. Before this patch, LLVM was erroneously emitting
these relocations against local-dynamic TLS function pointers and global
function pointers with internal visibility.

Reviewers: atanasyan, jrtc27, vstefanovic
Reviewed By: atanasyan
Differential Revision: https://reviews.llvm.org/D72571

4 years ago[MIPS][ELF] Use PC-relative relocations in .eh_frame when possible
Alex Richardson [Sun, 12 Jan 2020 10:55:15 +0000 (10:55 +0000)]
[MIPS][ELF] Use PC-relative relocations in .eh_frame when possible

When compiling position-independent executables, we now use
DW_EH_PE_pcrel | DW_EH_PE_sdata4. However, the MIPS ABI does not define a
64-bit PC-relative ELF relocation so we cannot use sdata8 for the large
code model case. When using the large code model, we fall back to the
previous behaviour of generating absolute relocations.

With this change clang-generated .o files can be linked by LLD without
having to pass -Wl,-z,notext (which creates text relocations).
This is simpler than the approach used by ld.bfd, which rewrites the
.eh_frame section to convert absolute relocations into relative references.

I saw in D13104 that apparently ld.bfd did not accept pc-relative relocations
for MIPS ouput at some point. However, I also checked that recent ld.bfd
can process the clang-generated .o files so this no longer seems true.

Reviewed By: atanasyan
Differential Revision: https://reviews.llvm.org/D72228

4 years ago[InstSimplify] move tests for select from InstCombine; NFC
Sanjay Patel [Mon, 13 Jan 2020 14:10:02 +0000 (09:10 -0500)]
[InstSimplify] move tests for select from InstCombine; NFC

InstCombine has transforms that would enable these simplifications
in an indirect way, but those transforms are unsafe and likely to
be removed.

4 years ago[SelectionDAG] ComputeNumSignBits - Use getValidShiftAmountConstant for shift opcodes
Simon Pilgrim [Mon, 13 Jan 2020 14:11:57 +0000 (14:11 +0000)]
[SelectionDAG] ComputeNumSignBits - Use getValidShiftAmountConstant for shift opcodes

getValidShiftAmountConstant handles out of bounds shift amounts for us, allowing us to remove the local handling.

4 years ago[SelectionDAG] ComputeKnownBits - Add DemandedElts support to getValidShiftAmountCons...
Simon Pilgrim [Mon, 13 Jan 2020 13:35:12 +0000 (13:35 +0000)]
[SelectionDAG] ComputeKnownBits - Add DemandedElts support to getValidShiftAmountConstant/getValidMinimumShiftAmountConstant()

4 years ago[X86] Add knownbits tests showing missing shift amount demanded elts handling.
Simon Pilgrim [Mon, 13 Jan 2020 13:11:46 +0000 (13:11 +0000)]
[X86] Add knownbits tests showing missing shift amount demanded elts handling.

4 years agoRevert "[libc++] Explicitly enumerate std::string external instantiations."
Oliver Stannard [Mon, 13 Jan 2020 13:54:04 +0000 (13:54 +0000)]
Revert "[libc++] Explicitly enumerate std::string external instantiations."

This is causing failures for multiple buildbots and bootstrap builds,
details at https://reviews.llvm.org/rG61bd1920.

This reverts commit 61bd19206f61ace4b007838a2ff8884a13ec0374.

4 years ago[FPEnv] Fix chain handling for fpexcept.strict nodes
Ulrich Weigand [Mon, 13 Jan 2020 13:37:07 +0000 (14:37 +0100)]
[FPEnv] Fix chain handling for fpexcept.strict nodes

We need to ensure that fpexcept.strict nodes are not optimized away even if
the result is unused. To do that, we need to chain them into the block's
terminator nodes, like already done for PendingExcepts.

This patch adds two new lists of pending chains, PendingConstrainedFP and
PendingConstrainedFPStrict to hold constrained FP intrinsic nodes without
and with fpexcept.strict markers. This allows not only to solve the above
problem, but also to relax chains a bit further by no longer flushing all
FP nodes before a store or other memory access. (They are still flushed
before nodes with other side effects.)

Reviewed By: craig.topper

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

4 years agoGlobalISel: Fix assertion on wide G_ZEXT sources
Matt Arsenault [Fri, 10 Jan 2020 22:50:45 +0000 (17:50 -0500)]
GlobalISel: Fix assertion on wide G_ZEXT sources

It's possible to have a type that needs a mask greater than 64-bits.

4 years ago[llvm-exegesis] Remove unneeded std::move()
Miloš Stojanović [Mon, 13 Jan 2020 13:04:56 +0000 (14:04 +0100)]
[llvm-exegesis] Remove unneeded std::move()

Caught by buildbot breakage:

/home/docker/worker_env/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm/llvm/tools/llvm-exegesis/lib/Mips/Target.cpp:89:12: error: moving a local object in a return statement prevents copy elision [-Werror,-Wpessimizing-move]
    return std::move(Instructions);
           ^
/home/docker/worker_env/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm/llvm/tools/llvm-exegesis/lib/Mips/Target.cpp:89:12: note: remove std::move call here
    return std::move(Instructions);
           ^~~~~~~~~~            ~

4 years ago[lldb][NFC] Remove debug print statement from TestExprDiagnostics.py
Raphael Isemann [Mon, 13 Jan 2020 13:17:55 +0000 (14:17 +0100)]
[lldb][NFC] Remove debug print statement from TestExprDiagnostics.py

4 years ago[clang] Remove raw string literals in macros
Oliver Stannard [Mon, 13 Jan 2020 12:38:39 +0000 (12:38 +0000)]
[clang] Remove raw string literals in macros

Older (but still supported) versions of GCC don't handle C++11 raw
string literals in macro parameters correctly.

4 years ago[SelectionDAG] ComputeKnownBits add getValidMinimumShiftAmountConstant() ISD::SHL...
Simon Pilgrim [Mon, 13 Jan 2020 12:01:56 +0000 (12:01 +0000)]
[SelectionDAG] ComputeKnownBits add getValidMinimumShiftAmountConstant() ISD::SHL support

As mentioned on D72573

4 years ago[X86][SSE] Add knownbits test showing missing getValidMinimumShiftAmountConstant...
Simon Pilgrim [Mon, 13 Jan 2020 11:51:12 +0000 (11:51 +0000)]
[X86][SSE] Add knownbits test showing missing getValidMinimumShiftAmountConstant() ISD::SHL support

As mentioned on D72573