platform/upstream/llvm.git
7 years agoclang-format: Fix bad corner case in formatting of function types.
Daniel Jasper [Mon, 24 Apr 2017 14:28:49 +0000 (14:28 +0000)]
clang-format: Fix bad corner case in formatting of function types.

Before:
  std::function<
      LoooooooooooongTemplatedType<SomeType>*(
          LooooooooooooooooooooongType
              type)>
      function;

After:
  std::function<
      LoooooooooooongTemplatedType<
          SomeType>*(
          LooooooooooooooooongType type)>
      function;

clang-format generally avoids having lines like "SomeType>*(" as they
lead to parameter lists that don't belong together to be aligned. However, in
case it is better than the alternative, which can even be violating the column
limit.

llvm-svn: 301182

7 years ago[X86][AVX] Add scheduling latency/throughput tests for missing AVX1 instructions
Simon Pilgrim [Mon, 24 Apr 2017 14:26:30 +0000 (14:26 +0000)]
[X86][AVX] Add scheduling latency/throughput tests for missing AVX1 instructions

Had to split btver2/znver1 checks as only btver2 suppresses zeroupper

llvm-svn: 301181

7 years ago[index] The relation between the declarations in template specializations
Alex Lorenz [Mon, 24 Apr 2017 14:04:58 +0000 (14:04 +0000)]
[index] The relation between the declarations in template specializations
that 'override' declarations in the base template should be recorded

This can be used for improved "go to definition" feature in Xcode.

rdar://31604739

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

llvm-svn: 301180

7 years agoFix the new SocketAddressTest on Windows
Pavel Labath [Mon, 24 Apr 2017 13:34:35 +0000 (13:34 +0000)]
Fix the new SocketAddressTest on Windows

we need to call WSAStartup before we can use getaddrinfo.

llvm-svn: 301179

7 years ago[Devirtualization] Emit invariant.group loads with empty group md
Piotr Padlewski [Mon, 24 Apr 2017 12:58:43 +0000 (12:58 +0000)]
[Devirtualization] Emit invariant.group loads with empty group md

Summary:
As discussed here
http://lists.llvm.org/pipermail/llvm-dev/2017-January/109332.html
having different groups doesn't solve the problem entirly.

Reviewers: rjmccall, rsmith

Subscribers: amharc, cfe-commits

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

llvm-svn: 301178

7 years ago[SystemZ] Update kill-flag in splitMove().
Jonas Paulsson [Mon, 24 Apr 2017 12:40:28 +0000 (12:40 +0000)]
[SystemZ]  Update kill-flag in splitMove().

EarlierMI needs to clear the kill flag on the first operand in case of a store.

Review: Ulrich Weigand
llvm-svn: 301177

7 years ago[DWARF] Move test to x86 directory
Renato Golin [Mon, 24 Apr 2017 12:37:11 +0000 (12:37 +0000)]
[DWARF] Move test to x86 directory

llvm-svn: 301176

7 years ago[RegionInfo] Fix dangling references created by moving RegionInfo objects
Philip Pfaffe [Mon, 24 Apr 2017 11:54:37 +0000 (11:54 +0000)]
[RegionInfo] Fix dangling references created by moving RegionInfo objects

Summary: Region objects capture the address of the creating RegionInfo instance. Because the RegionInfo class is movable, moving a RegionInfo object creates dangling references. This patch fixes these references by walking the Regions post-move, and updating references to the new parent.

Reviewers: Meinersbur, grosser

Reviewed By: Meinersbur, grosser

Subscribers: llvm-commits

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

llvm-svn: 301175

7 years agoAdd SUSE vendor
Ismail Donmez [Mon, 24 Apr 2017 11:18:29 +0000 (11:18 +0000)]
Add SUSE vendor

Summary: SUSE's ARM triples end with -gnueabi even though they are hard-float. This requires special handling of SUSE ARM triples. Hence we need a way to differentiate the SUSE as vendor. This CL adds that.

Reviewers: chandlerc, compnerd, echristo, rengolin

Reviewed By: rengolin

Subscribers: aemerson, rengolin, llvm-commits

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

llvm-svn: 301174

7 years agoRevert [scudo] Enabling MIPS support for Scudo
Sagar Thakur [Mon, 24 Apr 2017 11:02:36 +0000 (11:02 +0000)]
Revert [scudo] Enabling MIPS support for Scudo

This patch broke the buildbot clang-cmake-mips. Investigating the issue.

llvm-svn: 301173

7 years ago[LLDB][MIPS] Move it into HandleLLVMOptions.cmake.
Nitesh Jain [Mon, 24 Apr 2017 10:56:01 +0000 (10:56 +0000)]
[LLDB][MIPS] Move it into HandleLLVMOptions.cmake.

The revison https://reviews.llvm.org/D32125 will fixed the off_t for GNU specific 32 bit platform. This fixed the difference in definition of off_t in LLDB and LLVM

Subscribers: jaydeep, bhushan, lldb-commits, slthakur, llvm-commits, krytarowski, emaste, zturner
llvm-svn: 301172

7 years ago[LLVM][MIPS] Fix different definition of off_t in LLDB and LLVM.
Nitesh Jain [Mon, 24 Apr 2017 10:36:46 +0000 (10:36 +0000)]
[LLVM][MIPS] Fix different definition of off_t in LLDB and LLVM.

Reviewers: beanz

Subscribers: jaydeep, bhushan, lldb-commits, slthakur, llvm-commits, krytarowski, emaste

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

llvm-svn: 301171

7 years ago[DWARF] - Take relocations in account when extracting ranges from .debug_ranges
George Rimar [Mon, 24 Apr 2017 10:19:45 +0000 (10:19 +0000)]
[DWARF] - Take relocations in account when extracting ranges from .debug_ranges

I found this when investigated "Bug 32319 - .gdb_index is broken/incomplete" for LLD.

When we have object file with .debug_ranges section it may be filled with zeroes.
Relocations are exist in file to relocate this zeroes into real values later, but until that
a pair of zeroes is treated as terminator. And DWARF parser thinks there is no ranges at all
when I am trying to collect address ranges for building .gdb_index.

Solution implemented in this patch is to take relocations in account when parsing ranges.

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

llvm-svn: 301170

7 years agoAdd more arguments to SocketAddress::GetAddressInfo
Pavel Labath [Mon, 24 Apr 2017 09:39:56 +0000 (09:39 +0000)]
Add more arguments to SocketAddress::GetAddressInfo

Summary:
the reason for this is two-fold:
- getaddrinfo without the extra arguments will return the same
(network-level) address multiple times, once for each supported
transport protocol, which is not what is usually intended (it certainly
wasn't in D31823)
- it enables us to rewrite the getaddrinfo member function in terms of
the static GetAddressInfo function.

Reviewers: beanz, tberghammer

Subscribers: lldb-commits

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

llvm-svn: 301168

7 years ago[clang-tidy] New check: modernize-replace-random-shuffle.
Mads Ravn [Mon, 24 Apr 2017 09:27:20 +0000 (09:27 +0000)]
[clang-tidy] New check: modernize-replace-random-shuffle.

This check will find occurrences of ``std::random_shuffle`` and replace it with ``std::shuffle``. In C++17 ``std::random_shuffle`` will no longer be available and thus we need to replace it.

Example of case that it fixes

```
  std::vector<int> v;

  // First example
  std::random_shuffle(vec.begin(), vec.end());

```

Reviewers: hokein, aaron.ballman, alexfh, malcolm.parsons, mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 301167

7 years ago[ARM] GlobalISel: Legalize s8 and s16 G_(S|U)DIV
Diana Picus [Mon, 24 Apr 2017 09:12:19 +0000 (09:12 +0000)]
[ARM] GlobalISel: Legalize s8 and s16 G_(S|U)DIV

We have to widen the operands to 32 bits and then we can either use
hardware division if it is available or lower to a libcall otherwise.

At the moment it is not enough to set the Legalizer action to
WidenScalar, since for libcalls it won't know what to do (it won't be
able to find what size to widen to, because it will find Libcall and not
Legal for 32 bits). To hack around this limitation, we request Custom
lowering, and as part of that we widen first and then we run another
legalizeInstrStep on the widened DIV.

llvm-svn: 301166

7 years ago[Arch64AsmParser] better diagnostic for isb
Sjoerd Meijer [Mon, 24 Apr 2017 08:22:20 +0000 (08:22 +0000)]
[Arch64AsmParser] better diagnostic for isb

Instruction isb takes as an operand either 'sy' or an immediate value. This
improves the diagnostic when the string is not 'sy' and adds a test case for
this which was missing. This also adds tests to check invalid inputs for dsb
and dmb.

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

llvm-svn: 301165

7 years ago[ARM] GlobalISel: Support G_(S|U)DIV for s32
Diana Picus [Mon, 24 Apr 2017 08:20:05 +0000 (08:20 +0000)]
[ARM] GlobalISel: Support G_(S|U)DIV for s32

Add support for both targets with hardware division and without. For
hardware division we have to add support throughout the pipeline
(legalizer, reg bank select, instruction select). For targets without
hardware division, we only need to mark it as a libcall.

llvm-svn: 301164

7 years ago[GlobalISel] Legalize G_(S|U)DIV libcalls
Diana Picus [Mon, 24 Apr 2017 07:22:31 +0000 (07:22 +0000)]
[GlobalISel] Legalize G_(S|U)DIV libcalls

Treat them the same as the other binary operations that we have so far,
but on integers rather than floating point types. Extract the common
code into a helper.

This will be used in the ARM backend.

llvm-svn: 301163

7 years ago[ARM] GlobalISel: Select G_CONSTANT with CImm operands
Diana Picus [Mon, 24 Apr 2017 06:30:56 +0000 (06:30 +0000)]
[ARM] GlobalISel: Select G_CONSTANT with CImm operands

When selecting a G_CONSTANT to a MOVi, we need the value to be an Imm
operand. We used to just leave the G_CONSTANT operand unchanged, which
works in some cases (such as the GEP offsets that we create when
referring to stack slots). However, in many other places the G_CONSTANTs
are created with CImm operands. This patch makes sure to handle those as
well, and to error out gracefully if in the end we don't end up with an
Imm operand.

Thanks to Oliver Stannard for reporting this issue.

llvm-svn: 301162

7 years ago[XRay][tools] Fixup for pedantic and permissive errors/warnings
Dean Michael Berris [Mon, 24 Apr 2017 06:15:53 +0000 (06:15 +0000)]
[XRay][tools] Fixup for pedantic and permissive errors/warnings

Remove extraneous semicolons and fully qualify the Trace type.

Follow-up to D29320.

llvm-svn: 301161

7 years ago[XRay] A tool for Comparing xray function call graphs
Dean Michael Berris [Mon, 24 Apr 2017 05:54:33 +0000 (05:54 +0000)]
[XRay] A tool for Comparing xray function call graphs

Summary:
This is a tool for comparing the function graphs produced by the
llvm-xray graph too. It takes the form of a new subcommand of the
llvm-xray tool 'graph-diff'.

This initial version of the patch is very rough, but it is close to
feature complete.

Depends on D29363

Reviewers: dblaikie, dberris

Reviewed By: dberris

Subscribers: mgorny, llvm-commits

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

llvm-svn: 301160

7 years ago[APInt] Make behavior of ashr by BitWidth consistent between single and multi word.
Craig Topper [Mon, 24 Apr 2017 05:38:26 +0000 (05:38 +0000)]
[APInt] Make behavior of ashr by BitWidth consistent between single and multi word.

Previously single word would always return 0 regardless of the original sign. Multi word would return all 0s or all 1s based on the original sign. Now single word takes into account the sign as well.

llvm-svn: 301159

7 years ago[scudo] Enabling MIPS support for Scudo
Sagar Thakur [Mon, 24 Apr 2017 04:29:44 +0000 (04:29 +0000)]
[scudo] Enabling MIPS support for Scudo

Adding MIPS 32-bit and 64-bit support for Scudo.

Reviewed by cryptoad
Differential: D31803

llvm-svn: 301158

7 years agoRevert "Refactor DynamicLibrary so searching for a symbol will have a defined order.”
Frederich Munch [Mon, 24 Apr 2017 03:33:30 +0000 (03:33 +0000)]
Revert "Refactor DynamicLibrary so searching for a symbol will have a defined order.”
The changes are causing the i686-mingw32 build to fail.

This reverts commit r301153, and the changes for a separate warning on i686-mingw32 in r301155  and r301156.

llvm-svn: 301157

7 years agoFix warning converting from boolean to pointer introduced in r301153.
Frederich Munch [Mon, 24 Apr 2017 03:12:16 +0000 (03:12 +0000)]
Fix warning converting from boolean to pointer introduced in r301153.

This reverts commit r301155, which was incorrect.

llvm-svn: 301156

7 years agoFix warning converting from void* to boolean introduced in r301153.
Frederich Munch [Mon, 24 Apr 2017 02:51:40 +0000 (02:51 +0000)]
Fix warning converting from void* to boolean introduced in r301153.

llvm-svn: 301155

7 years agoRevert "[SCEV] Enable SCEV verification by default in EXPENSIVE_CHECKS builds"
Sanjoy Das [Mon, 24 Apr 2017 02:35:19 +0000 (02:35 +0000)]
Revert "[SCEV] Enable SCEV verification by default in EXPENSIVE_CHECKS builds"

This reverts commit r301150.  It breaks CodeGen/Hexagon/hwloop-wrap2.ll, reverting
while I investigate.

llvm-svn: 301154

7 years agoRefactor DynamicLibrary so searching for a symbol will have a defined order and
Frederich Munch [Mon, 24 Apr 2017 02:30:12 +0000 (02:30 +0000)]
Refactor DynamicLibrary so searching for a symbol will have a defined order and
libraries are properly unloaded when llvm_shutdown is called.

Summary:
This was mostly affecting usage of the JIT, where storing the library handles in
a set made iteration unordered/undefined. This lead to disagreement between the
JIT and native code as to what the address and implementation of particularly on
Windows with stdlib functions:

JIT: putenv_s("TEST", "VALUE") // called msvcrt.dll, putenv_s
JIT: getenv("TEST") -> "VALUE" // called msvcrt.dll, getenv
Native: getenv("TEST") -> NULL // called ucrt.dll, getenv

Also fixed is the issue of DynamicLibrary::getPermanentLibrary(0,0) on Windows
not giving priority to the process' symbols as it did on Unix.

Reviewers: chapuni, v.g.vassilev, lhames

Reviewed By: lhames

Subscribers: danalbert, srhines, mgorny, vsk, llvm-commits

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

llvm-svn: 301153

7 years ago[Orc] Fix a warning by removing an unused lambda capture.
Lang Hames [Mon, 24 Apr 2017 01:21:23 +0000 (01:21 +0000)]
[Orc] Fix a warning by removing an unused lambda capture.

llvm-svn: 301152

7 years agoFix unused variables / fields warnings in release builds
Sanjoy Das [Mon, 24 Apr 2017 00:46:40 +0000 (00:46 +0000)]
Fix unused variables / fields warnings in release builds

llvm-svn: 301151

7 years ago[SCEV] Enable SCEV verification by default in EXPENSIVE_CHECKS builds
Sanjoy Das [Mon, 24 Apr 2017 00:41:58 +0000 (00:41 +0000)]
[SCEV] Enable SCEV verification by default in EXPENSIVE_CHECKS builds

llvm-svn: 301150

7 years ago[SCEV] Fix exponential time complexity by caching
Sanjoy Das [Mon, 24 Apr 2017 00:09:46 +0000 (00:09 +0000)]
[SCEV] Fix exponential time complexity by caching

llvm-svn: 301149

7 years ago[PartialInine]: add triaging options
Xinliang David Li [Sun, 23 Apr 2017 23:39:04 +0000 (23:39 +0000)]
[PartialInine]: add triaging options

There are more bugs (runtime failures) triggered when partial
inlining is turned on. Add options to help triaging problems.

llvm-svn: 301148

7 years ago[Orc] Use recursive mutexes for Error serialization.
Lang Hames [Sun, 23 Apr 2017 23:36:13 +0000 (23:36 +0000)]
[Orc] Use recursive mutexes for Error serialization.

Errors can be nested, so we need recursive locking for serialization /
deserialization.

llvm-svn: 301147

7 years ago[SCEV] Move towards a verifier without false positives
Sanjoy Das [Sun, 23 Apr 2017 23:04:45 +0000 (23:04 +0000)]
[SCEV] Move towards a verifier without false positives

This change reboots SCEV's current (off by default) verification logic
to avoid false failures.  Instead of stringifying trip counts, it maps
old and new trip counts to the same ScalarEvolution "universe" and
asks ScalarEvolution to compute the difference between them.  If the
difference comes out to be a non-zero constant, then (barring some
corner cases) we *know* we messed up.

I've not yet enabled this by default since it hits an exponential time
issue in SCEV, but once I fix that, I'll flip it on by default in
EXPENSIVE_CHECKS builds.

llvm-svn: 301146

7 years ago[X86][AVX] Add scheduling latency/throughput tests for some AVX1 instructions
Simon Pilgrim [Sun, 23 Apr 2017 22:08:17 +0000 (22:08 +0000)]
[X86][AVX] Add scheduling latency/throughput tests for some AVX1 instructions

More instructions will be added in future commits

llvm-svn: 301145

7 years ago[InstCombine] add/move folds for [not]-xor
Sanjay Patel [Sun, 23 Apr 2017 22:00:02 +0000 (22:00 +0000)]
[InstCombine] add/move folds for [not]-xor

We handled all of the commuted variants for plain xor already,
although they were scattered around and sometimes folded less
efficiently using distributive laws. We had no folds for not-xor.

Handling all of these patterns consistently is part of trying to
reinstate:
https://reviews.llvm.org/rL300977

llvm-svn: 301144

7 years ago[PartialInlining] Add optimization remark support
Xinliang David Li [Sun, 23 Apr 2017 21:40:58 +0000 (21:40 +0000)]
[PartialInlining] Add optimization remark support

Differential Revision: http://reviews.llvm.org/D32387

llvm-svn: 301143

7 years ago[X86][SSE] Add scheduler class support for SSE42 (PCMPGT) instructions
Simon Pilgrim [Sun, 23 Apr 2017 21:23:27 +0000 (21:23 +0000)]
[X86][SSE] Add scheduler class support for SSE42 (PCMPGT) instructions

llvm-svn: 301142

7 years ago[X86][SSE] Add scheduling latency/throughput tests for (most) SSE42 instructions
Simon Pilgrim [Sun, 23 Apr 2017 21:00:25 +0000 (21:00 +0000)]
[X86][SSE] Add scheduling latency/throughput tests for (most) SSE42 instructions

llvm-svn: 301141

7 years ago[InstCombine] add tests for not-xor and remove redundant tests; NFC
Sanjay Patel [Sun, 23 Apr 2017 20:59:00 +0000 (20:59 +0000)]
[InstCombine] add tests for not-xor and remove redundant tests; NFC

llvm-svn: 301140

7 years ago[JumpThread] We want to fold (not thread) when all predecessor go to single BB's...
Xin Tong [Sun, 23 Apr 2017 20:56:29 +0000 (20:56 +0000)]
[JumpThread] We want to fold (not thread) when all predecessor go to single BB's successor.

Summary:
In case all predecessor go to a single successor of current BB. We want to fold (not thread).

I failed to update the phi nodes properly in the last patch https://reviews.llvm.org/rL300657.

Phi nodes values are per predecessor in LLVM.

Reviewers: sanjoy

Reviewed By: sanjoy

Subscribers: llvm-commits

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

llvm-svn: 301139

7 years agoFix typo in comment.
Nick Lewycky [Sun, 23 Apr 2017 20:46:58 +0000 (20:46 +0000)]
Fix typo in comment.

llvm-svn: 301138

7 years ago[X86][SSE] Add scheduling latency/throughput tests for (most) SSE41 instructions
Simon Pilgrim [Sun, 23 Apr 2017 20:05:21 +0000 (20:05 +0000)]
[X86][SSE] Add scheduling latency/throughput tests for (most) SSE41 instructions

llvm-svn: 301137

7 years ago[X86][SSE] Add missing scheduling latency/throughput test for PINSRW
Simon Pilgrim [Sun, 23 Apr 2017 19:56:49 +0000 (19:56 +0000)]
[X86][SSE] Add missing scheduling latency/throughput test for PINSRW

llvm-svn: 301136

7 years agoCorrect grammar. NFC
Xin Tong [Sun, 23 Apr 2017 17:36:25 +0000 (17:36 +0000)]
Correct grammar. NFC

llvm-svn: 301135

7 years ago[APInt] Make clearUnusedBits branch free.
Craig Topper [Sun, 23 Apr 2017 17:16:26 +0000 (17:16 +0000)]
[APInt] Make clearUnusedBits branch free.

This makes the WordBits calculation calculate a value between 1 and 64 for the number of bits in the last word. Previously if the BitWidth was a multiple of 64 bits the WordBits value was 0 and we had to bail out early to avoid an undefined shift. Now with a value of 64 we no longer have an undefined shift issue.

This shows a 15-16k reduction in the size of the opt binary on my local x86-64 build.

llvm-svn: 301134

7 years ago[APInt] In sext single word case, use SignExtend64 and let the APInt constructor...
Craig Topper [Sun, 23 Apr 2017 17:16:24 +0000 (17:16 +0000)]
[APInt] In sext single word case, use SignExtend64 and let the APInt constructor mask off any excess bits.

The current code is trying to be clever with shifts to avoid needing to clear unused bits. But it looks like the compiler is unable to optimize out the unused bit handling in the APInt constructor. Given this its better to just use SignExtend64 and have more readable code.

llvm-svn: 301133

7 years agoAdd missing acquire_load to call_once overload.
Justin Lebar [Sun, 23 Apr 2017 16:58:48 +0000 (16:58 +0000)]
Add missing acquire_load to call_once overload.

Summary: Seemed to have been overlooked in D24028.

This bug was found and brought to my attention by Paul Wankadia.

Reviewers: kubamracek, EricWF, dvyukov

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

llvm-svn: 301132

7 years ago[InstCombine] add tests for or-to-xor; NFC
Sanjay Patel [Sun, 23 Apr 2017 16:37:36 +0000 (16:37 +0000)]
[InstCombine] add tests for or-to-xor; NFC

llvm-svn: 301131

7 years agoclang-rename: fix formatting
Miklos Vajna [Sun, 23 Apr 2017 16:07:06 +0000 (16:07 +0000)]
clang-rename: fix formatting

As detected by clang-format.

llvm-svn: 301130

7 years ago[InstCombine] add pattern matches for commuted variants of xor-to-xor
Sanjay Patel [Sun, 23 Apr 2017 16:03:00 +0000 (16:03 +0000)]
[InstCombine] add pattern matches for commuted variants of xor-to-xor

There's probably some better way to write this that eliminates the
code duplication without hurting readability, but at least this
eliminates the logic holes and is hopefully slightly more efficient
than creating new instructions.

llvm-svn: 301129

7 years ago[InstCombine] add tests for xor-to-xor; NFC
Sanjay Patel [Sun, 23 Apr 2017 14:51:03 +0000 (14:51 +0000)]
[InstCombine] add tests for xor-to-xor; NFC

Besides missing 2 commuted patterns, the way we handle these folds is inefficient.

llvm-svn: 301128

7 years ago[X86][SSE] Add scheduling latency/throughput tests for SSSE3 instructions
Simon Pilgrim [Sun, 23 Apr 2017 14:01:55 +0000 (14:01 +0000)]
[X86][SSE] Add scheduling latency/throughput tests for SSSE3 instructions

llvm-svn: 301127

7 years ago[X86][SSE] Add scheduling latency/throughput tests for SSE3 instructions
Simon Pilgrim [Sun, 23 Apr 2017 13:59:29 +0000 (13:59 +0000)]
[X86][SSE] Add scheduling latency/throughput tests for SSE3 instructions

llvm-svn: 301126

7 years ago[InstCombine] add tests for add-to-xor commuted variants; NFC
Sanjay Patel [Sun, 23 Apr 2017 13:37:05 +0000 (13:37 +0000)]
[InstCombine] add tests for add-to-xor commuted variants; NFC

1 out of the 4 tests commuted the operands, so there's an asymmetry
somewhere under this in how we handle these transforms.

llvm-svn: 301125

7 years agoRevert "[APInt] Fix a few places that use APInt::getRawData to operate within the...
Renato Golin [Sun, 23 Apr 2017 12:15:30 +0000 (12:15 +0000)]
Revert "[APInt] Fix a few places that use APInt::getRawData to operate within the normal API."

This reverts commit r301105, 4, 3 and 1, as a follow up of the previous
revert, which broke even more bots.

For reference:
Revert "[APInt] Use operator<<= where possible. NFC"
Revert "[APInt] Use operator<<= instead of shl where possible. NFC"
Revert "[APInt] Use ashInPlace where possible."

PR32754.

llvm-svn: 301111

7 years agoRevert "[APInt] Add ashrInPlace method and implement ashr using it. Also fix a bug...
Renato Golin [Sun, 23 Apr 2017 12:02:07 +0000 (12:02 +0000)]
Revert "[APInt] Add ashrInPlace method and implement ashr using it. Also fix a bug in the shift by BitWidth handling."

This reverts commit r301094, as it broke all ARM self-hosting bots.

PR32754.

llvm-svn: 301110

7 years ago[X86][MPX] Add load & store instructions of bnd values to getLoadStoreRegOpcode function.
Ayman Musa [Sun, 23 Apr 2017 08:28:42 +0000 (08:28 +0000)]
[X86][MPX] Add load & store instructions of bnd values to getLoadStoreRegOpcode function.

This is needed for a follow up patch that generates the memory folding tables.

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

llvm-svn: 301109

7 years ago[isl C++ bindings] Add explicit const casts for *foreach* bindings
Tobias Grosser [Sun, 23 Apr 2017 07:54:12 +0000 (07:54 +0000)]
[isl C++ bindings] Add explicit const casts for *foreach* bindings

This avoids a compiler warning about lost 'const' attributes.

Suggested-by: Michael Kruse <llvm@meinersbur.de>
llvm-svn: 301108

7 years ago[X86] Convert test checks to generated checks of update_llc_test_checks.py. NFC
Ayman Musa [Sun, 23 Apr 2017 07:41:40 +0000 (07:41 +0000)]
[X86] Convert test checks to generated checks of update_llc_test_checks.py. NFC

llvm-svn: 301107

7 years ago[ARM] ScheduleDAGRRList::DelayForLiveRegsBottomUp must consider OptionalDefs
Artyom Skrobov [Sun, 23 Apr 2017 06:58:08 +0000 (06:58 +0000)]
[ARM] ScheduleDAGRRList::DelayForLiveRegsBottomUp must consider OptionalDefs

Summary:
D30400 has enabled tADC and tSBC instructions to be unglued, thereby allowing CPSR to remain live between Thumb1 scheduling units.

Most Thumb1 instructions have an OptionalDef for CPSR; but the scheduler ignored the OptionalDefs, and could unwittingly insert a flag-setting instruction in between an ADDS and the corresponding ADC.

Reviewers: javed.absar, atrick, MatzeB, t.p.northover, jmolloy, rengolin

Reviewed By: javed.absar

Subscribers: rogfer01, efriedma, aemerson, rengolin, llvm-commits, MatzeB

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

llvm-svn: 301106

7 years ago[APInt] Fix a few places that use APInt::getRawData to operate within the normal...
Craig Topper [Sun, 23 Apr 2017 06:41:11 +0000 (06:41 +0000)]
[APInt] Fix a few places that use APInt::getRawData to operate within the normal API.

getRawData exposes the internal type of the APInt class directly to its users. Ideally we wouldn't expose such an implementation detail.

This patch fixes a few of the easy cases by using truncate, extract, or a rotate.

llvm-svn: 301105

7 years ago[APInt] Use operator<<= where possible. NFC
Craig Topper [Sun, 23 Apr 2017 05:43:02 +0000 (05:43 +0000)]
[APInt] Use operator<<= where possible. NFC

llvm-svn: 301104

7 years ago[APInt] Use operator<<= instead of shl where possible. NFC
Craig Topper [Sun, 23 Apr 2017 05:18:31 +0000 (05:18 +0000)]
[APInt] Use operator<<= instead of shl where possible. NFC

llvm-svn: 301103

7 years ago[ThinLTO/Summary] Rename anonymous globals as last action ...
Davide Italiano [Sun, 23 Apr 2017 04:49:34 +0000 (04:49 +0000)]
[ThinLTO/Summary] Rename anonymous globals as last action ...

... in the per-TU -O0 pipeline.
The problem is that there could be passes registered using
`addExtensionsToPM()` introducing unnamed globals.
Asan is an example, but there may be others. Building cppcheck
with `-flto=thin` and `-fsanitize=address` triggers an assertion
while we're reading bitcode (in lib/LTO), as the BitcodeReader
assumes there are no unnamed globals (because the namer has run).
Unfortunately I wasn't able to find an easy way to test this.
I added a comment in the hope nobody moves this again.

llvm-svn: 301102

7 years ago[APInt] Use ashInPlace where possible.
Craig Topper [Sun, 23 Apr 2017 03:45:59 +0000 (03:45 +0000)]
[APInt] Use ashInPlace where possible.

llvm-svn: 301101

7 years agoSimplify FreeBSD Host.cpp with early returns
Ed Maste [Sun, 23 Apr 2017 02:28:28 +0000 (02:28 +0000)]
Simplify FreeBSD Host.cpp with early returns

Based on NetBSD's Host.cpp. Also tidy up comments to match NetBSD.

llvm-svn: 301100

7 years agoRevert "Use DW_OP_stack_value when reconstructing variable values with arithmetic."
Adrian Prantl [Sun, 23 Apr 2017 00:44:40 +0000 (00:44 +0000)]
Revert "Use DW_OP_stack_value when reconstructing variable values with arithmetic."

This reverts commit r301093 while investigating stage2 bot breakage.

llvm-svn: 301099

7 years agoFix testcase: s/CHECKNEXT/CHECK-NEXT/
Jonathan Roelofs [Sat, 22 Apr 2017 23:43:44 +0000 (23:43 +0000)]
Fix testcase: s/CHECKNEXT/CHECK-NEXT/

llvm-svn: 301098

7 years ago[InstCombine] clean up tests and regenerate checks; NFC
Sanjay Patel [Sat, 22 Apr 2017 23:36:47 +0000 (23:36 +0000)]
[InstCombine] clean up tests and regenerate checks; NFC

llvm-svn: 301097

7 years ago[CMake] Fix polly-isl-test execution in out-of-LLVM-tree builds.
Michael Kruse [Sat, 22 Apr 2017 23:02:53 +0000 (23:02 +0000)]
[CMake] Fix polly-isl-test execution in out-of-LLVM-tree builds.

The isl unittest modified its PATH variable to point to the LLVM bin dir.
When building out-of-LLVM-tree, it does not contain the
polly-isl-test executable, hence the test fails.

Ensure that the polly-isl-test is written to a bin directory in the
build root, just like it would happen in an inside-LLVM build.
Then, change PATH to include that dir such that the executable in it
is prioritized before any other location.

llvm-svn: 301096

7 years ago[CMake] Fix unittests in out-of-LLVM-tree builds.
Michael Kruse [Sat, 22 Apr 2017 23:02:46 +0000 (23:02 +0000)]
[CMake] Fix unittests in out-of-LLVM-tree builds.

Unittests are linked against a subset of LLVM libraries and its
transitive dependencies resolved by CMake. The information about indirect
library dependency is not available when building separately from
LLVM, which result in missing symbol errors while linking.

Resolve this issue by querying llvm-config about the available
LLVM libraries and link against all of them, since dependence
information is still not available.

llvm-svn: 301095

7 years ago[APInt] Add ashrInPlace method and implement ashr using it. Also fix a bug in the...
Craig Topper [Sat, 22 Apr 2017 22:00:03 +0000 (22:00 +0000)]
[APInt] Add ashrInPlace method and implement ashr using it. Also fix a bug in the shift by BitWidth handling.

For single word, shift by BitWidth was always returning 0, but for multiword it was based on original sign. Now single word matches multi word.

llvm-svn: 301094

7 years agoUse DW_OP_stack_value when reconstructing variable values with arithmetic.
Adrian Prantl [Sat, 22 Apr 2017 20:54:06 +0000 (20:54 +0000)]
Use DW_OP_stack_value when reconstructing variable values with arithmetic.

When the location description of a source variable involves arithmetic
on the value itself, it needs to be marked with DW_OP_stack_value since it
is not describing the variable's location, but rather its value.

This is a follow-up to r297971 and fixes the source testcase quoted in
the comment in debuginfo-dce.ll.

rdar://problem/30725338

llvm-svn: 301093

7 years ago[X86] Regenerate TLS tests
Simon Pilgrim [Sat, 22 Apr 2017 20:13:58 +0000 (20:13 +0000)]
[X86] Regenerate TLS tests

Use the correct check prefix for X86/X32/X64 target types.

llvm-svn: 301092

7 years ago[APInt] Remove unnecessary min with BitWidth from countTrailingOnesSlowCase.
Craig Topper [Sat, 22 Apr 2017 19:59:11 +0000 (19:59 +0000)]
[APInt] Remove unnecessary min with BitWidth from countTrailingOnesSlowCase.

The unused upper bits are guaranteed to be 0 so we don't need to worry about accidentally counting them.

llvm-svn: 301091

7 years ago[PartialInlining] Using existing hasAddressTaken interface to legality check/NFC
Xinliang David Li [Sat, 22 Apr 2017 19:24:19 +0000 (19:24 +0000)]
[PartialInlining] Using existing hasAddressTaken interface to legality check/NFC

llvm-svn: 301090

7 years ago[builtins] Implement emulated TLS on Windows.
Frederich Munch [Sat, 22 Apr 2017 18:45:17 +0000 (18:45 +0000)]
[builtins] Implement emulated TLS on Windows.

Summary:
LLVM JIT needs to be able to use emulated TLS on all platforms, and this provides a reference one can compile to enable emutls for Linux/Mac/Windows.

Reviewers: chh, howard.hinnant

Reviewed By: chh

Subscribers: mgorny, llvm-commits

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

llvm-svn: 301089

7 years ago[InstCombine] use 'match' to reduce code; NFCI
Sanjay Patel [Sat, 22 Apr 2017 18:05:35 +0000 (18:05 +0000)]
[InstCombine] use 'match' to reduce code; NFCI

The later uses of dyn_castNotVal in this block are either
incomplete (doesn't handle vector constants) or overstepping
(shouldn't handle constants at all), but this first use is
just unnecessary. 'I' is obviously not a constant, and it
can't be a not-of-a-not because that would already be
instsimplified.

llvm-svn: 301088

7 years agoUpdate documentation for the NetBSD target
Kamil Rytarowski [Sat, 22 Apr 2017 16:11:23 +0000 (16:11 +0000)]
Update documentation for the NetBSD target

LLVM is known to work on NetBSD x86 32-bit and 64-bit.

llvm-svn: 301081

7 years ago[globalisel][tablegen] Add support for RegisterOperand.
Daniel Sanders [Sat, 22 Apr 2017 15:53:21 +0000 (15:53 +0000)]
[globalisel][tablegen] Add support for RegisterOperand.

Summary:
It functions just like RegisterClass except that the class is obtained
from a field.

Depends on D31761.

Reviewers: ab, qcolombet, t.p.northover, rovka, kristof.beyls, aditya_nandakumar

Reviewed By: ab

Subscribers: dberris, llvm-commits, igorb

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

llvm-svn: 301080

7 years ago[globalisel][tablegen] Revise API for ComplexPattern operands to improve flexibility.
Daniel Sanders [Sat, 22 Apr 2017 15:11:04 +0000 (15:11 +0000)]
[globalisel][tablegen] Revise API for ComplexPattern operands to improve flexibility.

Summary:
Some targets need to be able to do more complex rendering than just adding an
operand or two to an instruction. For example, it may need to insert an
instruction to extract a subreg first, or it may need to perform an operation
on the operand.

In SelectionDAG, targets would create SDNode's to achieve the desired effect
during the complex pattern predicate. This worked because SelectionDAG had a
form of garbage collection that would take care of SDNode's that were created
but not used due to a later predicate rejecting a match. This doesn't translate
well to GlobalISel and the churn was wasteful.

The API changes in this patch enable GlobalISel to accomplish the same thing
without the waste. The API is now:
InstructionSelector::OptionalComplexRendererFn selectArithImmed(MachineOperand &Root) const;
where Root is the root of the match. The return value can be omitted to
indicate that the predicate failed to match, or a function with the signature
ComplexRendererFn can be returned. For example:
return OptionalComplexRendererFn(
       [=](MachineInstrBuilder &MIB) { MIB.addImm(Immed).addImm(ShVal); });
adds two immediate operands to the rendered instruction. Immed and ShVal are
captured from the predicate function.

As an added bonus, this also reduces the amount of information we need to
provide to GIComplexOperandMatcher.

Depends on D31418

Reviewers: aditya_nandakumar, t.p.northover, qcolombet, rovka, ab, javed.absar

Reviewed By: ab

Subscribers: dberris, kristof.beyls, igorb, llvm-commits

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

llvm-svn: 301079

7 years ago[globalisel][tablegen] Fix PR32733 by checking which instruction operands belong to.
Daniel Sanders [Sat, 22 Apr 2017 14:31:28 +0000 (14:31 +0000)]
[globalisel][tablegen] Fix PR32733 by checking which instruction operands belong to.

canMutate() was returning true when the operands were all in the same order as
the matched instruction. However, it wasn't checking the operands were actually
on that instruction. This worked when we could only match a single instruction
but the addition of nested instruction matching led to cases where the operands
could be split across multiple instructions. canMutate() now returns false if
operands belong to instructions other than the root of the match.

llvm-svn: 301077

7 years ago[OpenMP] libomptarget: Set ref count for global objects to positive infinity
George Rokos [Sat, 22 Apr 2017 11:45:03 +0000 (11:45 +0000)]
[OpenMP] libomptarget: Set ref count for global objects to positive infinity

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

llvm-svn: 301076

7 years ago[OpenMP] libomptarget: Remove obsolete negative device IDs -2/-3
George Rokos [Sat, 22 Apr 2017 11:21:54 +0000 (11:21 +0000)]
[OpenMP] libomptarget: Remove obsolete negative device IDs -2/-3

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

llvm-svn: 301075

7 years ago[OpenMP] Run libomptarget regression tests using all available system threads.
George Rokos [Sat, 22 Apr 2017 11:20:20 +0000 (11:20 +0000)]
[OpenMP] Run libomptarget regression tests using all available system threads.

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

llvm-svn: 301074

7 years agoFix test to handle .rel and .rela sections (& to actually specify the target architec...
David Blaikie [Sat, 22 Apr 2017 08:17:39 +0000 (08:17 +0000)]
Fix test to handle .rel and .rela sections (& to actually specify the target architecture as X86)

llvm-svn: 301073

7 years agoAvoid using relocations for ref_addr in .dwo files
David Blaikie [Sat, 22 Apr 2017 07:53:44 +0000 (07:53 +0000)]
Avoid using relocations for ref_addr in .dwo files

In dwo files the fixed offset can be used - if the dwos are linked into
a dwp, the dwo consumer must use the dwp tables to find out where the
original range of the debug_info was and resolve the "section relative"
value relative to that original range - effectively
avoiding/reimplementing the relocation handling.

llvm-svn: 301072

7 years agoFix test from polluting the source tree
David Blaikie [Sat, 22 Apr 2017 07:53:40 +0000 (07:53 +0000)]
Fix test from polluting the source tree

(though this seems like a "does this not crash" test - which isn't very
good. Should be fixed)

llvm-svn: 301071

7 years agoFix for PR32740 - Invalid floating type, unreachable between r300969 and r301029
Artur Pilipenko [Sat, 22 Apr 2017 07:24:52 +0000 (07:24 +0000)]
Fix for PR32740 - Invalid floating type, unreachable between r300969 and r301029

The bug was introduced by r301018 "[InstCombine] fadd double (sitofp x), y check that the promotion is valid". The patch didn't expect that fadd can be on vectors not necessarily scalars. Add vector support along with the test.

llvm-svn: 301070

7 years ago[APInt] Add WORD_MAX constant and use it instead of UINT64_MAX. NFC
Craig Topper [Sat, 22 Apr 2017 06:31:36 +0000 (06:31 +0000)]
[APInt] Add WORD_MAX constant and use it instead of UINT64_MAX. NFC

llvm-svn: 301069

7 years agoRemove the unnecessary virtual dtor from the DIEUnit hierarchy (in favor of protected...
David Blaikie [Sat, 22 Apr 2017 02:18:00 +0000 (02:18 +0000)]
Remove the unnecessary virtual dtor from the DIEUnit hierarchy (in favor of protected dtor in the base, final derived classes with public non-virtual dtors)

These objects are never polymorphically owned/destroyed, so the virtual
dtor was unnecessary.

llvm-svn: 301068

7 years agoThreadSanitizer plugin: match for loop variable with expected type
Ed Maste [Sat, 22 Apr 2017 01:38:54 +0000 (01:38 +0000)]
ThreadSanitizer plugin: match for loop variable with expected type

Removes Clang warning ThreadSanitizerRuntime.cpp:591:21: warning:
comparison of integers of different signs: 'int' and 'size_t' (aka
'unsigned long') [-Wsign-compare]

llvm-svn: 301067

7 years agoRearrange some Modules TS testcases into test/CXX/modules-ts.
Richard Smith [Sat, 22 Apr 2017 00:47:53 +0000 (00:47 +0000)]
Rearrange some Modules TS testcases into test/CXX/modules-ts.

llvm-svn: 301066

7 years ago[cfi] Disable thinlto tests on Darwin.
Ahmed Bougacha [Sat, 22 Apr 2017 00:07:47 +0000 (00:07 +0000)]
[cfi] Disable thinlto tests on Darwin.

These were added in r301016, but they're failing, because
-fsanitize=cfi seemingly causes -flto=thin to emit raw bitcode objects,
rather than the mach-o-wrapped bitcode we emit with -flto=thin alone.

That causes all tests to fail with ld64 errors.

Filed PR32741.

llvm-svn: 301065

7 years agoLowerSwitch: Fix producing invalid IR on unreachable code
Matt Arsenault [Fri, 21 Apr 2017 23:54:12 +0000 (23:54 +0000)]
LowerSwitch: Fix producing invalid IR on unreachable code

If a switch was in an unreachable block that branched
to a block with a phi, it would leave phis with missing
predecessors.

llvm-svn: 301064

7 years agoMove Split DWARF handling to an MC option/command line argument rather than using...
David Blaikie [Fri, 21 Apr 2017 23:35:36 +0000 (23:35 +0000)]
Move Split DWARF handling to an MC option/command line argument rather than using metadata

Since Split DWARF needs to name the actual .dwo file that is generated,
it can't be known at the time the llvm::Module is produced as it may be
merged with other Modules before the object is generated and that object
may be generated with any name.

By passing the Split DWARF file name when LLVM is producing object code
the .dwo file name in the object file can match correctly.

The support for Split DWARF for implicit modules remains the same -
using metadata to store the dwo name and dwo id so that potentially
multiple skeleton CUs referring to different dwo files can be generated
from one llvm::Module.

llvm-svn: 301063

7 years agoMove Split DWARF handling to an MC option/command line argument rather than using...
David Blaikie [Fri, 21 Apr 2017 23:35:26 +0000 (23:35 +0000)]
Move Split DWARF handling to an MC option/command line argument rather than using metadata

Since Split DWARF needs to name the actual .dwo file that is generated,
it can't be known at the time the llvm::Module is produced as it may be
merged with other Modules before the object is generated and that object
may be generated with any name.

By passing the Split DWARF file name when LLVM is producing object code
the .dwo file name in the object file can match correctly.

The support for Split DWARF for implicit modules remains the same -
using metadata to store the dwo name and dwo id so that potentially
multiple skeleton CUs referring to different dwo files can be generated
from one llvm::Module.

llvm-svn: 301062