platform/upstream/llvm.git
7 years agoRefactor the build{Module|Function}SimplificationPipeline to expose optimization...
Dehao Chen [Sun, 30 Jul 2017 04:55:39 +0000 (04:55 +0000)]
Refactor the build{Module|Function}SimplificationPipeline to expose optimization phase.

Summary: This is in preparation of https://reviews.llvm.org/D36052

Reviewers: chandlerc, davidxl, tejohnson

Reviewed By: chandlerc

Subscribers: sanjoy, llvm-commits

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

llvm-svn: 309500

7 years agoCodeGenModule.cpp: [PR33810][Modules] Make sure actual memory corruption before rando...
NAKAMURA Takumi [Sun, 30 Jul 2017 04:08:23 +0000 (04:08 +0000)]
CodeGenModule.cpp: [PR33810][Modules] Make sure actual memory corruption before random crash with -fmodules.

llvm-svn: 309499

7 years agoDebugInfo: Provide option for explicitly specifying the name of the DWP file
David Blaikie [Sun, 30 Jul 2017 01:34:08 +0000 (01:34 +0000)]
DebugInfo: Provide option for explicitly specifying the name of the DWP file

If you've archived the DWP file somewhere it's probably useful to be
able to just tell llvm-symbolizer where it is when you're symbolizing
stack traces from the binary.

This only provides a mechanism for specifying a single DWP file, good if
you're symbolizing a program with a single DWP file, but it's likely if
the program is dynamically linked that you might have a DWP for each
dynamic library - in which case this feature won't help (at least as
it's surfaced in llvm-symbolizer for now) - in theory it could be
extended to specify a collection of DWP files that could all be
consulted for split CU hash resolution.

llvm-svn: 309498

7 years agoMigrate PGOMemOptSizeOpt to use new OptimizationRemarkEmitter Pass
Sam Elliott [Sun, 30 Jul 2017 00:35:33 +0000 (00:35 +0000)]
Migrate PGOMemOptSizeOpt to use new OptimizationRemarkEmitter Pass

Summary:
Fixes PR33790.

This patch still needs a yaml-style test, which I shall write tomorrow

Reviewers: anemet

Reviewed By: anemet

Subscribers: anemet, llvm-commits

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

llvm-svn: 309497

7 years agoImprove readability of CXX method overrides list
Lenar Safin [Sat, 29 Jul 2017 20:42:58 +0000 (20:42 +0000)]
Improve readability of CXX method overrides list

Summary:
Separate CXX method overrides list entries with commas.

Reviewers: lhames

Reviewed By: lhames

Subscribers: llvm-commits

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

llvm-svn: 309496

7 years ago[AArch64] Tie source and destination operands for AESMC/AESIMC.
Florian Hahn [Sat, 29 Jul 2017 20:35:28 +0000 (20:35 +0000)]
[AArch64] Tie source and destination operands for AESMC/AESIMC.

Summary:
Most CPUs implementing AES fusion require instruction pairs of the form
    AESE Vn, _
    AESMC Vn, Vn
and
    AESD Vn, _
    AESIMC Vn, Vn

The constraint is added to AES(I)MC instructions which use the result of
an AES(E|D) instruction by using AES(I)MCTrr pseudo instructions, which
constraint source and destination registers to be the same.

A nice side effect of this change is that now all possible pairs are
scheduled back-to-back on the exynos-m1 for the misched-fusion-aes.ll
test case.

I had to update aes_load_store. The version I added initially was very
reduced and with the new constraint, AESE/AESMC could not be scheduled
back-to-back. I updated the test to be more realistic and still expose
the same scheduling problem as the initial test case.

Reviewers: t.p.northover, rengolin, evandro, kristof.beyls, silviu.baranga

Reviewed By: t.p.northover, evandro

Subscribers: aemerson, javed.absar, llvm-commits

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

llvm-svn: 309495

7 years ago[AArch64] Use 8 bytes as preferred function alignment on Cortex-A53.
Florian Hahn [Sat, 29 Jul 2017 20:04:54 +0000 (20:04 +0000)]
[AArch64] Use 8 bytes as preferred function alignment on Cortex-A53.

Summary:
This change gives a 0.25% speedup on execution time, a 0.82% improvement
in benchmark scores and a 0.20% increase in binary size on a Cortex-A53.
These numbers are the geomean results on a wide range of benchmarks from
the test-suite and a range of proprietary suites.

Reviewers: t.p.northover, aadg, silviu.baranga, mcrosier, rengolin

Reviewed By: rengolin

Subscribers: grimar, davide, aemerson, rengolin, javed.absar, kristof.beyls, llvm-commits

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

llvm-svn: 309494

7 years agoMC: simplify internal function call parameter
Saleem Abdulrasool [Sat, 29 Jul 2017 20:03:02 +0000 (20:03 +0000)]
MC: simplify internal function call parameter

Rather than passing along most of the parameters, pass a reference to
the MCDWARFrameInfo instead.  This makes it easier to pass additional
information about the frame to the checks.  We need to keep the extra
constructor for the Key around to allow the construction of the null and
tombstone keys.  NFC.

llvm-svn: 309493

7 years agoMC: account for the return column in the CIE key
Saleem Abdulrasool [Sat, 29 Jul 2017 20:03:00 +0000 (20:03 +0000)]
MC: account for the return column in the CIE key

If the return column is different, we cannot coalesce the CIE across the
FDEs.  Add that to the key calculation.  This ensures that we emit a
separate CIE.

llvm-svn: 309492

7 years agoRemove Debug metadata from copied instruction to prevent Module verification failure
Singapuram Sanjay Srivallabh [Sat, 29 Jul 2017 18:03:49 +0000 (18:03 +0000)]
Remove Debug metadata from copied instruction to prevent Module verification failure

Summary:
**Remove debug metadata from instruction to be copied to prevent the source file's debug metadata being copied into GPUModule and eventually failing Module verification and ASM string codegeneration.**

When copying the instruction onto the Module meant for the GPU, debug metadata attached to an instruction causes all related metadata to be pulled into the Module, including the DICompileUnit, which is not listed in llvm.dbg.cu of the Module. This fails the verification of the Module and generation of the ASM string.

The only debug metadata of the instruction, the DebugLoc, is unset by this patch.

Reviewers: grosser, bollu, Meinersbur

Reviewed By: grosser, bollu

Subscribers: pollydev

Tags: #polly

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

llvm-svn: 309490

7 years ago[Simplify] Implement write accesses coalescing.
Michael Kruse [Sat, 29 Jul 2017 16:21:16 +0000 (16:21 +0000)]
[Simplify] Implement write accesses coalescing.

Write coalescing combines write accesses that

- Write the same llvm::Value.
- Write to the same array.
- Unless they do not write anything in a statement instance (partial
  writes), write to the same element.
- There is no other access between them that accesses the same element.

This is particularly useful after DeLICM, which leaves partial writes to
disjoint domains.

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

llvm-svn: 309489

7 years ago[X86][AVX] Ensure vector non-temporal load/store intrinsics force pointer alignment...
Simon Pilgrim [Sat, 29 Jul 2017 15:33:34 +0000 (15:33 +0000)]
[X86][AVX] Ensure vector non-temporal load/store intrinsics force pointer alignment (PR33830)

Clang specifies a max type alignment of 16 bytes on darwin targets (annoyingly in the driver not via cc1), 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.

This patch casts the vectors to explicitly aligned types prior to the load/store to ensure that the require alignment is respected.

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

llvm-svn: 309488

7 years agoFix test failure without X86 backend
Hiroshi Inoue [Sat, 29 Jul 2017 15:03:31 +0000 (15:03 +0000)]
Fix test failure without X86 backend

move test/Transforms/SimplifyCFG/disable-lookup-table.ll into test/Transforms/SimplifyCFG/X86/disable-lookup-table.ll to avoid test failure when X86 backend is not enabled

llvm-svn: 309487

7 years ago[SelectionDAG][X86] CombineBT - more aggressively determine demanded bits
Simon Pilgrim [Sat, 29 Jul 2017 14:50:25 +0000 (14:50 +0000)]
[SelectionDAG][X86] CombineBT - more aggressively determine demanded bits

This patch is in 2 parts:

1 - replace combineBT's use of SimplifyDemandedBits (hasOneUse only) with SelectionDAG::GetDemandedBits to more aggressively determine the lower bits used by BT.

2 - update SelectionDAG::GetDemandedBits to support ANY_EXTEND - if the demanded bits are only in the non-extended portion, then peek through and demand from the source value and then ANY_EXTEND that if we found a match.

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

llvm-svn: 309486

7 years ago[tests] Do not emity binary bitcode to stdout in RegionInfo tests
Tobias Grosser [Sat, 29 Jul 2017 09:58:43 +0000 (09:58 +0000)]
[tests] Do not emity binary bitcode to stdout in RegionInfo tests

llvm-svn: 309485

7 years agoFix incorrect assertion condition.
Victor Leschuk [Sat, 29 Jul 2017 08:18:38 +0000 (08:18 +0000)]
Fix incorrect assertion condition.

llvm-svn: 309484

7 years ago[OCaml] Pass -D/-UNDEBUG through to ocamlc
Michal Gorny [Sat, 29 Jul 2017 08:10:24 +0000 (08:10 +0000)]
[OCaml] Pass -D/-UNDEBUG through to ocamlc

Detect [/-][DU]NDEBUG in CMAKE_C_FLAGS* and pass them through to ocamlc.
This is necessary because their value might affect visibility of dump
functions in LLVM and ocamlc uses its own compiler and flags by default.

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

llvm-svn: 309483

7 years agoUpdate the test to make windows bot pass.
Dehao Chen [Sat, 29 Jul 2017 07:01:25 +0000 (07:01 +0000)]
Update the test to make windows bot pass.

llvm-svn: 309482

7 years ago[OCaml] Install dynamic libraries in 'stubdirs' directory
Michal Gorny [Sat, 29 Jul 2017 06:46:45 +0000 (06:46 +0000)]
[OCaml] Install dynamic libraries in 'stubdirs' directory

Install the OCaml dynamic libraries in the 'stubdirs' directory rather
than the llvm subdirectory in order to fix running executables created
by ocamlc. Otherwise, the executables fail to run being unable to locate
the libraries (unless the LLVM directory is explicitly added to
LD_LIBRARY_PATH).

The staging directories are not altered since they work for our
development setup anyway, and installing into two directories would
unnecessarily make the code more complex.

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

llvm-svn: 309481

7 years ago[SCEV] Change an early exit to an assert; NFC
Sanjoy Das [Sat, 29 Jul 2017 05:32:47 +0000 (05:32 +0000)]
[SCEV] Change an early exit to an assert; NFC

llvm-svn: 309480

7 years agoupdate the test file that was omitted in r309478.
Dehao Chen [Sat, 29 Jul 2017 04:11:20 +0000 (04:11 +0000)]
update the test file that was omitted in r309478.

llvm-svn: 309479

7 years agoRefine the PGOOpt and SamplePGOSupport handling.
Dehao Chen [Sat, 29 Jul 2017 04:10:24 +0000 (04:10 +0000)]
Refine the PGOOpt and SamplePGOSupport handling.

Summary:
Now that SamplePGOSupport is part of PGOOpt, there are several places that need tweaking:
1. AddDiscriminator pass should *not* be invoked at ThinLTOBackend (as it's already invoked in the PreLink phase)
2. addPGOInstrPasses should only be invoked when either ProfileGenFile or ProfileUseFile is non-empty.
3. SampleProfileLoaderPass should only be invoked when SampleProfileFile is non-empty.
4. PGOIndirectCallPromotion should only be invoked in ProfileUse phase, or in ThinLTOBackend of SamplePGO.

Reviewers: chandlerc, tejohnson, davidxl

Reviewed By: chandlerc

Subscribers: sanjoy, mehdi_amini, eraman, llvm-commits

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

llvm-svn: 309478

7 years agoAMDGPU: Remove deadcode from AMDGPUInstPrinter
Tom Stellard [Sat, 29 Jul 2017 03:56:53 +0000 (03:56 +0000)]
AMDGPU: Remove deadcode from AMDGPUInstPrinter

Reviewers: arsenm

Reviewed By: arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, llvm-commits, t-tye

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

llvm-svn: 309477

7 years agoAMDGPU: Move INDIRECT_BASE_ADDR definition out of common files
Tom Stellard [Sat, 29 Jul 2017 03:44:07 +0000 (03:44 +0000)]
AMDGPU: Move INDIRECT_BASE_ADDR definition out of common files

Summary: This is only used by R600.

Reviewers: arsenm

Reviewed By: arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, llvm-commits, t-tye

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

llvm-svn: 309476

7 years ago[MachineOutliner] NFC: Change IsTailCall to a call class + frame class
Jessica Paquette [Sat, 29 Jul 2017 02:55:46 +0000 (02:55 +0000)]
[MachineOutliner] NFC: Change IsTailCall to a call class + frame class

This commit

- Removes IsTailCall and replaces it with a target-defined unsigned
- Refactors getOutliningCallOverhead and getOutliningFrameOverhead so that they don't use IsTailCall
- Adds a call class + frame class classification to OutlinedFunction and Candidate respectively

This accomplishes a couple things.

Firstly, we don't need the notion of *tail call* in the general outlining algorithm.

Secondly, we now can have different "outlining classes" for each candidate within a set of candidates.
This will make it easy to add new ways to outline sequences for certain targets and dynamically choose
an appropriate cost model for a sequence depending on the context that that sequence lives in.

Ultimately, this should get us closer to being able to do something like, say avoid saving the link
register when outlining AArch64 instructions.

llvm-svn: 309475

7 years ago[libc++] Hoist extern template above first use
Shoaib Meenai [Sat, 29 Jul 2017 02:54:41 +0000 (02:54 +0000)]
[libc++] Hoist extern template above first use

This function template is referenced inside class basic_string as a
friend function. The extern template declaration needs to be above that
friend declaration to actually take effect.

This is important because this function was marked as exported in
r307966, so without the extern template taking effect, it can leak into
other DSOs as a visible symbol.

llvm-svn: 309474

7 years agolit::shtest-format.py: Make write-bad-encoding.py py3-aware.
NAKAMURA Takumi [Sat, 29 Jul 2017 02:52:56 +0000 (02:52 +0000)]
lit::shtest-format.py: Make write-bad-encoding.py py3-aware.

  Traceback (most recent call last):
    File "llvm/utils/lit/tests/Inputs/shtest-format/external_shell/write-bad-encoding.py", line 5, in <module>
      sys.stdout.write(b"a line with bad encoding: \xc2.")

sys.stdout.write doesn't accept bytes but sys.stdout.buffer.write accepts.

llvm-svn: 309473

7 years agoAMDGPU: Make areMemAccessesTriviallyDisjoint more aware of segment flat
Matt Arsenault [Sat, 29 Jul 2017 01:26:21 +0000 (01:26 +0000)]
AMDGPU: Make areMemAccessesTriviallyDisjoint more aware of segment flat

Checking the encoding is insufficient since now there can
be global or scratch instructions.

llvm-svn: 309472

7 years agoAMDGPU: Teach isLegalAddressingMode about global_* instructions
Matt Arsenault [Sat, 29 Jul 2017 01:12:31 +0000 (01:12 +0000)]
AMDGPU: Teach isLegalAddressingMode about global_* instructions

Also refine the flat check to respect flat-for-global feature,
and constant fallback should check global handling, not
specifically MUBUF.

llvm-svn: 309471

7 years agoAMDGPU: Start selecting global instructions
Matt Arsenault [Sat, 29 Jul 2017 01:03:53 +0000 (01:03 +0000)]
AMDGPU: Start selecting global instructions

llvm-svn: 309470

7 years ago[Hexagon] Fix some Clang-tidy modernize-use-using and Include What You Use warnings...
Eugene Zelenko [Sat, 29 Jul 2017 00:56:56 +0000 (00:56 +0000)]
[Hexagon] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 309469

7 years ago[libcxx] [test] Change comments to say C++ instead of c++. NFC.
Stephan T. Lavavej [Sat, 29 Jul 2017 00:55:35 +0000 (00:55 +0000)]
[libcxx] [test] Change comments to say C++ instead of c++. NFC.

This makes them consistent (many comments already used uppercase).

The special REQUIRES, UNSUPPORTED, and XFAIL comments are excluded from this change.

llvm-svn: 309468

7 years ago[libcxx] [test] The entire file futures.shared_future/wait_until.pass.cpp was indente...
Stephan T. Lavavej [Sat, 29 Jul 2017 00:55:27 +0000 (00:55 +0000)]
[libcxx] [test] The entire file futures.shared_future/wait_until.pass.cpp was indented by 1 space. NFC.

llvm-svn: 309467

7 years ago[libcxx] [test] In func.wrap.func.con/alloc_F.pass.cpp, fix REQUIRES whitespace....
Stephan T. Lavavej [Sat, 29 Jul 2017 00:55:25 +0000 (00:55 +0000)]
[libcxx] [test] In func.wrap.func.con/alloc_F.pass.cpp, fix REQUIRES whitespace. NFC.

llvm-svn: 309466

7 years ago[libcxx] [test] Make files consistently end with newlines, NFC.
Stephan T. Lavavej [Sat, 29 Jul 2017 00:55:22 +0000 (00:55 +0000)]
[libcxx] [test] Make files consistently end with newlines, NFC.

llvm-svn: 309465

7 years ago[libcxx] [test] Untabify, NFC.
Stephan T. Lavavej [Sat, 29 Jul 2017 00:55:10 +0000 (00:55 +0000)]
[libcxx] [test] Untabify, NFC.

llvm-svn: 309464

7 years ago[libcxx] [test] Strip trailing whitespace, NFC.
Stephan T. Lavavej [Sat, 29 Jul 2017 00:54:49 +0000 (00:54 +0000)]
[libcxx] [test] Strip trailing whitespace, NFC.

llvm-svn: 309463

7 years ago[llvm] Update MachOObjectFile::exports interface
Alexander Shaposhnikov [Sat, 29 Jul 2017 00:30:45 +0000 (00:30 +0000)]
[llvm] Update MachOObjectFile::exports interface

This diff removes the second argument of the method MachOObjectFile::exports.
In all in-tree uses this argument is equal to "this" and
without this argument the interface seems to be cleaner.

Test plan: make check-all

llvm-svn: 309462

7 years ago[ubsan] Diagnose invalid uses of builtins (compiler-rt)
Vedant Kumar [Sat, 29 Jul 2017 00:20:02 +0000 (00:20 +0000)]
[ubsan] Diagnose invalid uses of builtins (compiler-rt)

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

llvm-svn: 309461

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