platform/upstream/llvm.git
7 years agoMemorySSA: Push const correctness further.
Daniel Berlin [Sat, 1 Apr 2017 09:01:12 +0000 (09:01 +0000)]
MemorySSA: Push const correctness further.

llvm-svn: 299295

7 years agoMemorySSA: Kill the WalkTargetCache now that we have getBlockDefs.
Daniel Berlin [Sat, 1 Apr 2017 08:59:45 +0000 (08:59 +0000)]
MemorySSA: Kill the WalkTargetCache now that we have getBlockDefs.

llvm-svn: 299294

7 years ago[APInt] Implement operator! using operator==(uint64_t). NFCI
Craig Topper [Sat, 1 Apr 2017 06:50:00 +0000 (06:50 +0000)]
[APInt] Implement operator! using operator==(uint64_t). NFCI

llvm-svn: 299293

7 years ago[APInt] Remove the mul/urem/srem/udiv/sdiv functions from the APIntOps namespace...
Craig Topper [Sat, 1 Apr 2017 05:08:57 +0000 (05:08 +0000)]
[APInt] Remove the mul/urem/srem/udiv/sdiv functions from the APIntOps namespace. Replace the few usages with calls to the class methods. NFC

llvm-svn: 299292

7 years ago[DAGCombiner] Fix fold (or (shuf A, V_0, MA), (shuf B, V_0, MB)) -> (shuf A, B, Mask...
Craig Topper [Sat, 1 Apr 2017 04:26:20 +0000 (04:26 +0000)]
[DAGCombiner] Fix fold (or (shuf A, V_0, MA), (shuf B, V_0, MB)) -> (shuf A, B, Mask) to explicitly ensure that only one of the inputs of each shuffle is a zero vector.

This can only happen when we have a mix of zero and undef elements and the two vectors have a different arrangement of zeros/undefs. The shuffle should eventually be constant folded to all zeros.

Fixes PR32484.

llvm-svn: 299291

7 years agostring: Remove always_inline from basic_string::__init
Duncan P. N. Exon Smith [Sat, 1 Apr 2017 03:20:48 +0000 (03:20 +0000)]
string: Remove always_inline from basic_string::__init

This is effectively a partial revert of r278356, which started inlining
basic_string::__init.  Even if we want to help the compiler along with
an inlinehint, we shouldn't hamstring it by forcing it to inline all the
time.

Libc++ uses always_inline widely as a limit-the-ABI-hack, but since
__init is already on the dylib boundary, it makes no sense here and just
harms the debugging experience at -O0.

rdar://problem/31013102

llvm-svn: 299290

7 years agoChange the error format to report corrupted .eh_frame.
Rui Ueyama [Sat, 1 Apr 2017 01:42:20 +0000 (01:42 +0000)]
Change the error format to report corrupted .eh_frame.

llvm-svn: 299289

7 years agoRevert "Feature generic option to setup start/stop-after/before"
Quentin Colombet [Sat, 1 Apr 2017 01:26:24 +0000 (01:26 +0000)]
Revert "Feature generic option to setup start/stop-after/before"

This reverts commit r299282.

Didn't intend to commit this :(

llvm-svn: 299288

7 years agoRevert "Localizer fun"
Quentin Colombet [Sat, 1 Apr 2017 01:26:21 +0000 (01:26 +0000)]
Revert "Localizer fun"

This reverts commit r299283.

Didn't intend to commit this :(

llvm-svn: 299287

7 years agoRevert "Instrument SDISel C++ patterns"
Quentin Colombet [Sat, 1 Apr 2017 01:26:17 +0000 (01:26 +0000)]
Revert "Instrument SDISel C++ patterns"

This reverts commit r299284.

Didn't intend to commit this :(

llvm-svn: 299286

7 years ago[RegBankSelect] Support REG_SEQUENCE for generic mapping
Quentin Colombet [Sat, 1 Apr 2017 01:26:14 +0000 (01:26 +0000)]
[RegBankSelect] Support REG_SEQUENCE for generic mapping

REG_SEQUENCE falls into the same category as COPY for operands mapping:
- They don't have MCInstrDesc with register constraints
- The input variable could use whatever register classes
- It is possible to have register class already assigned to the operands

In particular, given REG_SEQUENCE are always target specific because of
the subreg indices. Those indices must apply to the register class of
the definition of the REG_SEQUENCE and therefore, the target must set a
register class to that definition. As a result, the generic code can
always use that register class to derive a valid mapping for a
REG_SEQUENCE.

llvm-svn: 299285

7 years agoInstrument SDISel C++ patterns
Quentin Colombet [Sat, 1 Apr 2017 01:21:32 +0000 (01:21 +0000)]
Instrument SDISel C++ patterns

llvm-svn: 299284

7 years agoLocalizer fun
Quentin Colombet [Sat, 1 Apr 2017 01:21:28 +0000 (01:21 +0000)]
Localizer fun

WIP

llvm-svn: 299283

7 years agoFeature generic option to setup start/stop-after/before
Quentin Colombet [Sat, 1 Apr 2017 01:21:24 +0000 (01:21 +0000)]
Feature generic option to setup start/stop-after/before

This patch refactors the code used in llc such that all the users of the
addPassesToEmitFile API have access to a homogeneous way of handling
start/stop-after/before options right out of the box.

Previously each user would have needed to duplicate this logic and set
up its own options.

NFC

llvm-svn: 299282

7 years ago[coroutines] Add cleanup for compiler injected objects/allocations in coroutine body
Gor Nishanov [Sat, 1 Apr 2017 00:22:47 +0000 (00:22 +0000)]
[coroutines] Add cleanup for compiler injected objects/allocations in coroutine body

Summary:
* Use pushCleanup to emit freeing coroutine memory on normal and EH exits.
* Surround emitted code with CodeGenFunction::RunCleanupsScope.

Reviewers: rsmith, rnk, EricWF

Reviewed By: rnk

Subscribers: cfe-commits

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

llvm-svn: 299281

7 years agoChange the error message format for duplicate symbols.
Rui Ueyama [Fri, 31 Mar 2017 23:40:21 +0000 (23:40 +0000)]
Change the error message format for duplicate symbols.

This patch is intended to improve readability of "duplicate symbol"
error messages.

Without this patch:

  /ssd/clang/bin/ld.lld: error: /ssd/llvm-project/lld/ELF/Relocations.cpp:1054: duplicate symbol 'lld::elf::demangle(llvm::StringRef)'
  /ssd/clang/bin/ld.lld: error: /ssd/llvm-project/lld/ELF/Strings.cpp:93: previous definition was here

With this patch:

  /ssd/clang/bin/ld.lld: error: duplicate symbol: lld::elf::demangle(llvm::StringRef)
  >>> defined at Strings.cpp:93 (/ssd/llvm-project/lld/ELF/Strings.cpp:93)
  >>>            Strings.cpp.o:(lld::elf::demangle(llvm::StringRef)) in archive lib/liblldELF.a
  >>> defined at Relocations.cpp:1054 (/ssd/llvm-project/lld/ELF/Relocations.cpp:1054)
  >>>            Relocations.cpp.o:(.text+0x4C30) in archive lib/liblldELF.a

Discussion thread:
http://lists.llvm.org/pipermail/llvm-dev/2017-March/111459.html

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

llvm-svn: 299280

7 years agoFix a test to check assembly output instead of bitcode.
Peter Collingbourne [Fri, 31 Mar 2017 23:22:19 +0000 (23:22 +0000)]
Fix a test to check assembly output instead of bitcode.

llvm-svn: 299279

7 years agoReduce the number of times we query the subtarget for the same information.
Eric Christopher [Fri, 31 Mar 2017 23:12:27 +0000 (23:12 +0000)]
Reduce the number of times we query the subtarget for the same information.

llvm-svn: 299278

7 years agoSmall cleanup to remove extraneous cast.
Eric Christopher [Fri, 31 Mar 2017 23:12:24 +0000 (23:12 +0000)]
Small cleanup to remove extraneous cast.

llvm-svn: 299277

7 years agoDisassembleRange can return an empty DisassemblerSP
Jim Ingham [Fri, 31 Mar 2017 22:39:55 +0000 (22:39 +0000)]
DisassembleRange can return an empty DisassemblerSP
check for it.

<rdar://problem/31379799>

llvm-svn: 299276

7 years agoAMDGPU/llvm-readobj: Rename RuntimeMDNoteType -> CodeObjectMetadataNoteType to
Konstantin Zhuravlyov [Fri, 31 Mar 2017 22:36:39 +0000 (22:36 +0000)]
AMDGPU/llvm-readobj: Rename RuntimeMDNoteType -> CodeObjectMetadataNoteType to
match the new metadata. NFC.

llvm-svn: 299275

7 years ago[ThinLTO] Handle -emit-llvm* in ThinLTO backends
Teresa Johnson [Fri, 31 Mar 2017 22:35:47 +0000 (22:35 +0000)]
[ThinLTO] Handle -emit-llvm* in ThinLTO backends

Summary:
Use PreCodeGenModuleHook to invoke the correct writer when emitting LLVM
IR, returning false to skip codegen from within thinBackend.

Reviewers: pcc, mehdi_amini

Subscribers: Prazek, cfe-commits

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

llvm-svn: 299274

7 years ago[APInt] Fix bugs in isShiftedMask to match behavior of the similar function in MathEx...
Craig Topper [Fri, 31 Mar 2017 22:23:42 +0000 (22:23 +0000)]
[APInt] Fix bugs in isShiftedMask to match behavior of the similar function in MathExtras.h

This removes a parameter from the routine that was responsible for a lot of the issue. It was a bit count that had to be set to the BitWidth of the APInt and would get passed to getLowBitsSet. This guaranteed the call to getLowBitsSet would create an all ones value. This was then compared to (V | (V-1)). So the only shifted masks we detected had to have the MSB set.

The one in tree user is a transform in InstCombine that never fires due to earlier transforms covering the case better. I've submitted a patch to remove it completely, but for now I've just adapted it to the new interface for isShiftedMask.

llvm-svn: 299273

7 years agoCOFF: tests for thinlto with mangled names
Bob Haarman [Fri, 31 Mar 2017 22:17:02 +0000 (22:17 +0000)]
COFF: tests for thinlto with mangled names

Summary: This change adds tests for r299268.

Reviewers: pcc, rnk

Reviewed By: pcc

Subscribers: mehdi_amini, llvm-commits, Prazek

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

llvm-svn: 299272

7 years ago[AMDGPU] Fix typo in test filename. NFC.
Konstantin Zhuravlyov [Fri, 31 Mar 2017 22:14:54 +0000 (22:14 +0000)]
[AMDGPU] Fix typo in test filename. NFC.

llvm-svn: 299271

7 years agoAdd virtual destructor to WasmYAML::Section or avoid memory leak
Derek Schuff [Fri, 31 Mar 2017 22:14:14 +0000 (22:14 +0000)]
Add virtual destructor to WasmYAML::Section or avoid memory leak

Tested locally with -DLLVM_USE_SANITIZER=Address

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

Patch by Sam Clegg

llvm-svn: 299270

7 years agoAdd/update PIE defaults for OpenBSD.
Brad Smith [Fri, 31 Mar 2017 22:13:17 +0000 (22:13 +0000)]
Add/update PIE defaults for OpenBSD.

llvm-svn: 299269

7 years agoLTO: call getRealLinkageName on IRNames before feeding to getGUID
Bob Haarman [Fri, 31 Mar 2017 21:56:30 +0000 (21:56 +0000)]
LTO: call getRealLinkageName on IRNames before feeding to getGUID

Summary: GlobalValue has two getGUID methods: an instance method and a static method. The static method takes a string, which is expected to be what GlobalValue::getRealLinkageName() would return. In LTO.cpp, we were not doing this consistently, sometimes passing an IR name instead. This change makes it so that we call getRealLinkageName() first, making the static getGUID return value consistent with the instance method. Without this change, compiling FileCheck with ThinLTO on Windows fails with numerous undefined symbol errors. With the change, it builds successfully.

Reviewers: pcc, rnk

Reviewed By: pcc

Subscribers: tejohnson, mehdi_amini, llvm-commits

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

llvm-svn: 299268

7 years ago[InstCombine] When adding an Instruction and its Users to the worklist at the same...
Craig Topper [Fri, 31 Mar 2017 21:35:30 +0000 (21:35 +0000)]
[InstCombine] When adding an Instruction and its Users to the worklist at the same time, make sure we put the Users in first. Then put in the instruction.

This way we ensure we immediately revisit the instruction and do any additional optimizations before visiting the users. Otherwise we might visit the users, then the instruction, then users again, then instruction again.

llvm-svn: 299267

7 years ago[DAGCombiner] refactor and/or-of-setcc to get rid of duplicated code; NFCI
Sanjay Patel [Fri, 31 Mar 2017 21:30:50 +0000 (21:30 +0000)]
[DAGCombiner] refactor and/or-of-setcc to get rid of duplicated code; NFCI

llvm-svn: 299266

7 years agoFix binary static archive that got mangled by patch
Reid Kleckner [Fri, 31 Mar 2017 21:16:22 +0000 (21:16 +0000)]
Fix binary static archive that got mangled by patch

llvm-svn: 299265

7 years ago[llvm-ar] Extract objects to their basename in the CWD
Reid Kleckner [Fri, 31 Mar 2017 21:10:53 +0000 (21:10 +0000)]
[llvm-ar] Extract objects to their basename in the CWD

This is helpful when extracting objects from archives produced by MSVC's
lib.exe, which users absolute paths to describe the archive members.

llvm-svn: 299264

7 years ago[InstCombine] Add test case demonstrating missed opportunities for removing add/sub...
Craig Topper [Fri, 31 Mar 2017 21:08:37 +0000 (21:08 +0000)]
[InstCombine] Add test case demonstrating missed opportunities for removing add/sub when the LSBs of one input are known to be 0 and MSBs of the output aren't consumed.

llvm-svn: 299263

7 years ago[Hexagon] Remove unused variables
Krzysztof Parzyszek [Fri, 31 Mar 2017 21:03:59 +0000 (21:03 +0000)]
[Hexagon] Remove unused variables

Found by PVS-Studio. Fixes llvm.org/PR31676.

llvm-svn: 299262

7 years agoadd more RegisterContext files to xcode project
Tim Hammerquist [Fri, 31 Mar 2017 21:03:58 +0000 (21:03 +0000)]
add more RegisterContext files to xcode project

llvm-svn: 299261

7 years agoStop calling ValueObject::SetName from synthetic child providers
Tamas Berghammer [Fri, 31 Mar 2017 20:48:00 +0000 (20:48 +0000)]
Stop calling ValueObject::SetName from synthetic child providers

Summary:
Calling ValueObject::SetName from a sythetic child provider would change
the underying value object used for the non-synthetic child as well what
is clearly unintentional.

Reviewers: jingham, labath

Subscribers: lldb-commits

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

llvm-svn: 299259

7 years ago[Hexagon] Fix typo in HexagonEarlyIfCConv.cpp
Krzysztof Parzyszek [Fri, 31 Mar 2017 20:36:00 +0000 (20:36 +0000)]
[Hexagon] Fix typo in HexagonEarlyIfCConv.cpp

Found by PVS-Studio. Fixes llvm.org/PR32480.

llvm-svn: 299258

7 years agoFix 80-column violation in previous commit.
Stephen Canon [Fri, 31 Mar 2017 20:35:02 +0000 (20:35 +0000)]
Fix 80-column violation in previous commit.

llvm-svn: 299257

7 years agoFix APFloat mod (committing for simonbyrne)
Stephen Canon [Fri, 31 Mar 2017 20:31:33 +0000 (20:31 +0000)]
Fix APFloat mod (committing for simonbyrne)

The previous version was prone to intermediate rounding or overflow.

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

llvm-svn: 299256

7 years ago[DAGCombiner] add fold for 'All sign bits set?'
Sanjay Patel [Fri, 31 Mar 2017 20:28:06 +0000 (20:28 +0000)]
[DAGCombiner] add fold for 'All sign bits set?'

(and (setlt X,  0), (setlt Y,  0)) --> (setlt (and X, Y),  0)

We have 7 similar folds, but this one got away. The fact that the
x86 test with a branch didn't change is probably a separate bug. We
may also be missing this and the related folds in instcombine.

llvm-svn: 299252

7 years agoAdd support for sythetic operator dereference
Tamas Berghammer [Fri, 31 Mar 2017 20:23:22 +0000 (20:23 +0000)]
Add support for sythetic operator dereference

Summary:
After this change a sythetic child provider can generate a special child
named "$$dereference$$" what if present is used when "operator*" or
"operator->" used on a ValueObject. The goal of the change is to make
expressions like "up->foo" work inside the "frame variable" command.

Reviewers: labath, jingham

Subscribers: lldb-commits

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

llvm-svn: 299251

7 years ago[AMDGPU] Remove assumption that vector and scalar types do not alias
Stanislav Mekhanoshin [Fri, 31 Mar 2017 20:16:54 +0000 (20:16 +0000)]
[AMDGPU] Remove assumption that vector and scalar types do not alias

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

llvm-svn: 299250

7 years agoDo not dereference std::unique_ptr by default
Tamas Berghammer [Fri, 31 Mar 2017 20:07:20 +0000 (20:07 +0000)]
Do not dereference std::unique_ptr by default

Summary:
Displaying the object pointed by the unique_ptr can cause an infinite
recursion when we have a pointer loop so this change stops that
behavior. Additionally it makes the unique_ptr act more like a class
containing a pointer (what is the underlying truth) instead of some
"magic" class.

Reviewers: labath, jingham

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

llvm-svn: 299249

7 years ago[APInt] Remove shift functions from APIntOps namespace. Replace the few users with...
Craig Topper [Fri, 31 Mar 2017 20:01:16 +0000 (20:01 +0000)]
[APInt] Remove shift functions from APIntOps namespace. Replace the few users with the APInt class methods. NFCI

llvm-svn: 299248

7 years agoDo not translate rint into nearbyint, but truncate it like nearbyint.
Joerg Sonnenberger [Fri, 31 Mar 2017 19:58:07 +0000 (19:58 +0000)]
Do not translate rint into nearbyint, but truncate it like nearbyint.

A common way to implement nearbyint is by fiddling with the floating
point environment and calling rint. This is used at least by the BSD
libm and musl. As such, canonicalizing the latter to the former will
create infinite loops for libm and generally pessimize performance, at
least when the generic C versions are used.

This change preserves the rint in the libcall translation and also
handles the domain truncation logic, so that rint with float argument
will be reduced to rintf etc.

llvm-svn: 299247

7 years agoAMDGPU: Remove unnecessary ands when f16 is legal
Matt Arsenault [Fri, 31 Mar 2017 19:53:03 +0000 (19:53 +0000)]
AMDGPU: Remove unnecessary ands when f16 is legal

Add a new node to act as a fancy bitcast from f16 operations to
i32 that implicitly zero the high 16-bits of the result.

Alternatively could try making v2f16 legal and canonicalizing
on build_vectors.

llvm-svn: 299246

7 years agoAMDGPU/R600: Fix amdgpu alias analysis pass.
Jan Vesely [Fri, 31 Mar 2017 19:26:23 +0000 (19:26 +0000)]
AMDGPU/R600: Fix amdgpu alias analysis pass.

R600 uses higher AS number to access kernel parameters

Fixes: r298846
Differential Revision: https://reviews.llvm.org/D31520

llvm-svn: 299245

7 years ago[PowerPC] add tests for setcc+setcc+logic; NFC
Sanjay Patel [Fri, 31 Mar 2017 18:51:03 +0000 (18:51 +0000)]
[PowerPC] add tests for setcc+setcc+logic; NFC

These are the same tests added for x86 with r299238,
but PPC doesn't specify all branches as cheap, so we
see different patterns in tests with branches.

llvm-svn: 299244

7 years ago[APInt] Rewrite getLoBits in a way that will do one less memory allocation in the...
Craig Topper [Fri, 31 Mar 2017 18:48:14 +0000 (18:48 +0000)]
[APInt] Rewrite getLoBits in a way that will do one less memory allocation in the multiword case. Rewrite getHiBits to use the class method version of lshr instead of the one in APIntOps. NFCI

llvm-svn: 299243

7 years ago[APInt] Remove unused functions from the APIntOps namespace. The corresponding method...
Craig Topper [Fri, 31 Mar 2017 18:30:01 +0000 (18:30 +0000)]
[APInt] Remove unused functions from the APIntOps namespace. The corresponding methods on the APInt object should be used instead. NFC

llvm-svn: 299242

7 years ago[DAGCombiner] remove redundant code and add comments; NFCI
Sanjay Patel [Fri, 31 Mar 2017 18:18:58 +0000 (18:18 +0000)]
[DAGCombiner] remove redundant code and add comments; NFCI

llvm-svn: 299241

7 years ago[AArch64] Add new subtarget feature to fold LSL into address mode.
Balaram Makam [Fri, 31 Mar 2017 18:16:53 +0000 (18:16 +0000)]
[AArch64] Add new subtarget feature to fold LSL into address mode.

Summary:
This feature enables folding of logical shift operations of up to 3 places into addressing mode on Kryo and Falkor that have a fastpath LSL.

Reviewers: mcrosier, rengolin, t.p.northover

Subscribers: junbuml, gberry, llvm-commits, aemerson

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

llvm-svn: 299240

7 years agoVerify memory address range validity in GDBRemoteCommunicationClient
Stephane Sezer [Fri, 31 Mar 2017 18:00:48 +0000 (18:00 +0000)]
Verify memory address range validity in GDBRemoteCommunicationClient

Summary:
This aims to verify the validity of the response from the debugging
server in GDBRemoteCommunicationClient::GetMemoryRegionInfo. I was
working with ds2 (https://github.com/facebook/ds2) and encountered a bug
that caused the server's response to have a 'size' value of 0, which
caused lldb to behave incorrectly.

Reviewers: k8stone, labath, clayborg

Reviewed By: labath, clayborg

Subscribers: clayborg, sas, lldb-commits

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

Change by Alex Langford <apl@fb.com>

llvm-svn: 299239

7 years ago[x86] add/consolidate tests for setcc+setcc+and/or; NFC
Sanjay Patel [Fri, 31 Mar 2017 17:55:07 +0000 (17:55 +0000)]
[x86] add/consolidate tests for setcc+setcc+and/or; NFC

llvm-svn: 299238

7 years agoImprove DebugInfo/strip-loop-metadata.ll test
Adam Nemet [Fri, 31 Mar 2017 17:51:12 +0000 (17:51 +0000)]
Improve DebugInfo/strip-loop-metadata.ll test

This wasn't covering for the case where you have multiple latches and hence
the use of the same loop-id which needs to be mapped to the same loop-id.

llvm-svn: 299237

7 years agoUse strong enums independently of -fobjc-arc
Duncan P. N. Exon Smith [Fri, 31 Mar 2017 17:39:56 +0000 (17:39 +0000)]
Use strong enums independently of -fobjc-arc

r145698 introduced _LIBCPP_HAS_NO_STRONG_ENUMS by copy-pasting the
__has_feature check from objc_arc_weak/_LIBCPP_HAS_OBJC_ARC_WEAK, and
accidentally started defining _LIBCPP_HAS_NO_STRONG_ENUMS whenever
__has_feature(objc_arc_weak).  This is totally bogus, and means that
Libc++ thinks Objective-C++ compilations with -fobjc-arc don't have
strong enums.

Delete the accidental line.

I thought about adding a test, but it would be entirely duplicative of
the patch (if has-feature strong enums, check that has-no-strong-enums
is not defined).

llvm-svn: 299236

7 years ago[MSSA] Small test fix
Piotr Padlewski [Fri, 31 Mar 2017 17:39:07 +0000 (17:39 +0000)]
[MSSA] Small test fix

llvm-svn: 299235

7 years ago[AVX-512] Update lowering for gather/scatter prefetch intrinsics to match the immedia...
Craig Topper [Fri, 31 Mar 2017 17:24:29 +0000 (17:24 +0000)]
[AVX-512] Update lowering for gather/scatter prefetch intrinsics to match the immediate encodings the frontend uses based on the _MM_HINT_T0/T1 constant values in clang's headers.

Our _MM_HINT_T0/T1 constant values are 3/2 which matches gcc, but not icc or Intel documentation. Interestingly gcc had this same bug on their implementation of the gather/scatter builtins at one point too.

Fixes PR32411.

llvm-svn: 299234

7 years ago[Sema][X86] Update immediate check for gather/scatter prefetch instructions to match...
Craig Topper [Fri, 31 Mar 2017 17:22:30 +0000 (17:22 +0000)]
[Sema][X86] Update immediate check for gather/scatter prefetch instructions to match the _MM_HINT_T0/T1 constant definitions

Our _MM_HINT_T0/T1 constant values are 3/2 which matches gcc, but not icc or Intel documentation. Interestingly gcc had this same bug on their implementation of the gather/scatter builtins at one point too.

Fixes PR32411.

llvm-svn: 299233

7 years agoRename variable.
Rafael Espindola [Fri, 31 Mar 2017 17:11:51 +0000 (17:11 +0000)]
Rename variable.

Requested on post commit code review.

llvm-svn: 299232

7 years agoReplace wc -l with count.
Rafael Espindola [Fri, 31 Mar 2017 16:49:37 +0000 (16:49 +0000)]
Replace wc -l with count.

This is a far more common way in llvm of counting lines in tests.

llvm-svn: 299231

7 years agoFix for bug https://llvm.org/bugs/show_bug.cgi?id=32456
Andrey Churbanov [Fri, 31 Mar 2017 16:20:07 +0000 (16:20 +0000)]
Fix for bug https://llvm.org/bugs/show_bug.cgi?id=32456
ITT Notify disabled for static build of OpenMP RTL.

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

llvm-svn: 299230

7 years ago[mips][msa] Range adjustment for ldi_b builtin function operand
Petar Jovanovic [Fri, 31 Mar 2017 16:16:43 +0000 (16:16 +0000)]
[mips][msa] Range adjustment for ldi_b builtin function operand

Reasoning behind this change was allowing the function to accept all values
from range [-128, 255] since all of them can be encoded in an 8bit wide
value.
This differs from the prior state where only range [-128, 127] was accepted,
where values were assumed to be signed, whereas now the actual
interpretation of the immediate is deferred to the consumer as required.

Patch by Stefan Maksimovic.

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

llvm-svn: 299229

7 years agoFix the InstCombine to reserve the VP metadata and sets correct call count.
Dehao Chen [Fri, 31 Mar 2017 15:59:52 +0000 (15:59 +0000)]
Fix the InstCombine to reserve the VP metadata and sets correct call count.

Summary: Currently the VP metadata was dropped when InstCombine converts a call to direct call. This patch converts the VP metadata to branch_weights so that its hotness is recorded.

Reviewers: eraman, davidxl

Reviewed By: davidxl

Subscribers: llvm-commits

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

llvm-svn: 299228

7 years agoRefactor code to create getFallThrough method in MachineBasicBlock.
Jan Sjodin [Fri, 31 Mar 2017 15:55:37 +0000 (15:55 +0000)]
Refactor code to create getFallThrough method in MachineBasicBlock.

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

llvm-svn: 299227

7 years ago[Modules][PCH] Serialize #pragma pack
Alex Lorenz [Fri, 31 Mar 2017 15:36:21 +0000 (15:36 +0000)]
[Modules][PCH] Serialize #pragma pack

This patch serializes the state of #pragma pack. It preserves the state of the
pragma from a PCH/from modules in a file that uses that PCH/those modules.

rdar://21359084

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

llvm-svn: 299226

7 years ago[libunwind] Clean up macro usage.
Ranjeet Singh [Fri, 31 Mar 2017 15:28:06 +0000 (15:28 +0000)]
[libunwind] Clean up macro usage.

Convention in libunwind is to use !defined(FOOT) not !FOO.

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

llvm-svn: 299225

7 years agoRemove name space pollution from Signals.cpp
Kristof Beyls [Fri, 31 Mar 2017 14:58:52 +0000 (14:58 +0000)]
Remove name space pollution from Signals.cpp

llvm-svn: 299224

7 years ago[mips][msa] Prevent output operand from commuting for dpadd_[su].df ins
Petar Jovanovic [Fri, 31 Mar 2017 14:31:55 +0000 (14:31 +0000)]
[mips][msa] Prevent output operand from commuting for dpadd_[su].df ins

Implementation of TargetInstrInfo::findCommutedOpIndices for MIPS target,
restricting commutativity to second and third operand only for
dpaadd_[su].df instructions therein.

Prior to this change, there were cases where the vector that is to be added
to the dot product of the other two could take a position other than the
first one in the instruction, generating false output in the destination
vector.

Such behavior has been noticed in the two functions generating v2i64 output
values so far. Other ones may exhibit such behavior as well, just not for
the vector operands which are present in the test at the moment.

Tests altered so that the function's first operand is a constant splat so
that it can be loaded with a ldi instruction, since that is the case in
which the erroneous instruction operand placement has occurred. We check
that the register which is present in the ldi instruction is placed as the
first operand in the corresponding dpadd instruction.

Patch by Stefan Maksimovic.

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

llvm-svn: 299223

7 years agoRemove more name space pollution from .inc files
Kristof Beyls [Fri, 31 Mar 2017 14:26:44 +0000 (14:26 +0000)]
Remove more name space pollution from .inc files

llvm-svn: 299222

7 years ago[DAGCombiner] Add ComputeNumSignBits vector demanded elements support to ASHR and...
Simon Pilgrim [Fri, 31 Mar 2017 14:21:50 +0000 (14:21 +0000)]
[DAGCombiner] Add ComputeNumSignBits vector demanded elements support to ASHR and INSERT_VECTOR_ELT

Followup to D31311

llvm-svn: 299221

7 years ago[SystemZ] Make sure of correct regclasses in insertSelect()
Jonas Paulsson [Fri, 31 Mar 2017 14:06:59 +0000 (14:06 +0000)]
[SystemZ]  Make sure of correct regclasses in insertSelect()

Since LOCR only accepts GR32 virtual registers, its operands must be copied
into this regclass in insertSelect(), when an LOCR is built. Otherwise, the
case where the source operand was GRX32 will produce invalid IR.

Review: Ulrich Weigand
llvm-svn: 299220

7 years ago[DAGCombiner] Add vector demanded elements support to ComputeNumSignBits
Simon Pilgrim [Fri, 31 Mar 2017 13:54:09 +0000 (13:54 +0000)]
[DAGCombiner] Add vector demanded elements support to ComputeNumSignBits

Currently ComputeNumSignBits returns the minimum number of sign bits for all elements of vector data, when we may only be interested in one/some of the elements.

This patch adds a DemandedElts argument that allows us to specify the elements we actually care about. The original ComputeNumSignBits implementation calls with a DemandedElts demanding all elements to match current behaviour. Scalar types set this to 1.

I've only added support for BUILD_VECTOR and EXTRACT_VECTOR_ELT so far, all others will default to demanding all elements but can be updated in due course.

Followup to D25691.

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

llvm-svn: 299219

7 years agoDo not pollute the namespace in a header file.
Kristof Beyls [Fri, 31 Mar 2017 13:48:21 +0000 (13:48 +0000)]
Do not pollute the namespace in a header file.

llvm-svn: 299218

7 years agoAdd back test for r299152
Teresa Johnson [Fri, 31 Mar 2017 13:48:18 +0000 (13:48 +0000)]
Add back test for r299152

I am hoping the bot failures are addressed by using cc1 for the ThinLTO
backend invocations as well.

llvm-svn: 299217

7 years agoAdd a %basename substitution.
Rafael Espindola [Fri, 31 Mar 2017 13:41:10 +0000 (13:41 +0000)]
Add a %basename substitution.

This will be used to avoid various call to basename in the asan tests.

llvm-svn: 299216

7 years agoSimplify test.
Rafael Espindola [Fri, 31 Mar 2017 13:35:37 +0000 (13:35 +0000)]
Simplify test.

We don't need && since that is how various run lines are combined.
The redirects were not being used.

llvm-svn: 299215

7 years agoclang-format: Fix post-commit review comment of r299204, use Style.isCpp().
Daniel Jasper [Fri, 31 Mar 2017 13:30:24 +0000 (13:30 +0000)]
clang-format: Fix post-commit review comment of r299204, use Style.isCpp().

Also, while at it, s/IsCpp/isCpp/ so that it follows LLVM style.

llvm-svn: 299214

7 years ago[SystemZ] Skip DAGCombining of vector node for older subtargets.
Jonas Paulsson [Fri, 31 Mar 2017 13:22:59 +0000 (13:22 +0000)]
[SystemZ]  Skip DAGCombining of vector node for older subtargets.

Even on older subtargets that lack vector support, there may be vector values
with just one element in the input program. These are converted during DAG
legalization to scalar values.

The pre-legalize SystemZ DAGCombiner methods should in this circumstance not
touch these nodes. This patch adds a check for this in
SystemZTargetLowering::combineEXTRACT_VECTOR_ELT().

Review: Ulrich Weigand
llvm-svn: 299213

7 years ago[ELF] Add a NOP instruction to make LLVM generate a mapping symbol
Peter Smith [Fri, 31 Mar 2017 13:08:49 +0000 (13:08 +0000)]
[ELF] Add a NOP instruction to make LLVM generate a mapping symbol

This is a test change applicable for ARM targets.

Previously LLVM would generate a mapping symbol when code contains only
data. This was changed as part of

https://reviews.llvm.org/D30724

and to be more close to the ARM ELF ABI.

The test case is changed to check for behavior with minimal changes.

Patch by Shankar Easwaran

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

llvm-svn: 299212

7 years agoMake naming in Host.h in line with coding standards.
Kristof Beyls [Fri, 31 Mar 2017 13:06:40 +0000 (13:06 +0000)]
Make naming in Host.h in line with coding standards.

Based on post-commit review comments by Chandler Carruth on
https://reviews.llvm.org/D31236. Thanks!

llvm-svn: 299211

7 years agoclang-format vs plugin support for Visual Studio 2017
Hans Wennborg [Fri, 31 Mar 2017 12:50:42 +0000 (12:50 +0000)]
clang-format vs plugin support for Visual Studio 2017

With the release of Visual Studio 2017, we need to at the very least
claim support for it in the current manifest file. With the changes
introducted in this patch we can install the extension again, but a
warning message will be shown stating that it's not supported
(https://twitter.com/parsley72/status/846558416751411200).

To get the rid of the warning more work is necessary, as VS 2017 changed
some things about extensions, see more here:
https://docs.microsoft.com/en-us/visualstudio/extensibility/how-to-migrate-extensibility-projects-to-visual-studio-2017.
While working on those changes, it has been suggested in the
mail list that this first patch is integrated in the meantime.

Patch by Hugo Puhlmann!

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

llvm-svn: 299210

7 years agoUse the current working directory in the glob expansion
Rafael Espindola [Fri, 31 Mar 2017 12:46:39 +0000 (12:46 +0000)]
Use the current working directory in the glob expansion

This fixes tests that do things like

mkdir <dir>
cd <dir>
..
<cmd> *.foo

llvm-svn: 299209

7 years agoRemove unnecessary cast and branch. NFC.
James Henderson [Fri, 31 Mar 2017 12:31:23 +0000 (12:31 +0000)]
Remove unnecessary cast and branch. NFC.

llvm-svn: 299208

7 years agoUpdate comment for r299098 per feedback from James Henderson.
Yaron Keren [Fri, 31 Mar 2017 12:08:45 +0000 (12:08 +0000)]
Update comment for r299098 per feedback from James Henderson.

llvm-svn: 299207

7 years agoRemove unused variable.
Sam McCall [Fri, 31 Mar 2017 12:07:58 +0000 (12:07 +0000)]
Remove unused variable.

llvm-svn: 299206

7 years ago[ScalarEvolution] Re-enable Predicate implication from operations
Max Kazantsev [Fri, 31 Mar 2017 12:05:30 +0000 (12:05 +0000)]
[ScalarEvolution] Re-enable Predicate implication from operations

The patch rL298481 was reverted due to crash on clang-with-lto-ubuntu build.
The reason of the crash was type mismatch between either a or b and RHS in the following situation:

  LHS = sext(a +nsw b) > RHS.

This is quite rare, but still possible situation. Normally we need to cast all {a, b, RHS} to their widest type.
But we try to avoid creation of new SCEV that are not constants to avoid initiating recursive analysis that
can take a lot of time and/or cache a bad value for iterations number. To deal with this, in this patch we
reject this case and will not try to analyze it if the type of sum doesn't match with the type of RHS. In this
situation we don't need to create any non-constant SCEVs.

This patch also adds an assertion to the method IsProvedViaContext so that we could fail on it and not
go further into range analysis etc (because in some situations these analyzes succeed even when the passed
arguments have wrong types, what should not normally happen).

The patch also contains a fix for a problem with too narrow scope of the analysis caused by wrong
usage of predicates in recursive invocations.

The regression test on the said failure: test/Analysis/ScalarEvolution/implied-via-addition.ll

Reviewers: reames, apilipenko, anna, sanjoy

Reviewed By: sanjoy

Subscribers: mzolotukhin, mehdi_amini, llvm-commits

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

llvm-svn: 299205

7 years agoclang-format: [JavaScript] Ignore QT keywords.
Daniel Jasper [Fri, 31 Mar 2017 12:04:37 +0000 (12:04 +0000)]
clang-format: [JavaScript] Ignore QT keywords.

llvm-svn: 299204

7 years agoDo not pollute the namespace in a header file.
Kristof Beyls [Fri, 31 Mar 2017 12:00:24 +0000 (12:00 +0000)]
Do not pollute the namespace in a header file.

llvm-svn: 299203

7 years ago[AMDGPU] SDWA Peephole: improve search for immediates in SDWA patterns
Sam Kolton [Fri, 31 Mar 2017 11:42:43 +0000 (11:42 +0000)]
[AMDGPU] SDWA Peephole: improve search for immediates in SDWA patterns

Previously compiler often extracted common immediates into specific register, e.g.:
```
%vreg0 = S_MOV_B32 0xff;
%vreg2 = V_AND_B32_e32 %vreg0, %vreg1
%vreg4 = V_AND_B32_e32 %vreg0, %vreg3
```
Because of this SDWA peephole failed to find SDWA convertible pattern. E.g. in previous example this could be converted into 2 SDWA src operands:
```
SDWA src: %vreg2 src_sel:BYTE_0
SDWA src: %vreg4 src_sel:BYTE_0
```
With this change peephole check if operand is either immediate or register that is copy of immediate.

llvm-svn: 299202

7 years ago[DAGCombiner] Add vector demanded elements support to computeKnownBitsForTargetNode
Simon Pilgrim [Fri, 31 Mar 2017 11:24:16 +0000 (11:24 +0000)]
[DAGCombiner] Add vector demanded elements support to computeKnownBitsForTargetNode

Follow up to D25691, this sets up the plumbing necessary to support vector demanded elements support in known bits calculations in target nodes.

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

llvm-svn: 299201

7 years ago[LLDB][MIPS] Core Dump Support.
Nitesh Jain [Fri, 31 Mar 2017 11:14:02 +0000 (11:14 +0000)]
[LLDB][MIPS] Core Dump Support.

Reviewers: labath, emaste

Subscribers: jaydeep, bhushan, lldb-commits, slthakur

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

llvm-svn: 299200

7 years ago[LLDB][MIPS] Fix Core file Architecture and OS information.
Nitesh Jain [Fri, 31 Mar 2017 11:06:25 +0000 (11:06 +0000)]
[LLDB][MIPS] Fix Core file Architecture and OS information.

Reviewers: labath, clayborg

Subscribers: jaydeep, bhushan, lldb-commits, slthakur

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

llvm-svn: 299199

7 years agoSpelling mistakes in comments. NFCI.
Simon Pilgrim [Fri, 31 Mar 2017 11:00:53 +0000 (11:00 +0000)]
Spelling mistakes in comments. NFCI.

llvm-svn: 299198

7 years agoSpelling mistakes in comments. NFCI.
Simon Pilgrim [Fri, 31 Mar 2017 10:59:37 +0000 (10:59 +0000)]
Spelling mistakes in comments. NFCI.

llvm-svn: 299197

7 years ago[LLDB][MIPS] Check if memory_info.GetName() is empty before finding corresponding...
Nitesh Jain [Fri, 31 Mar 2017 10:55:55 +0000 (10:55 +0000)]
[LLDB][MIPS] Check if memory_info.GetName() is empty before finding corresponding module.

Reviewers: labath, clayborg

Subscribers: jaydeep, bhushan, lldb-commits, slthakur

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

llvm-svn: 299196

7 years agoFix MSVC 'not all control paths return a value' warning
Simon Pilgrim [Fri, 31 Mar 2017 10:46:47 +0000 (10:46 +0000)]
Fix MSVC 'not all control paths return a value' warning

llvm-svn: 299195

7 years agoFix signed/unsigned warning
Simon Pilgrim [Fri, 31 Mar 2017 10:45:35 +0000 (10:45 +0000)]
Fix signed/unsigned warning

llvm-svn: 299194

7 years agoStrip trailing whitespace
Simon Pilgrim [Fri, 31 Mar 2017 10:40:56 +0000 (10:40 +0000)]
Strip trailing whitespace

llvm-svn: 299193

7 years ago[OpenCL] Do not generate "kernel_arg_type_qual" metadata for non-pointer args
Egor Churaev [Fri, 31 Mar 2017 10:14:52 +0000 (10:14 +0000)]
[OpenCL] Do not generate "kernel_arg_type_qual" metadata for non-pointer args

Summary:
"kernel_arg_type_qual" metadata should contain const/volatile/restrict
tags only for pointer types to match the corresponding requirement of
the OpenCL specification.

OpenCL 2.0 spec 5.9.3 Kernel Object Queries:

CL_KERNEL_ARG_TYPE_VOLATILE is returned if the argument is a pointer
and the referenced type is declared with the volatile qualifier.
[...]
Similarly, CL_KERNEL_ARG_TYPE_CONST is returned if the argument is a
pointer and the referenced type is declared with the restrict or const
qualifier.
[...]
CL_KERNEL_ARG_TYPE_RESTRICT will be returned if the pointer type is
marked restrict.

Reviewers: Anastasia, cfe-commits

Reviewed By: Anastasia

Subscribers: bader, yaxunl

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

llvm-svn: 299192