platform/upstream/llvm.git
7 years ago[test] FileCheck-ify a test to avoid a spurious failure, NFC
Vedant Kumar [Sat, 29 Jul 2017 00:19:52 +0000 (00:19 +0000)]
[test] FileCheck-ify a test to avoid a spurious failure, NFC

The path to one of my source trees contains 'builtin' as a substring, so
this test failed. Fix it with FileCheck.

llvm-svn: 309460

7 years ago[ubsan] Diagnose invalid uses of builtins (clang)
Vedant Kumar [Sat, 29 Jul 2017 00:19:51 +0000 (00:19 +0000)]
[ubsan] Diagnose invalid uses of builtins (clang)

On some targets, passing zero to the clz() or ctz() builtins has undefined
behavior. I ran into this issue while debugging UB in __hash_table from libcxx:
the bug I was seeing manifested itself differently under -O0 vs -Os, due to a
UB call to clz() (see: libcxx/r304617).

This patch introduces a check which can detect UB calls to builtins.

llvm.org/PR26979

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

llvm-svn: 309459

7 years ago[test] Add test case for -polly-simplify. NFC.
Michael Kruse [Sat, 29 Jul 2017 00:06:06 +0000 (00:06 +0000)]
[test] Add test case for -polly-simplify. NFC.

llvm-svn: 309458

7 years agoFix update_llc_test_checks.py ARM parsing
Eli Friedman [Fri, 28 Jul 2017 23:58:24 +0000 (23:58 +0000)]
Fix update_llc_test_checks.py ARM parsing

When I tried running the script, the ARM regex parser could not parse
my code. It failed because the .Lfunc_end line has a comment at the
end of it, so this commit removes the newline at the end of the regex.

Patch by Joel Galenson!

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

llvm-svn: 309457

7 years ago[LTO] llvm-lto2: Add option to load sample profile
Tobias Edler von Koch [Fri, 28 Jul 2017 23:43:22 +0000 (23:43 +0000)]
[LTO] llvm-lto2: Add option to load sample profile

Summary:
This exposes LTO's Conf.SampleProfile as a command line option
(-lto-sample-profile-file) for testing via the llvm-lto2 utility.

Reviewers: pcc, danielcdh

Subscribers: mehdi_amini, inglorion, llvm-commits

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

llvm-svn: 309456

7 years agoRemove the unused offset field from LiveDebugValues (NFC)
Adrian Prantl [Fri, 28 Jul 2017 23:25:51 +0000 (23:25 +0000)]
Remove the unused offset field from LiveDebugValues (NFC)

Followup to r309426.
rdar://problem/33580047

llvm-svn: 309455

7 years ago[Simplify] Do not remove dependencies of phis within region stmts.
Michael Kruse [Fri, 28 Jul 2017 23:22:32 +0000 (23:22 +0000)]
[Simplify] Do not remove dependencies of phis within region stmts.

These were wrongly assumed to be phi nodes that require
MemoryKind::PHI accesses.

llvm-svn: 309454

7 years ago[VirtualInstruction] Do not iterate over a region statement's instruction list. NFC.
Michael Kruse [Fri, 28 Jul 2017 23:22:23 +0000 (23:22 +0000)]
[VirtualInstruction] Do not iterate over a region statement's instruction list. NFC.

It should be empty anyways. In this case it would even be redundant
because we just all all instructions in region statements.

llvm-svn: 309453

7 years agoRemove the unused offset field from LiveDebugVariables (NFC)
Adrian Prantl [Fri, 28 Jul 2017 23:06:50 +0000 (23:06 +0000)]
Remove the unused offset field from LiveDebugVariables (NFC)

Followup to r309426.
rdar://problem/33580047

llvm-svn: 309451

7 years agoRemove the unused offset from DBG_VALUE (NFC)
Adrian Prantl [Fri, 28 Jul 2017 23:00:45 +0000 (23:00 +0000)]
Remove the unused offset from DBG_VALUE (NFC)

Followup to r309426.
rdar://problem/33580047

llvm-svn: 309450

7 years agoRemove the unused DBG_VALUE offset parameter from GlobalISel (NFC)
Adrian Prantl [Fri, 28 Jul 2017 22:46:20 +0000 (22:46 +0000)]
Remove the unused DBG_VALUE offset parameter from GlobalISel (NFC)

Followup to r309426.
rdar://problem/33580047

llvm-svn: 309449

7 years agoUpdate the Go bindings for r309426 (remove offset from llvm.dbg.value)
Adrian Prantl [Fri, 28 Jul 2017 22:44:44 +0000 (22:44 +0000)]
Update the Go bindings for r309426 (remove offset from llvm.dbg.value)

llvm-svn: 309448

7 years agoAdded tests for i8 interleaved-load-pattern of stride=4, VF=(8, 16, 32).
Farhana Aleen [Fri, 28 Jul 2017 22:43:34 +0000 (22:43 +0000)]
Added tests for i8 interleaved-load-pattern of stride=4, VF=(8, 16, 32).

llvm-svn: 309447

7 years agoRemove the unused DBG_VALUE offset parameter from RegAllocFast (NFC)
Adrian Prantl [Fri, 28 Jul 2017 22:36:55 +0000 (22:36 +0000)]
Remove the unused DBG_VALUE offset parameter from RegAllocFast (NFC)

Followup to r309426.
rdar://problem/33580047

llvm-svn: 309446

7 years agoAdd documentation for the attribute "no-jump-tables"
Sumanth Gundapaneni [Fri, 28 Jul 2017 22:26:22 +0000 (22:26 +0000)]
Add documentation for the attribute "no-jump-tables"

llvm-svn: 309445

7 years ago[SimplifyCFG] Make the no-jump-tables attribute also disable switch lookup tables
Sumanth Gundapaneni [Fri, 28 Jul 2017 22:25:40 +0000 (22:25 +0000)]
[SimplifyCFG] Make the no-jump-tables attribute also disable switch lookup tables

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

llvm-svn: 309444

7 years ago[libFuzzer] improve support for inline-8bit-counters (make it more correct and faster)
Kostya Serebryany [Fri, 28 Jul 2017 22:00:56 +0000 (22:00 +0000)]
[libFuzzer] improve support for inline-8bit-counters (make it more correct and faster)

llvm-svn: 309443

7 years ago[Hexagon] Formatting changes, NFC
Krzysztof Parzyszek [Fri, 28 Jul 2017 21:52:21 +0000 (21:52 +0000)]
[Hexagon] Formatting changes, NFC

llvm-svn: 309442

7 years ago[Inliner] Do not apply any bonus for cold callsites.
Easwaran Raman [Fri, 28 Jul 2017 21:47:36 +0000 (21:47 +0000)]
[Inliner] Do not apply any bonus for cold callsites.

Summary:
Inlining threshold is increased by application of bonuses when the
callee has a single reachable basic block or is rich in vector
instructions. Similarly, inlining cost is reduced by applying a large
bonus when the last call to a static function is considered for
inlining. This patch disables the application of these bonuses when the
callsite or the callee is cold. The intention here is to prevent a large
cold callsite from being inlined to a non-cold caller that could prevent
the caller from being inlined. This is especially important when the
cold callsite is a last call to a static since the associated bonus is
very high.

Reviewers: chandlerc, davidxl

Subscribers: danielcdh, llvm-commits

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

llvm-svn: 309441

7 years agoTry to fix asan test on sanitizer-windows
Reid Kleckner [Fri, 28 Jul 2017 21:43:23 +0000 (21:43 +0000)]
Try to fix asan test on sanitizer-windows

llvm-svn: 309440

7 years agoRemove the unused dbg.value offset from SelectionDAG (NFC)
Adrian Prantl [Fri, 28 Jul 2017 21:27:35 +0000 (21:27 +0000)]
Remove the unused dbg.value offset from SelectionDAG (NFC)

Followup to r309426.
rdar://problem/33580047

llvm-svn: 309436

7 years ago[lit] Use a %{python} substitution to avoid relying on python being on PATH
Reid Kleckner [Fri, 28 Jul 2017 21:13:47 +0000 (21:13 +0000)]
[lit] Use a %{python} substitution to avoid relying on python being on PATH

llvm-svn: 309434

7 years agoRemove offset parameter from llvm.dbg.value intrinsics in testcase
Adrian Prantl [Fri, 28 Jul 2017 21:08:53 +0000 (21:08 +0000)]
Remove offset parameter from llvm.dbg.value intrinsics in testcase

llvm-svn: 309433

7 years ago[lit] Remove stale test inputs before running check-lit
Reid Kleckner [Fri, 28 Jul 2017 21:00:57 +0000 (21:00 +0000)]
[lit] Remove stale test inputs before running check-lit

This should fix googletest-format test failures on the clang modules
buildbots, which have a stale copy of the OneTest script in the build
directory.

llvm-svn: 309432

7 years agoReword sentence in LangRef
Adrian Prantl [Fri, 28 Jul 2017 20:44:29 +0000 (20:44 +0000)]
Reword sentence in LangRef

llvm-svn: 309431

7 years ago[compiler-rt] Add missing quotation marks to msan_compile invocation
Krzysztof Parzyszek [Fri, 28 Jul 2017 20:29:29 +0000 (20:29 +0000)]
[compiler-rt] Add missing quotation marks to msan_compile invocation

llvm-svn: 309430

7 years ago[CMake] Add SharingPtr.h to the Framework header list
Chris Bieneman [Fri, 28 Jul 2017 20:27:38 +0000 (20:27 +0000)]
[CMake] Add SharingPtr.h to the Framework header list

lldb-forward.h which is a public header uses SharingPtr, so we need to include that header as well.

llvm-svn: 309429

7 years ago[CMake] debugserver-nonui doesn't go in the framework
Chris Bieneman [Fri, 28 Jul 2017 20:27:37 +0000 (20:27 +0000)]
[CMake] debugserver-nonui doesn't go in the framework

Small change to correct the install path of the nonui debugserver.

llvm-svn: 309428

7 years agoAdopt to LLVM API change (llvm.dbg.value no longer has an offset)
Adrian Prantl [Fri, 28 Jul 2017 20:21:08 +0000 (20:21 +0000)]
Adopt to LLVM API change (llvm.dbg.value no longer has an offset)

llvm-svn: 309427

7 years agoRemove the obsolete offset parameter from @llvm.dbg.value
Adrian Prantl [Fri, 28 Jul 2017 20:21:02 +0000 (20:21 +0000)]
Remove the obsolete offset parameter from @llvm.dbg.value

There is no situation where this rarely-used argument cannot be
substituted with a DIExpression and removing it allows us to simplify
the DWARF backend. Note that this patch does not yet remove any of
the newly dead code.

rdar://problem/33580047
Differential Revision: https://reviews.llvm.org/D35951

llvm-svn: 309426

7 years ago[SLP] Allow vectorization of the instruction from the same basic blocks only, NFC.
Alexey Bataev [Fri, 28 Jul 2017 20:11:16 +0000 (20:11 +0000)]
[SLP] Allow vectorization of the instruction from the same basic blocks only, NFC.

Summary:
After some changes in SLP vectorizer we missed some additional checks to
limit the instructions for vectorization. We should not perform analysis
of the instructions if the parent of instruction is not the same as the
parent of the first instruction in the tree or it was analyzed already.

Subscribers: mzolotukhin

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

llvm-svn: 309425

7 years agoAdd end-to-end tests for overflows of byval arguments.
Matt Morehouse [Fri, 28 Jul 2017 19:52:31 +0000 (19:52 +0000)]
Add end-to-end tests for overflows of byval arguments.

Summary:
Included is one test for passing structs by value and one test for
passing C++
objects by value.

Reviewers: eugenis, vitalybuka

Reviewed By: eugenis

Subscribers: srhines, kubamracek, llvm-commits

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

llvm-svn: 309424

7 years agoAdd clear_cache implementation for ppc64. Fix buffer to meet ppc64 alignment.
Sterling Augustine [Fri, 28 Jul 2017 19:49:22 +0000 (19:49 +0000)]
Add clear_cache implementation for ppc64. Fix buffer to meet ppc64 alignment.

llvm-svn: 309423

7 years agoFix conditional tail call branch folding when both edges are the same
Reid Kleckner [Fri, 28 Jul 2017 19:48:40 +0000 (19:48 +0000)]
Fix conditional tail call branch folding when both edges are the same

The conditional tail call logic did the wrong thing when both
destinations of a conditional branch were the same:

BB#1: derived from LLVM BB %entry
    Live Ins: %EFLAGS
    Predecessors according to CFG: BB#0
        JE_1 <BB#5>, %EFLAGS<imp-use,kill>
        JMP_1 <BB#5>

BB#5: derived from LLVM BB %sw.epilog
    Predecessors according to CFG: BB#1
        TCRETURNdi64 <ga:@mergeable_conditional_tailcall>, 0, ...

We would fold the JE_1 to a TCRETURNdi64cc, and then remove our BB#5
successor. Then BB#5 would be deleted as it had no predecessors, leaving
a dangling "JMP_1 <BB#5>" reference behind to cause assertions later.

This patch checks that both conditional branch destinations are
different before doing the transform. The standard branch folding logic
is able to remove both the JMP_1 and the JE_1, and for my test case we
end up forming a better conditional tail call later.

Fixes PR33980

llvm-svn: 309422

7 years ago[VirtualInstruction] Remove assertion. NFC.
Michael Kruse [Fri, 28 Jul 2017 19:26:24 +0000 (19:26 +0000)]
[VirtualInstruction] Remove assertion. NFC.

ScopStmt::contains is currently implemented on the basis of BasicBlock
and does not take the instruction list into account. Therefore any
instruction copied by -polly-optree into another statement currently
triggers that assertion.

Remove that assertion for now. We might re-enable it when the
implementation of ScopStmt::contains changes.

llvm-svn: 309421

7 years agoRevert r308677.
Matt Morehouse [Fri, 28 Jul 2017 19:11:16 +0000 (19:11 +0000)]
Revert r308677.

Incorrect directories were created by the patch.

llvm-svn: 309420

7 years agoAMDGPU: Look through a bitcast user of an out argument
Matt Arsenault [Fri, 28 Jul 2017 19:06:16 +0000 (19:06 +0000)]
AMDGPU: Look through a bitcast user of an out argument

This allows handling of a lot more of the interesting
cases in Blender. Most of the large functions unlikely
to be inlined have this pattern.

This is a special case for what clang emits for OpenCL 3
element vectors. Annoyingly, these are emitted as
<3 x elt>* pointers, but accessed as <4 x elt>* operations.
This also needs to handle cases where a struct containing
a single vector is used.

llvm-svn: 309419

7 years agoFix comments and build messages concerning TSX
Jonathan Peyton [Fri, 28 Jul 2017 19:05:17 +0000 (19:05 +0000)]
Fix comments and build messages concerning TSX

llvm-svn: 309418

7 years ago[Value Tracking] Refactor icmp comparison logic into helper. NFC.
Chad Rosier [Fri, 28 Jul 2017 18:47:43 +0000 (18:47 +0000)]
[Value Tracking] Refactor icmp comparison logic into helper. NFC.

llvm-svn: 309417

7 years agoAMDGPU: Add pass to replace out arguments
Matt Arsenault [Fri, 28 Jul 2017 18:40:05 +0000 (18:40 +0000)]
AMDGPU: Add pass to replace out arguments

It is better to return arguments directly in registers
if we are making a call rather than introducing expensive
stack usage. In one of sample compile from one of
Blender's many kernel variants, this fires on about
~20 different functions. Future improvements may be to
recognize simple cases where the pointer is indexing a small
array. This also fails when the store to the out argument
is in a separate block from the return, which happens in
a few of the Blender functions. This should also probably
be using MemorySSA which might help with that.

I'm not sure this is correct as a FunctionPass, but
MemoryDependenceAnalysis seems to not work with
a ModulePass.

I'm also not sure where it should run.I think it should
run  before DeadArgumentElimination, so maybe either
EP_CGSCCOptimizerLate or EP_ScalarOptimizerLate.

llvm-svn: 309416

7 years ago[LVI] Constant-propagate a zero extension of the switch condition value through case...
Hiroshi Yamauchi [Fri, 28 Jul 2017 18:35:25 +0000 (18:35 +0000)]
[LVI] Constant-propagate a zero extension of the switch condition value through case edges

Summary:
LazyValueInfo currently computes the constant value of the switch condition through case edges, which allows the constant value to be propagated through the case edges.

But we have seen a case where a zero-extended value of the switch condition is used past case edges for which the constant propagation doesn't occur.

This patch adds a small logic to handle such a case in getEdgeValueLocal().

This is motivated by the Python 2.7 eval loop in PyEval_EvalFrameEx() where the lack of the constant propagation causes longer live ranges and more spill code than necessary.

With this patch, we see that the code size of PyEval_EvalFrameEx() decreases by ~5.4% and a performance test improves by ~4.6%.

Reviewers: wmi, dberlin, sanjoy

Reviewed By: sanjoy

Subscribers: davide, davidxl, llvm-commits

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

llvm-svn: 309415

7 years ago[CMake] Add Android toolchain CMake cache files.
Leo Li [Fri, 28 Jul 2017 17:40:28 +0000 (17:40 +0000)]
[CMake] Add Android toolchain CMake cache files.

Summary: Thoes files are used to build Android toolchain. D32816 makes it possible to build runtimes for targets.

Reviewers: beanz, srhines

Reviewed By: srhines

Subscribers: pirama, jroelofs, srhines, cfe-commits, mgorny

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

llvm-svn: 309407

7 years ago[sanitizers test CMake] further refactor testing CMake for tsan
George Karpenkov [Fri, 28 Jul 2017 17:38:44 +0000 (17:38 +0000)]
[sanitizers test CMake] further refactor testing CMake for tsan

TSan tests on Darwin first link all libraries into a static archive file.
With this change, the linking is done once per all architecture,
and previously the linking step was repeated per each architecture per
each add_tsan_test call.
Furthermore, the code is cleared up.

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

llvm-svn: 309406

7 years ago[sanitizer tests CMake] Factor out CMake logic for compiling sanitizer tests
George Karpenkov [Fri, 28 Jul 2017 17:32:37 +0000 (17:32 +0000)]
[sanitizer tests CMake] Factor out CMake logic for compiling sanitizer tests

Currently there's a large amount of CMake logic duplication for
compiling sanitizer tests.
If we add more sanitizers, the duplication will get even worse.

This change factors out common compilation commands into a macro
available to all sanitizers.

llvm-svn: 309405

7 years agoGlobalISel: map 128-bit values to an FPR by default.
Tim Northover [Fri, 28 Jul 2017 17:11:01 +0000 (17:11 +0000)]
GlobalISel: map 128-bit values to an FPR by default.

Eventually we may want to allow a pair of GPRs but absolutely nothing in the
entire world is ready for that yet.

llvm-svn: 309404

7 years ago[test] Fix typo in filename. NFC.
Michael Kruse [Fri, 28 Jul 2017 16:57:56 +0000 (16:57 +0000)]
[test] Fix typo in filename. NFC.

llvm-svn: 309403

7 years ago[Simplify] Fix typo in statistics output. NFC.
Michael Kruse [Fri, 28 Jul 2017 16:57:51 +0000 (16:57 +0000)]
[Simplify] Fix typo in statistics output. NFC.

llvm-svn: 309402

7 years ago[Simplify] Remove empty partial accesses first. NFC.
Michael Kruse [Fri, 28 Jul 2017 16:57:45 +0000 (16:57 +0000)]
[Simplify] Remove empty partial accesses first. NFC.

So follow-up cleanup do not need special handling for such accesses.

llvm-svn: 309401

7 years ago[lit] Dump some FileCheck inputs to try to debug some failing tests
Reid Kleckner [Fri, 28 Jul 2017 16:24:18 +0000 (16:24 +0000)]
[lit] Dump some FileCheck inputs to try to debug some failing tests

llvm-svn: 309400

7 years ago[lit] Fix shtest-format external_shell failures
Reid Kleckner [Fri, 28 Jul 2017 16:13:02 +0000 (16:13 +0000)]
[lit] Fix shtest-format external_shell failures

When using win32 cmd.exe, turn off command echoing at the beginning of
the script (@echo off).

Replace a bash shell script with a python script for the
fail_with_bad_encoding test.

llvm-svn: 309399

7 years agoAMDGPU: Annotate implicitarg.ptr usage
Matt Arsenault [Fri, 28 Jul 2017 15:52:08 +0000 (15:52 +0000)]
AMDGPU: Annotate implicitarg.ptr usage

We need to pass something to functions for this to work.
It isn't derivable just from the kernarg segment pointer
because the implicit arguments are placed after the
kernel arguments.

Also fixes missing test for the intrinsic.

llvm-svn: 309398

7 years ago[GVN] Recommit the patch "Add phi-translate support in scalarpre"
Wei Mi [Fri, 28 Jul 2017 15:47:25 +0000 (15:47 +0000)]
[GVN] Recommit the patch "Add phi-translate support in scalarpre"

Recommit after workaround the bug PR31652.

Three bugs fixed in previous recommits: The first one is to use CurrentBlock
instead of PREInstr's Parent as param of performScalarPREInsertion because
the Parent of a clone instruction may be uninitialized. The second one is stop
PRE when CurrentBlock to its predecessor is a backedge and an operand of CurInst
is defined inside of CurrentBlock. The same value defined inside of loop in last
iteration can not be regarded as available. The third one is an out-of-bound
array access in a flipped if guard.

Right now scalarpre doesn't have phi-translate support, so it will miss some
simple pre opportunities. Like the following testcase, current scalarpre cannot
recognize the last "a * b" is fully redundent because a and b used by the last
"a * b" expr are both defined by phis.

long a[100], b[100], g1, g2, g3;
__attribute__((pure)) long goo();

void foo(long a, long b, long c, long d) {

  g1 = a * b;
  if (__builtin_expect(g2 > 3, 0)) {
    a = c;
    b = d;
    g2 = a * b;
  }
  g3 = a * b;      // fully redundant.

}

The patch adds phi-translate support in scalarpre. This is only a temporary
solution before the newpre based on newgvn is available.

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

llvm-svn: 309397

7 years ago[CMake] libcompression is optional not required for debugserver
Chris Bieneman [Fri, 28 Jul 2017 15:44:16 +0000 (15:44 +0000)]
[CMake] libcompression is optional not required for debugserver

Fix a quick bug from r309395.

llvm-svn: 309396

7 years ago[CMake] Add checks for libcompression
Chris Bieneman [Fri, 28 Jul 2017 15:39:51 +0000 (15:39 +0000)]
[CMake] Add checks for libcompression

This enables libcompression when available in the CMake build system.

llvm-svn: 309395

7 years ago[CMake] Cleanup of header fixup and installation
Chris Bieneman [Fri, 28 Jul 2017 15:39:51 +0000 (15:39 +0000)]
[CMake] Cleanup of header fixup and installation

This patch does the following:

* Gets the header copy step to re-run whenever header change
* Gets the header fix-up step to re-run whenever headers are copied
* Removes lldb-private*.h headers from the installed headers

llvm-svn: 309394

7 years ago[CMake] Enable OS_LOG support on Darwin
Chris Bieneman [Fri, 28 Jul 2017 15:39:50 +0000 (15:39 +0000)]
[CMake] Enable OS_LOG support on Darwin

This gets CMake to match the Xcode project build

llvm-svn: 309393

7 years ago[CMake] Adapt to clang r309390
Chris Bieneman [Fri, 28 Jul 2017 15:39:49 +0000 (15:39 +0000)]
[CMake] Adapt to clang r309390

This removes the configuration order dependence between LLDB and Clang.

llvm-svn: 309392

7 years agoFix the order of section that are not on an order file.
Rafael Espindola [Fri, 28 Jul 2017 15:36:15 +0000 (15:36 +0000)]
Fix the order of section that are not on an order file.

They were being placed before sections that were listed.

llvm-svn: 309391

7 years ago[CMake] NFC. Add clang-tablegen-targets utility target
Chris Bieneman [Fri, 28 Jul 2017 15:33:47 +0000 (15:33 +0000)]
[CMake]  NFC. Add clang-tablegen-targets utility target

By creating this target other projects that depend on clang-generated headers (like LLDB) will no longer be order-dependent on Clang being processed by CMake first.

Also, by creating a dummy of this target in ClangConfig.cmake, projects that can build against out-of-tree clang can freely depend on the target without needing to have conditionals for if clang is in-tree or out-of-tree.

llvm-svn: 309390

7 years ago[CMake] NFC. Add intrinsics_gen target to CMake Exports
Chris Bieneman [Fri, 28 Jul 2017 15:33:35 +0000 (15:33 +0000)]
[CMake]  NFC. Add intrinsics_gen target to CMake Exports

By creating a dummy of this target in LLVMConfig.cmake, projects that can build against out-of-tree LLVM can freely depend on the target without needing to have conditionals for if LLVM is in-tree or out-of-tree.

llvm-svn: 309389

7 years agoChange INSTR_PROF_DEFAULT_NUM_VAL_PER_SITE from 8 to 16.
Dehao Chen [Fri, 28 Jul 2017 15:00:30 +0000 (15:00 +0000)]
Change INSTR_PROF_DEFAULT_NUM_VAL_PER_SITE from 8 to 16.

Summary: In the current implementation, the defaul number of values per site tracked by value profiler is 8, which is too small and could introduce inaccuracies to profile. Changing it to 16 will be able to gain more accurate value profiler.

Reviewers: davidxl, tejohnson

Reviewed By: tejohnson

Subscribers: sanjoy, llvm-commits

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

llvm-svn: 309388

7 years ago[PPCGCodeGeneration] Check that invariant load hoisting succeeded.
Siddharth Bhat [Fri, 28 Jul 2017 14:48:32 +0000 (14:48 +0000)]
[PPCGCodeGeneration] Check that invariant load hoisting succeeded.

If we fail, throw an error for now. We can gracefully handle this later.

llvm-svn: 309387

7 years agoRecommit r308327 3rd time: Add a warning for missing
Alex Lorenz [Fri, 28 Jul 2017 14:41:21 +0000 (14:41 +0000)]
Recommit r308327 3rd time: Add a warning for missing
'#pragma pack (pop)' and suspicious uses of '#pragma pack' in included files

The second recommit (r309106) was reverted because the "non-default #pragma
pack value chages the alignment of struct or union members in the included file"
warning proved to be too aggressive for external projects like Chromium
(https://bugs.chromium.org/p/chromium/issues/detail?id=749197). This recommit
makes the problematic warning a non-default one, and gives it the
-Wpragma-pack-suspicious-include warning option.

The first recommit (r308441) caused a "non-default #pragma pack value might
change the alignment of struct or union members in the included file" warning
in LLVM itself. This recommit tweaks the added warning to avoid warnings for
#includes that don't have any records that are affected by the non-default
alignment. This tweak avoids the previously emitted warning in LLVM.

Original message:

This commit adds a new -Wpragma-pack warning. It warns in the following cases:

- When a translation unit is missing terminating #pragma pack (pop) directives.
- When entering an included file if the current alignment value as determined
  by '#pragma pack' directives is different from the default alignment value.
- When leaving an included file that changed the state of the current alignment
  value.

rdar://10184173

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

llvm-svn: 309386

7 years ago[ValueTracking] Remove a number of unused arguments. NFC.
Chad Rosier [Fri, 28 Jul 2017 14:39:06 +0000 (14:39 +0000)]
[ValueTracking] Remove a number of unused arguments. NFC.

llvm-svn: 309385

7 years ago[AArch64] Standardize suffixes for LSE Atomics mnemonics (NFCI)
Joel Jones [Fri, 28 Jul 2017 14:09:24 +0000 (14:09 +0000)]
[AArch64] Standardize suffixes for LSE Atomics mnemonics (NFCI)

This NFC changeset standardizes the suffixes used for LSE Atomics
instructions.

It changes the existing suffixes - 'b', 'h', 's', 'd' - to the existing
standard 'B', 'H', 'W' and 'X'.

This changeset is the result of the code review discussion for D35319.

Patch by: steleman

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

llvm-svn: 309384

7 years agoStrip trailing whitespace. NFCI.
Simon Pilgrim [Fri, 28 Jul 2017 14:01:51 +0000 (14:01 +0000)]
Strip trailing whitespace. NFCI.

llvm-svn: 309383

7 years ago[X86] Add tests showing inability of vector non-temporal load/store intrinsic to...
Simon Pilgrim [Fri, 28 Jul 2017 13:47:02 +0000 (13:47 +0000)]
[X86] Add tests showing inability of vector non-temporal load/store intrinsic to force pointer alignment (PR33830)

Clang specifies a max type alignment of 16 bytes on darwin targets, meaning that the builtin nontemporal stores don't correctly align the loads/stores to 32 or 64 bytes when required, resulting in lowering to temporal unaligned loads/stores.

llvm-svn: 309382

7 years ago[ARM] Add the option to directly access TLS pointer
Strahinja Petrovic [Fri, 28 Jul 2017 12:54:57 +0000 (12:54 +0000)]
[ARM] Add the option to directly access TLS pointer

This patch enables choice for accessing thread local
storage pointer (like '-mtp' in gcc).

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

llvm-svn: 309381

7 years ago[clang-tidy] Expand readability-redundant-function-ptr-dereference test
Alexander Kornienko [Fri, 28 Jul 2017 12:46:08 +0000 (12:46 +0000)]
[clang-tidy] Expand readability-redundant-function-ptr-dereference test

llvm-svn: 309380

7 years ago[clang-tidy] readability-redundant-declaration: ignore friends and macros
Alexander Kornienko [Fri, 28 Jul 2017 12:46:02 +0000 (12:46 +0000)]
[clang-tidy] readability-redundant-declaration: ignore friends and macros

llvm-svn: 309379

7 years ago[clangd] Workaround for a test failure on Windows.
Ilya Biryukov [Fri, 28 Jul 2017 12:25:51 +0000 (12:25 +0000)]
[clangd] Workaround for a test failure on Windows.

Previous workaround (r308959) didn't account for a case when system drive
letter is not 'C:'.

llvm-svn: 309378

7 years ago[ScopDetect] add `-polly-ignore-func` flag to ignore functions by name.
Siddharth Bhat [Fri, 28 Jul 2017 11:47:24 +0000 (11:47 +0000)]
[ScopDetect] add `-polly-ignore-func` flag to ignore functions by name.

Ignore all functions whose name match a regex. Useful because creating a
regex that does *not* match a string is somewhat hard.

Example:
https://stackoverflow.com/questions/1240275/how-to-negate-specific-word-in-regex

llvm-svn: 309377

7 years ago[ELF] - Cleanup MapFile.cpp. NFC.
George Rimar [Fri, 28 Jul 2017 11:13:21 +0000 (11:13 +0000)]
[ELF] - Cleanup MapFile.cpp. NFC.

* Removed redundant templating.
* Added missing `static` keyword.

llvm-svn: 309376

7 years ago[X86] Add test case for PR33290
Simon Pilgrim [Fri, 28 Jul 2017 09:43:52 +0000 (09:43 +0000)]
[X86] Add test case for PR33290

llvm-svn: 309375

7 years ago[X86][AVX] Cleanup shuffle combine tests - remove old prefixes.
Simon Pilgrim [Fri, 28 Jul 2017 09:41:55 +0000 (09:41 +0000)]
[X86][AVX] Cleanup shuffle combine tests - remove old prefixes.

llvm-svn: 309374

7 years agoAdd missing namespace comment
Tobias Grosser [Fri, 28 Jul 2017 09:33:06 +0000 (09:33 +0000)]
Add missing namespace comment

llvm-svn: 309373

7 years ago[ELF] - Do not crash when ALIGN/DATA_SEGMENT_ALIGN expression used with zero value.
George Rimar [Fri, 28 Jul 2017 09:27:49 +0000 (09:27 +0000)]
[ELF] - Do not crash when ALIGN/DATA_SEGMENT_ALIGN expression used with zero value.

Previously we would crash when tried to ALIGN(0).
Patch uses value 1 instead in this case, that
looks to be consistent with GNU linkers
and reasonable and simple behavior itself.

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

llvm-svn: 309372

7 years ago[ARM] Add test to check pcs of ARM ABI runtime floating point helpers
Peter Smith [Fri, 28 Jul 2017 09:21:00 +0000 (09:21 +0000)]
[ARM] Add test to check pcs of ARM ABI runtime floating point helpers

The ARM Runtime ABI document (IHI0043) defines the AEABI floating point
helper functions in section 4.1.2 The floating-point helper functions.
The functions listed in this section must always use the base AAPCS calling
convention.

This test generates calls to all the helper functions that llvm supports
and checks that the base AAPCS calling convention has been used. We test
the equivalent of -mfloat-abi=soft, -mfloat-abi=softfp, -mfloat-abi=hardfp
with an FPU that supports single and double precision, and one that only
supports double precision.

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

llvm-svn: 309371

7 years agoclang-format: merge short case labels with trailing comments
Francois Ferrand [Fri, 28 Jul 2017 07:56:18 +0000 (07:56 +0000)]
clang-format: merge short case labels with trailing comments

Summary:
Allow merging short case labels when they actually end with a comment
(like a comment after the ``break``) and when followed by switch-level
comments (e.g. aligned with next case):

  switch(a) {
  case 0: break; // comment at end of case
  case 1: return value;
  // comment related to next case
  // comment related to next case
  case 2:
  }

Reviewers: krasimir, djasper

Reviewed By: krasimir

Subscribers: klimek, cfe-commits

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

llvm-svn: 309370

7 years agoclang-format: fix block OpeningLineIndex around preprocessor
Francois Ferrand [Fri, 28 Jul 2017 07:56:14 +0000 (07:56 +0000)]
clang-format: fix block OpeningLineIndex around preprocessor

Summary:
The current code would return an incorrect value when a preprocessor
directive is present immediately after the opening brace: this causes
the nanespace end comment fixer to break in some places, for exemple it
would not add the comment in this case:

  namespace a {
  #define FOO
  }

Fixing the computation is simple enough, but it was breaking a feature,
as it would cause comments to be added also when the namespace
declaration was dependant on conditional compilation.

To fix this, a hash of the current preprocessor stack/branches is
computed at the beginning of parseBlock(), so that we explicitely do not
store the OpeningLineIndex when the beginning and end of the block are
not in the same preprocessor conditions.

Tthe hash is computed based on the line, but this could propbably be
improved by using the actual condition, so that clang-format would be
able to match multiple identical #ifdef blocks.

Reviewers: krasimir, djasper

Reviewed By: krasimir

Subscribers: klimek, cfe-commits

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

llvm-svn: 309369

7 years ago[GPGPU] Do not require the Scop::Context to have information about all parameters
Tobias Grosser [Fri, 28 Jul 2017 06:49:44 +0000 (06:49 +0000)]
[GPGPU] Do not require the Scop::Context to have information about all parameters

llvm-svn: 309368

7 years ago[SCEV] Do not visit nodes twice in containsConstantSomewhere
Max Kazantsev [Fri, 28 Jul 2017 06:42:15 +0000 (06:42 +0000)]
[SCEV] Do not visit nodes twice in containsConstantSomewhere

This patch reworks the function that searches constants in Add and Mul SCEV expression
chains so that now it does not visit a node more than once, and also renames this function
for better correspondence between its implementation and semantics.

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

llvm-svn: 309367

7 years ago[GPGPU] Fix compilation issue with latest CUDA upgrade to i128
Tobias Grosser [Fri, 28 Jul 2017 06:38:49 +0000 (06:38 +0000)]
[GPGPU] Fix compilation issue with latest CUDA upgrade to i128

llvm-svn: 309366

7 years ago[MachineOutliner] NFC: Comment tidying
Jessica Paquette [Fri, 28 Jul 2017 05:59:30 +0000 (05:59 +0000)]
[MachineOutliner] NFC: Comment tidying

The comment on describing the suffix tree had some pruning
stuff that was out of date in it.

Also fixed some typos.

llvm-svn: 309365

7 years agoRevert rL309320 - "[OCaml] Respect CMAKE_C_FLAGS for OCaml C files"
Michal Gorny [Fri, 28 Jul 2017 04:29:20 +0000 (04:29 +0000)]
Revert rL309320 - "[OCaml] Respect CMAKE_C_FLAGS for OCaml C files"

This causes buildbot breakage for systems where OCaml files are built
with a different compiler.

llvm-svn: 309364

7 years agotest: require x86 backend
Saleem Abdulrasool [Fri, 28 Jul 2017 04:15:35 +0000 (04:15 +0000)]
test: require x86 backend

Ensure that the target is registered before using it.  Should fix the
hexagon Bots.

llvm-svn: 309363

7 years agoSupport libc++abi in addition to libstdc++
Petr Hosek [Fri, 28 Jul 2017 03:39:39 +0000 (03:39 +0000)]
Support libc++abi in addition to libstdc++

This change adds sanitizer support for LLVM's libunwind and libc++abi
as an alternative to libstdc++. This allows using the in tree version
of libunwind and libc++abi which is useful when building a toolchain
for different target.

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

llvm-svn: 309362

7 years agoSupport compiler-rt builtins
Petr Hosek [Fri, 28 Jul 2017 03:39:38 +0000 (03:39 +0000)]
Support compiler-rt builtins

This change adds support for compiler-rt builtins as an alternative
compiler runtime to libgcc.

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

llvm-svn: 309361

7 years agoMC: add support for cfi_return_column
Saleem Abdulrasool [Fri, 28 Jul 2017 03:39:19 +0000 (03:39 +0000)]
MC: add support for cfi_return_column

This adds support for the CFI pseudo-op return_column.  This specifies
the frame table column which contains the return address.

Addresses PR33953!

llvm-svn: 309360

7 years agoMC: clang-format enumeration (NFC)
Saleem Abdulrasool [Fri, 28 Jul 2017 03:39:18 +0000 (03:39 +0000)]
MC: clang-format enumeration (NFC)

This was hard to insert elements into.  clang-format it so that it is
easier.  NFC.

llvm-svn: 309359

7 years agoadd __kernel_exec macros
Jan Vesely [Fri, 28 Jul 2017 03:39:03 +0000 (03:39 +0000)]
add __kernel_exec macros

also consolidate macros into one file, and rename to clcmacros.h

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 309358

7 years agoRevert "[SCEV] Cache results of computeExitLimit"
Sanjoy Das [Fri, 28 Jul 2017 03:25:07 +0000 (03:25 +0000)]
Revert "[SCEV] Cache results of computeExitLimit"

This reverts commit r309080.  The patch needs to clear out the
ScalarEvolution::ExitLimits cache in forgetMemoizedResults.

I've replied on the commit thread for the patch with more details.

llvm-svn: 309357

7 years ago[MachineOutliner] NFC: Split up getOutliningBenefit
Jessica Paquette [Fri, 28 Jul 2017 03:21:58 +0000 (03:21 +0000)]
[MachineOutliner] NFC: Split up getOutliningBenefit

This is some more cleanup in preparation for some actual
functional changes. This splits getOutliningBenefit into
two cost functions: getOutliningCallOverhead and
getOutliningFrameOverhead. These functions return the
number of instructions that would be required to call
a specific function and the number of instructions
that would be required to construct a frame for a
specific funtion. The actual outlining benefit logic
is moved into the outliner, which calls these functions.

The goal of refactoring getOutliningBenefit is to:

- Get us closer to getting rid of the IsTailCall flag

- Further split up "target-specific" things and
"general algorithm" things

llvm-svn: 309356

7 years ago[JumpThreading] Stop falsely preserving LazyValueInfo.
Davide Italiano [Fri, 28 Jul 2017 03:10:43 +0000 (03:10 +0000)]
[JumpThreading] Stop falsely preserving LazyValueInfo.

JumpThreading claims to preserve LVI, but it doesn't preserve
the analyses which LVI holds a reference to (e.g. the Dominator).
In the current pass manager infrastructure, after JT runs, the
PM frees these analyses (including DominatorTree) but preserves
LVI.

CorrelatedValuePropagation runs immediately after and queries
a corrupted domtree, causing weird miscompiles.

This commit disables the preservation of LVI for the time being.
Eventually, we should either move LVI to a proper dependency
tracking mechanism (i.e. an analyses shouldn't hold references
to other analyses and compute them on demand if needed), or
we should teach all the passes preserving LVI to preserve the
analyses LVI depends on.

The new pass manager has a mechanism to invalidate LVI in case
one of the analyses it depends on becomes invalid, so this problem
shouldn't exist (at least not in this immediate form), but handling
of analyses holding references is still a very delicate subject.

Fixes PR33917 (and rustc).

llvm-svn: 309355

7 years agoDebugInfo: Consider a CU containing only local imported entities to be 'empty'
David Blaikie [Fri, 28 Jul 2017 03:06:25 +0000 (03:06 +0000)]
DebugInfo: Consider a CU containing only local imported entities to be 'empty'

This can come up in ThinLTO & wastes space & makes degenerate IR.

As per the added FIXME, ultimately, local imported entities should hang
off the function and that way the imported entity list on the CU can be
tested for emptiness like all the other CU lists.

(function-attached local imported entities are probably also the best
path forward for fixing how imported entities are handled both in
cross-module use (currently, while ThinLTO preserves the imported
entities, they would not get used at the imported inlined location -
only in the abstract origin that appears in the partial CU created by
the import (which isn't emitted under Fission due to cross-CU
limitations there)) and to reduce the number of points where imported
entities are emitted (they're currently emitted into every inlined
instance, concrete instance, and abstract origin - they should only go
in teh abstract origin if there is one, otherwise in the concrete
instance - but this requires lots of delayed handling and wiring up,
same as abstract variables & subprograms))

llvm-svn: 309354

7 years ago[JumpThreading] Add an option to dump LazyValueInfo after the run.
Davide Italiano [Fri, 28 Jul 2017 02:57:43 +0000 (02:57 +0000)]
[JumpThreading] Add an option to dump LazyValueInfo after the run.

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

llvm-svn: 309353

7 years agoUpdate comment in test case after r309308.
Akira Hatanaka [Fri, 28 Jul 2017 01:58:14 +0000 (01:58 +0000)]
Update comment in test case after r309308.

llvm-svn: 309352

7 years ago[sanitizer-coverage] add a run-time test for -fsanitize-coverage=inline-8bit-counter...
Kostya Serebryany [Fri, 28 Jul 2017 01:38:43 +0000 (01:38 +0000)]
[sanitizer-coverage] add a run-time test for  -fsanitize-coverage=inline-8bit-counters,pc-table

llvm-svn: 309351

7 years agoARMFrameLowering: Only set ExtraCSSpill for actually unused registers.
Matthias Braun [Fri, 28 Jul 2017 01:36:32 +0000 (01:36 +0000)]
ARMFrameLowering: Only set ExtraCSSpill for actually unused registers.

The code assumed that unclobbered/unspilled callee saved registers are
unused in the function. This is not true for callee saved registers that are
also used to pass parameters such as swiftself.

rdar://33401922

llvm-svn: 309350

7 years ago[demangler] Fix some overzealous -Wreturn-type errors
Erik Pilkington [Fri, 28 Jul 2017 01:35:14 +0000 (01:35 +0000)]
[demangler] Fix some overzealous -Wreturn-type errors

llvm-svn: 309349