platform/upstream/llvm.git
7 years ago[LV] Move first order recurrence test to common folder. NFC
Anna Thomas [Tue, 11 Apr 2017 18:31:42 +0000 (18:31 +0000)]
[LV] Move first order recurrence test to common folder. NFC

llvm-svn: 299969

7 years ago[libFuzzer] fix type in signal name.
Vitaly Buka [Tue, 11 Apr 2017 18:20:05 +0000 (18:20 +0000)]
[libFuzzer] fix type in signal name.

Fixes PR32576.

Patch by Jakub Zawadzki.

llvm-svn: 299968

7 years agollvm-lto2: Move the LTO::run() action behind a subcommand.
Peter Collingbourne [Tue, 11 Apr 2017 18:12:00 +0000 (18:12 +0000)]
llvm-lto2: Move the LTO::run() action behind a subcommand.

Move LTO::run() to a "run" subcommand so that we can introduce new subcommands
for testing different parts of the LTO implementation.

This doesn't use llvm::cl subcommands because it doesn't appear to be currently
possible to pass an argument not associated with a subcommand to a subcommand
(e.g. -lto-use-new-pm, -mcpu=yonah).

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

llvm-svn: 299967

7 years ago[InstCombine] Use ConstantExpr::getBinOpIdentity to implement getIdentityValue.
Craig Topper [Tue, 11 Apr 2017 17:42:40 +0000 (17:42 +0000)]
[InstCombine] Use ConstantExpr::getBinOpIdentity to implement getIdentityValue.

This removes a TODO in getIdentityValue and may allow some transforms to occur earlier. But I was unable to find any transforms we didn't already handle.

llvm-svn: 299966

7 years ago[OpenCL] Map default address space to alloca address space
Yaxun Liu [Tue, 11 Apr 2017 17:24:23 +0000 (17:24 +0000)]
[OpenCL] Map default address space to alloca address space

For OpenCL, the private address space qualifier is 0 in AST. Before this change, 0 address space qualifier
is always mapped to target address space 0. As now target private address space is specified by
alloca address space in data layout, address space qualifier 0 needs to be mapped to alloca addr space specified by the data layout.

This change has no impact on targets whose alloca addr space is 0.

With contributions from Matt Arsenault, Tony Tye and Wen-Heng (Jack) Chung

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

llvm-svn: 299965

7 years ago[AMDGPU] Add A5 to data layout for amdgiz environment
Yaxun Liu [Tue, 11 Apr 2017 17:18:13 +0000 (17:18 +0000)]
[AMDGPU] Add A5 to data layout for amdgiz environment

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

llvm-svn: 299964

7 years agoImplement LWG#2873: 'Add noexcept to several shared_ptr related functions' This issue...
Marshall Clow [Tue, 11 Apr 2017 17:08:53 +0000 (17:08 +0000)]
Implement LWG#2873: 'Add noexcept to several shared_ptr related functions' This issue missed a couple, so I added those as well (see LWG#2942)

llvm-svn: 299963

7 years ago[ASTPrinter] Print nested name specifiers for out-of-line functions
Alex Lorenz [Tue, 11 Apr 2017 16:46:03 +0000 (16:46 +0000)]
[ASTPrinter] Print nested name specifiers for out-of-line functions

rdar://31501863

llvm-svn: 299962

7 years agoAdd the definition of P in the clang tidy example
Sylvestre Ledru [Tue, 11 Apr 2017 16:28:15 +0000 (16:28 +0000)]
Add the definition of P in the clang tidy example

llvm-svn: 299961

7 years agoRevert 299954 : test failure needs to be fixed
Xinliang David Li [Tue, 11 Apr 2017 16:27:26 +0000 (16:27 +0000)]
Revert 299954 : test failure needs to be fixed

llvm-svn: 299960

7 years agoRevert 299953 : test failure needs to be fixed
Xinliang David Li [Tue, 11 Apr 2017 16:27:20 +0000 (16:27 +0000)]
Revert 299953 : test failure needs to be fixed

llvm-svn: 299959

7 years ago[PDB] Emit index/offset pairs for TPI and IPI streams
Reid Kleckner [Tue, 11 Apr 2017 16:26:15 +0000 (16:26 +0000)]
[PDB] Emit index/offset pairs for TPI and IPI streams

Summary:
This lets PDB readers lookup type record data by type index in O(log n)
time. It also enables makes `cvdump -t` work on PDBs produced by LLD.
cvdump will not dump a PDB that doesn't have an index-to-offset table.

The table is sorted by type index, and has an entry every 8KB. Looking
up a type record by index is a binary search of this table, followed by
a scan of at most 8KB.

Reviewers: ruiu, zturner, inglorion

Subscribers: llvm-commits

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

llvm-svn: 299958

7 years ago[lsan] Fix typo in test/lsan/lit.common.cfg
Maxim Ostapenko [Tue, 11 Apr 2017 16:22:19 +0000 (16:22 +0000)]
[lsan] Fix typo in test/lsan/lit.common.cfg

llvm-svn: 299957

7 years agoRevert temporarily D29877 "Warn about unused static file scope function template...
Vassil Vassilev [Tue, 11 Apr 2017 16:05:23 +0000 (16:05 +0000)]
Revert temporarily D29877 "Warn about unused static file scope function template declarations."

We need to address cases (breaking libc++) such as

template <class _Up> static int __test(...);

template<typename _Tp>
auto v = __test<_Tp>(0);

llvm-svn: 299956

7 years agorevert r299851 - [InstCombine] fix matching of or-of-icmps constants (PR32524)
Sanjay Patel [Tue, 11 Apr 2017 15:57:32 +0000 (15:57 +0000)]
revert r299851 - [InstCombine] fix matching of or-of-icmps constants (PR32524)

This is a candidate culprit for multiple bot fails, so reverting pending investigation.

llvm-svn: 299955

7 years ago[Profile] PE binary coverage bug fix
Xinliang David Li [Tue, 11 Apr 2017 15:51:39 +0000 (15:51 +0000)]
[Profile] PE binary coverage bug fix

PR/32584

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

llvm-svn: 299954

7 years ago[Profile] PE binary coverage bug fix
Xinliang David Li [Tue, 11 Apr 2017 15:51:32 +0000 (15:51 +0000)]
[Profile] PE binary coverage bug fix

PR/32584

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

llvm-svn: 299953

7 years ago[clang-format] Recognize Java logical shift assignment operator
Nico Weber [Tue, 11 Apr 2017 15:50:04 +0000 (15:50 +0000)]
[clang-format] Recognize Java logical shift assignment operator

At present, clang-format mangles Java containing logical right shift operators
('>>>=' or '>>>'), splitting them in two, resulting in invalid code:

 public class Minimal {
   public void func(String args) {
     int i = 42;
-    i >>>= 1;
+    i >> >= 1;
     return i;
   }
 }

This adds both forms of logical right shift to the FormatTokenLexer, so
clang-format won't attempt to split them and insert bogus whitespace.

https://reviews.llvm.org/D31652
Patch from Richard Bradfield <bradfier@fstab.me>!

llvm-svn: 299952

7 years agoFix PR13910: Don't warn that __builtin_unreachable() is unreachable
Alex Lorenz [Tue, 11 Apr 2017 15:36:06 +0000 (15:36 +0000)]
Fix PR13910: Don't warn that __builtin_unreachable() is unreachable

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

llvm-svn: 299951

7 years ago[Parser][ObjC++] Improve diagnostics and recovery when C++ keywords are used
Alex Lorenz [Tue, 11 Apr 2017 15:01:53 +0000 (15:01 +0000)]
[Parser][ObjC++] Improve diagnostics and recovery when C++ keywords are used
as identifiers in Objective-C++

This commit improves the 'expected identifier' errors that are presented when a
C++ keyword is used as an identifier in Objective-C++ by mentioning that this is
a C++ keyword in the diagnostic message. It also improves the error recovery:
the parser will now treat the C++ keywords as identifiers to prevent unrelated
parsing errors.

rdar://20626062

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

llvm-svn: 299950

7 years agoModule::getOrInsertFunction is using C-style vararg instead of variadic templates.
Serge Guelton [Tue, 11 Apr 2017 15:01:18 +0000 (15:01 +0000)]
Module::getOrInsertFunction is using C-style vararg instead of variadic templates.

From a user prospective, it forces the use of an annoying nullptr to mark the end of the vararg, and there's not type checking on the arguments.
The variadic template is an obvious solution to both issues.

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

llvm-svn: 299949

7 years agoReapply "Enable LSan for arm Linux"
Maxim Ostapenko [Tue, 11 Apr 2017 14:58:26 +0000 (14:58 +0000)]
Reapply "Enable LSan for arm Linux"

This patch reapplies r299923 with typo fixed in BLX macros.

llvm-svn: 299948

7 years agoRemove unused functions. Remove static qualifier from functions in header files....
Vassil Vassilev [Tue, 11 Apr 2017 14:55:32 +0000 (14:55 +0000)]
Remove unused functions. Remove static qualifier from functions in header files. NFC.

llvm-svn: 299947

7 years ago[AVR] Migrate to new MCAsmBackend applyFixup
Jonathan Roelofs [Tue, 11 Apr 2017 14:51:49 +0000 (14:51 +0000)]
[AVR] Migrate to new MCAsmBackend applyFixup

https://reviews.llvm.org/D31875

Patch by Leslie Zhai!

llvm-svn: 299946

7 years ago[ARM] Refactor Thumb2 sat instructions
Sam Parker [Tue, 11 Apr 2017 14:42:08 +0000 (14:42 +0000)]
[ARM] Refactor Thumb2 sat instructions

Refactor the USAT, SSAT, USAT16 and SSAT16 instruction descriptions
for Thumb2.

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

llvm-svn: 299945

7 years ago[GVNHoist] Re-enable GVNHoist by default
Geoff Berry [Tue, 11 Apr 2017 14:36:30 +0000 (14:36 +0000)]
[GVNHoist] Re-enable GVNHoist by default

Turn GVNHoist back on by default now that PR32153 has been fixed.

llvm-svn: 299944

7 years agoRevert r299923, it doesn't build in bootstrap builds.
Nico Weber [Tue, 11 Apr 2017 14:28:49 +0000 (14:28 +0000)]
Revert r299923, it doesn't build in bootstrap builds.

FAILED: lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.arm.dir/sanitizer_linux.cc.o
lib/sanitizer_common/sanitizer_linux.cc:1340:24: error: invalid instruction
                       BLX(ip)
                       ^
lib/sanitizer_common/sanitizer_linux.cc:1313:19: note: expanded from macro 'BLX'
#  define BLX(R) "mov lr, pc; bx" #R "\n"
                  ^
<inline asm>:6:13: note: instantiated into assembly here
mov lr, pc; bxip
            ^~~~

llvm-svn: 299943

7 years ago[libc++] Fix unknown pragma warning on MSVC
Ben Craig [Tue, 11 Apr 2017 14:06:39 +0000 (14:06 +0000)]
[libc++] Fix unknown pragma warning on MSVC

llvm-svn: 299942

7 years agoMark P0599 as complete. It was implemented in r298573
Marshall Clow [Tue, 11 Apr 2017 14:04:03 +0000 (14:04 +0000)]
Mark P0599 as complete. It was implemented in r298573

llvm-svn: 299941

7 years agoThis patch causes the installation of headers for the sanitizer and/or xray to be...
Catherine Moore [Tue, 11 Apr 2017 13:45:05 +0000 (13:45 +0000)]
This patch causes the installation of headers for the sanitizer and/or xray to be disabled when COMPILER_RT_BUILD_SANITIZERS=OFF and/or COMPILER_RT_BUILD_XRAY=OFF.

Reviewer: dberris

Subscribers: dberris, mgorny, llvm-commits, clm

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

llvm-svn: 299940

7 years ago[SDAG] Factor CandidateMatch check into lambda. NFC.
Nirav Dave [Tue, 11 Apr 2017 13:41:19 +0000 (13:41 +0000)]
[SDAG] Factor CandidateMatch check into lambda. NFC.

llvm-svn: 299939

7 years ago[SDAG] Factor ChainMerge into helper function NFCI.
Nirav Dave [Tue, 11 Apr 2017 13:41:17 +0000 (13:41 +0000)]
[SDAG] Factor ChainMerge into helper function NFCI.

llvm-svn: 299938

7 years ago[SDAG] Reorder expensive StoreMerge Check after cheaper one. NFC
Nirav Dave [Tue, 11 Apr 2017 13:41:16 +0000 (13:41 +0000)]
[SDAG] Reorder expensive StoreMerge Check after cheaper one. NFC

llvm-svn: 299937

7 years ago[StripDeadDebug/DIFinder] Track inlined SPs
Keno Fischer [Tue, 11 Apr 2017 13:32:11 +0000 (13:32 +0000)]
[StripDeadDebug/DIFinder] Track inlined SPs

Summary:
In rL299692 I improved strip-dead-debug-info's ability to drop CUs that are not
referenced from the current module. However, in doing so I neglected to realize
that some SPs could be referenced entirely from inlined functions. It appears
I was not the only one to make this mistake, because DebugInfoFinder, doesn't
find those SPs either. Fix this in DebugInfoFinder and then use that to make
sure not to drop those CUs in strip-dead-debug-info.

Reviewers: aprantl

Reviewed By: aprantl

Subscribers: llvm-commits

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

llvm-svn: 299936

7 years ago[clangd] Implement item kind for completion results
Krasimir Georgiev [Tue, 11 Apr 2017 13:27:15 +0000 (13:27 +0000)]
[clangd] Implement item kind for completion results

Summary: The patch implements the conversion method from CXCursorKind to clangd::CompletionItemKind.
Contributed by stanionascu!

Reviewers: cfe-commits, bkramer, krasimir

Reviewed By: krasimir

Tags: #clang-tools-extra

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

llvm-svn: 299935

7 years agoAdd missing annotation to TestDataFormatterUnordered
Pavel Labath [Tue, 11 Apr 2017 12:26:33 +0000 (12:26 +0000)]
Add missing annotation to TestDataFormatterUnordered

llvm-svn: 299934

7 years agoRemove Plugins/Process/POSIX from include_directories
Pavel Labath [Tue, 11 Apr 2017 12:26:25 +0000 (12:26 +0000)]
Remove Plugins/Process/POSIX from include_directories

Summary:
The files there can always be referred to using their full path, which
is what most of the code has been doing already, so this makes the
situation more consistent. Also fix the the code in the FreeBSD plugin
to use the new paths.

Reviewers: eugene, emaste

Subscribers: lldb-commits, kettenis, mgorny, krytarowski

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

llvm-svn: 299933

7 years agoAdd MachineRegionInfoPassID to Passes.h.
Jan Sjodin [Tue, 11 Apr 2017 11:40:55 +0000 (11:40 +0000)]
Add MachineRegionInfoPassID to Passes.h.

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

llvm-svn: 299932

7 years agoGlobalISel: Allow legalizing G_FADD to a libcall
Diana Picus [Tue, 11 Apr 2017 10:52:34 +0000 (10:52 +0000)]
GlobalISel: Allow legalizing G_FADD to a libcall

Use the same handling in the generic legalizer code as for the other
libcalls (G_FREM, G_FPOW).

Enable it on ARM for float and double so we can test it.

llvm-svn: 299931

7 years agoWarn about unused static file scope function template declarations.
Vassil Vassilev [Tue, 11 Apr 2017 10:13:54 +0000 (10:13 +0000)]
Warn about unused static file scope function template declarations.

Reviewed by Richard Smith (D29877)!

llvm-svn: 299930

7 years ago[GlobalISel] LegalizerInfo: Enable legalization of non-power-of-2 types
Volkan Keles [Tue, 11 Apr 2017 10:10:14 +0000 (10:10 +0000)]
[GlobalISel] LegalizerInfo: Enable legalization of non-power-of-2 types

Summary: Legalize only if the type is marked as Legal or Custom. If not, return Unsupported as LegalizerHelper is not able to handle non-power-of-2 types right now.

Reviewers: qcolombet, aditya_nandakumar, dsanders, t.p.northover, kristof.beyls, javed.absar, ab

Reviewed By: kristof.beyls, ab

Subscribers: dberris, rovka, igorb, llvm-commits

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

llvm-svn: 299929

7 years agoRevert "Turn some C-style vararg into variadic templates"
Diana Picus [Tue, 11 Apr 2017 10:07:12 +0000 (10:07 +0000)]
Revert "Turn some C-style vararg into variadic templates"

This reverts commit r299925 because it broke the buildbots. See e.g.
http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15/builds/6008

llvm-svn: 299928

7 years ago[clang-format] Handle NSString literals by merging tokens.
Alexander Kornienko [Tue, 11 Apr 2017 09:55:00 +0000 (09:55 +0000)]
[clang-format] Handle NSString literals by merging tokens.

Summary:
This fixes a few outstanding bugs:
  * incorrect breaking of NSString literals containing double-width characters;
  * inconsistent formatting of ObjC dictionary literals containing NSString
    literals;
  * AlwaysBreakBeforeMultilineStrings ignoring implicitly-concatenated NSString
    literals.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 299927

7 years ago[SelectionDAG] Check CALLSEQ_BEGIN nodes in DelayForLiveRegs
Sam Parker [Tue, 11 Apr 2017 08:43:32 +0000 (08:43 +0000)]
[SelectionDAG] Check CALLSEQ_BEGIN nodes in DelayForLiveRegs

A fix for the bug reported in PR30911.

The issue arises when multiple CALLSEQ_BEGIN nodes are unscheduled as
the last node to be unscheduled will gain access to the CallResource
register. But when a node is being picked, only CALLSEQ_END nodes are
checked against the CallResource and have their chains evaluated.
This then means that other CALLSEQ_BEGIN nodes can be scheduled
before the existing call sequence has been finalised. This patch adds
a check against the FrameSetup nodes in DelayForLiveRegs to prevent
this from happening.

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

llvm-svn: 299926

7 years agoTurn some C-style vararg into variadic templates
Serge Guelton [Tue, 11 Apr 2017 08:36:52 +0000 (08:36 +0000)]
Turn some C-style vararg into variadic templates

Module::getOrInsertFunction is using C-style vararg instead of
variadic templates.

From a user prospective, it forces the use of an annoying nullptr
to mark the end of the vararg, and there's not type checking on the
arguments. The variadic template is an obvious solution to both
issues.

llvm-svn: 299925

7 years agoSimplify the code and remove dead code
Sylvestre Ledru [Tue, 11 Apr 2017 08:21:27 +0000 (08:21 +0000)]
Simplify the code and remove dead code

Summary: Fix coverity cid 1374240

Reviewers: dberlin

Reviewed By: dberlin

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

llvm-svn: 299924

7 years ago[lsan] Enable LSan for arm Linux
Maxim Ostapenko [Tue, 11 Apr 2017 08:13:38 +0000 (08:13 +0000)]
[lsan] Enable LSan for arm Linux

This patch enables LSan for arm Linux.

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

llvm-svn: 299923

7 years ago[XRay][compiler-rt] Add support for TSC emulation for x86_64 to xray_fdr_logging.cc
Douglas Yung [Tue, 11 Apr 2017 07:45:16 +0000 (07:45 +0000)]
[XRay][compiler-rt] Add support for TSC emulation for x86_64 to xray_fdr_logging.cc

Previously in r297800, a work-around was created to use TSC emulation on x86_64 when RDTSCP was not available on the host. A similar change was needed in the file xray_fdr_logging.cc which this patch ports over to that file.

Eventually the code should be refactored as there will be 3 locations with the same code, but that can be done as a separate step. This patch is just to keep the test from failing on my machine due to an illegal instruction since RDTSCP is not available on my x86_64 linux VM.

Reviewers: dberris

Subscribers: llvm-commits

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

llvm-svn: 299922

7 years ago[lsan] Enable LSan on arm Linux, clang part
Maxim Ostapenko [Tue, 11 Apr 2017 07:22:11 +0000 (07:22 +0000)]
[lsan] Enable LSan on arm Linux, clang part

This is a compiler part of https://reviews.llvm.org/D29586. Enable LSan on arm Linux.

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

llvm-svn: 299921

7 years agoAdd more examples to clang tidy checkers
Sylvestre Ledru [Tue, 11 Apr 2017 07:10:48 +0000 (07:10 +0000)]
Add more examples to clang tidy checkers

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 299920

7 years agoAdd more examples to clang-format configuration
Sylvestre Ledru [Tue, 11 Apr 2017 07:07:05 +0000 (07:07 +0000)]
Add more examples to clang-format configuration

Reviewers: djasper

Reviewed By: djasper

Subscribers: Eugene.Zelenko, klimek, cfe-commits

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

llvm-svn: 299919

7 years ago[IR] Fix a typo in a comment. NFC
Craig Topper [Tue, 11 Apr 2017 06:41:55 +0000 (06:41 +0000)]
[IR] Fix a typo in a comment. NFC

llvm-svn: 299918

7 years ago[InstCombine] Refinement of r299915. Only consider a ConstantVector for Neg if all...
Craig Topper [Tue, 11 Apr 2017 06:32:48 +0000 (06:32 +0000)]
[InstCombine] Refinement of r299915. Only consider a ConstantVector for Neg if all the elements are Undef or ConstantInt.

llvm-svn: 299917

7 years ago[XRay][compiler-rt] Remove the xray_fdr_log_printer_tool
Dean Michael Berris [Tue, 11 Apr 2017 06:04:08 +0000 (06:04 +0000)]
[XRay][compiler-rt] Remove the xray_fdr_log_printer_tool

Summary:
We can move this functionality into LLVM's tools instead, as it no
longer is strictly required for the compiler-rt testing infrastructure.
It also is blocking the successful bootstrapping of the clang compiler
due to a missing virtual destructor in one of the flag parsing library.

Since this binary isn't critical for the XRay runtime testing effort
anymore (yet), we remove it in the meantime with the hope of moving the
functionality in LLVM proper instead.

Reviewers: kpw, pelikan, rnk, seurer, eugenis

Subscribers: llvm-commits, mgorny

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

llvm-svn: 299916

7 years ago[InstCombine] Support weird size element types in dyn_castNegVal.
Craig Topper [Tue, 11 Apr 2017 05:42:47 +0000 (05:42 +0000)]
[InstCombine] Support weird size element types in dyn_castNegVal.

llvm-svn: 299915

7 years agoExploit BasicBlock::getModule to shorten code
Tobias Grosser [Tue, 11 Apr 2017 04:59:13 +0000 (04:59 +0000)]
Exploit BasicBlock::getModule to shorten code

Suggested-by: Roman Gareev <gareevroman@gmail.com>
llvm-svn: 299914

7 years agoSAdjust to recent change in constructor definition of AllocaInst
Tobias Grosser [Tue, 11 Apr 2017 04:23:38 +0000 (04:23 +0000)]
SAdjust to recent change in constructor definition of AllocaInst

llvm-svn: 299913

7 years ago[LoopUnswitch] Fix a test case
Sanjoy Das [Tue, 11 Apr 2017 04:11:47 +0000 (04:11 +0000)]
[LoopUnswitch] Fix a test case

(h/t to Chandler for pointing this out)

The test in question was not at all testing what it was supposed to
test.  We do not //care// about placing `!make.implicit` in inner
constant branch (since it will be folded away anyway).  We care about
placing `!make.implicit` in the outer branch that switches between
either version of the loop.

Having said that, it is _correct_ to leave behind the `!make.implicit`
in the inner branch, but there is no need to do so.

llvm-svn: 299912

7 years ago[LICM] Hoist fp division from the loops and replace by a reciprocal
Hal Finkel [Tue, 11 Apr 2017 02:22:54 +0000 (02:22 +0000)]
[LICM] Hoist fp division from the loops and replace by a reciprocal

When allowed, we can hoist a division out of a loop in favor of a
multiplication by the reciprocal. Fixes PR32157.

Patch by vit9696!

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

llvm-svn: 299911

7 years ago[PowerPC] multiply-with-overflow might use the CTR register
Hal Finkel [Tue, 11 Apr 2017 02:03:17 +0000 (02:03 +0000)]
[PowerPC] multiply-with-overflow might use the CTR register

Check the legality of ISD::[US]MULO to see whether
Intrinsic::[us]mul_with_overflow will legalize into a function call (and, thus,
will use the CTR register).  Fixes PR32485.

Patch by Tim Neumann!

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

llvm-svn: 299910

7 years agoFix a C++03 failure
Marshall Clow [Tue, 11 Apr 2017 01:54:48 +0000 (01:54 +0000)]
Fix a C++03 failure

llvm-svn: 299909

7 years ago[bugpoint] Also remove comdat's from externalized GVs
Hal Finkel [Tue, 11 Apr 2017 00:18:42 +0000 (00:18 +0000)]
[bugpoint] Also remove comdat's from externalized GVs

We were removing comdats from externalized functions (function declarations
can't be comdat), but were not doing the same for variable. Failure to do this
would cause bugpoint to fail ("Declaration may not be in a Comdat!").

llvm-svn: 299908

7 years agoRemove some trigraphs that GCC was complaining about
Marshall Clow [Tue, 11 Apr 2017 00:18:28 +0000 (00:18 +0000)]
Remove some trigraphs that GCC was complaining about

llvm-svn: 299907

7 years ago[IR] Sink some AttributeListImpl methods out of headers NFC
Reid Kleckner [Tue, 11 Apr 2017 00:16:00 +0000 (00:16 +0000)]
[IR] Sink some AttributeListImpl methods out of headers NFC

llvm-svn: 299906

7 years agoUpdate for alloca construction changes
Matt Arsenault [Tue, 11 Apr 2017 00:12:58 +0000 (00:12 +0000)]
Update for alloca construction changes

llvm-svn: 299905

7 years agoRevert "NewGVN: Don't propagate over phi backedges where undef causes us to have...
Daniel Berlin [Tue, 11 Apr 2017 00:07:26 +0000 (00:07 +0000)]
Revert "NewGVN: Don't propagate over phi backedges where undef causes us to have >1 value."
It's not ready yet this was an accidental commit :(

This reverts r299903

llvm-svn: 299904

7 years agoNewGVN: Don't propagate over phi backedges where undef causes us to have >1 value.
Daniel Berlin [Tue, 11 Apr 2017 00:02:38 +0000 (00:02 +0000)]
NewGVN: Don't propagate over phi backedges where undef causes us to have >1 value.

Fixes PR 32607.

llvm-svn: 299903

7 years agodocs: Use the term "whole-program devirtualization" instead of "virtual function...
Peter Collingbourne [Mon, 10 Apr 2017 23:54:28 +0000 (23:54 +0000)]
docs: Use the term "whole-program devirtualization" instead of "virtual function call optimization".

The former term is probably more familiar to users. Also add references to
the command line flags used to enable the features described in the doc.

llvm-svn: 299902

7 years agoFix PR#32605: common_type<T> is not SFINAE-friendly
Marshall Clow [Mon, 10 Apr 2017 23:47:47 +0000 (23:47 +0000)]
Fix PR#32605: common_type<T> is not SFINAE-friendly

llvm-svn: 299901

7 years agoRemove AttributeSetNode::get(AttributeList, unsigned) and sink constructor
Reid Kleckner [Mon, 10 Apr 2017 23:46:08 +0000 (23:46 +0000)]
Remove AttributeSetNode::get(AttributeList, unsigned) and sink constructor

The getter was equivalent to AttributeList::getAttributes(unsigned),
which seems like a better way to express getting the AttributeSet for a
given index. This static helper was only used in one place anyway.

The constructor doesn't benefit from inlining and doesn't need to be in
a header.

llvm-svn: 299900

7 years agoReland "[IR] Make AttributeSetNode public, avoid temporary AttributeList copies"
Reid Kleckner [Mon, 10 Apr 2017 23:31:05 +0000 (23:31 +0000)]
Reland "[IR] Make AttributeSetNode public, avoid temporary AttributeList copies"

This re-lands r299875.

I introduced a bug in Clang code responsible for replacing K&R, no
prototype declarations with a real function definition with a prototype.
The bug was here:

       // Collect any return attributes from the call.
  -    if (oldAttrs.hasAttributes(llvm::AttributeList::ReturnIndex))
  -      newAttrs.push_back(llvm::AttributeList::get(newFn->getContext(),
  -                                                  oldAttrs.getRetAttributes()));
  +    newAttrs.push_back(oldAttrs.getRetAttributes());

Previously getRetAttributes() carried AttributeList::ReturnIndex in its
AttributeList. Now that we return the AttributeSetNode* directly, it no
longer carries that index, and we call this overload with a single node:
  AttributeList::get(LLVMContext&, ArrayRef<AttributeSetNode*>)

That aborted with an assertion on x86_32 targets. I added an explicit
triple to the test and added CHECKs to help find issues like this in the
future sooner.

llvm-svn: 299899

7 years agoUpdate for alloca construction changes
Matt Arsenault [Mon, 10 Apr 2017 23:27:53 +0000 (23:27 +0000)]
Update for alloca construction changes

llvm-svn: 299898

7 years ago[ARM, x86] add tests to show possible improvement for bool math; NFC
Sanjay Patel [Mon, 10 Apr 2017 23:26:31 +0000 (23:26 +0000)]
[ARM, x86] add tests to show possible improvement for bool math; NFC

llvm-svn: 299897

7 years ago[PPC64, Sanitizers] Proper stack frame for the thread spawned in internal_clone
Alex Shlyapnikov [Mon, 10 Apr 2017 23:24:50 +0000 (23:24 +0000)]
[PPC64, Sanitizers] Proper stack frame for the thread spawned in internal_clone

Summary:
Set up the proper stack frame for the thread spawned in internal_clone,
the current code does not follow ABI (and causes SEGV trying to use this
malformed frame).

Reviewers: wschmidt

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 299896

7 years ago[NewGVN] Surround with parens to clarify allegedly ambiguous precedence.
Davide Italiano [Mon, 10 Apr 2017 23:08:35 +0000 (23:08 +0000)]
[NewGVN] Surround with parens to clarify allegedly ambiguous precedence.

This Placates GCC7 with -Werror. Also, clang-format the assertions
while I'm here.

llvm-svn: 299895

7 years agoFix PR#32606: std::decay mishandles abominable function types
Marshall Clow [Mon, 10 Apr 2017 22:51:07 +0000 (22:51 +0000)]
Fix PR#32606: std::decay mishandles abominable function types

llvm-svn: 299894

7 years ago[MemorySSA] We don't need to compute dominator levels anymore.
Davide Italiano [Mon, 10 Apr 2017 22:44:46 +0000 (22:44 +0000)]
[MemorySSA] We don't need to compute dominator levels anymore.

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

llvm-svn: 299893

7 years agoCodeGen: BlockPlacement: Don't always tail-duplicate with no other successor.
Kyle Butt [Mon, 10 Apr 2017 22:28:22 +0000 (22:28 +0000)]
CodeGen: BlockPlacement: Don't always tail-duplicate with no other successor.

The math works out where it can actually be counter-productive. The probability
calculations correctly handle the case where the alternative is 0 probability,
rely on those calculations.

Includes a test case that demonstrates the problem.

llvm-svn: 299892

7 years agoCodeGen: BlockPlacement: Minor probability changes.
Kyle Butt [Mon, 10 Apr 2017 22:28:18 +0000 (22:28 +0000)]
CodeGen: BlockPlacement: Minor probability changes.

Qin may be large, and Succ may be more frequent than BB. Take these both into
account when deciding if tail-duplication is profitable.

llvm-svn: 299891

7 years agoCodeGen: BranchFolding: Merge identical blocks, even if they are short.
Kyle Butt [Mon, 10 Apr 2017 22:28:12 +0000 (22:28 +0000)]
CodeGen: BranchFolding: Merge identical blocks, even if they are short.

Merging identical blocks when it doesn't reduce fallthrough. It is common for
the blocks created from critical edge splitting to be identical. We would like
to merge these blocks whenever doing so would not reduce fallthrough.

llvm-svn: 299890

7 years agoUpdate for AllocaInst construction changes
Matt Arsenault [Mon, 10 Apr 2017 22:28:02 +0000 (22:28 +0000)]
Update for AllocaInst construction changes

llvm-svn: 299889

7 years agoAllow DataLayout to specify addrspace for allocas.
Matt Arsenault [Mon, 10 Apr 2017 22:27:50 +0000 (22:27 +0000)]
Allow DataLayout to specify addrspace for allocas.

LLVM makes several assumptions about address space 0. However,
alloca is presently constrained to always return this address space.
There's no real way to avoid using alloca, so without this
there is no way to opt out of these assumptions.

The problematic assumptions include:
- That the pointer size used for the stack is the same size as
  the code size pointer, which is also the maximum sized pointer.

- That 0 is an invalid, non-dereferencable pointer value.

These are problems for AMDGPU because alloca is used to
implement the private address space, which uses a 32-bit
index as the pointer value. Other pointers are 64-bit
and behave more like LLVM's notion of generic address
space. By changing the address space used for allocas,
we can change our generic pointer type to be LLVM's generic
pointer type which does have similar properties.

llvm-svn: 299888

7 years agoGet the TOC save offset off of PPCFrameLowering rather than a separate copy of the...
Eric Christopher [Mon, 10 Apr 2017 22:22:11 +0000 (22:22 +0000)]
Get the TOC save offset off of PPCFrameLowering rather than a separate copy of the same data.

llvm-svn: 299887

7 years agoBitcode: Merge the code for parsing global value module codes in the summary bitcode...
Peter Collingbourne [Mon, 10 Apr 2017 21:17:54 +0000 (21:17 +0000)]
Bitcode: Merge the code for parsing global value module codes in the summary bitcode reader. NFCI.

This code will need to be taught to handle string tables and it's better if
there is only one copy of it.

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

llvm-svn: 299886

7 years ago[tsan] Fall-back to IPv6 if IPv4 is not available.
Vitaly Buka [Mon, 10 Apr 2017 21:03:21 +0000 (21:03 +0000)]
[tsan] Fall-back to IPv6 if IPv4 is not available.

Reviewers: eugenis

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 299885

7 years ago[msan] Choose in runtime if IPv4 or IPv6 are supported.
Vitaly Buka [Mon, 10 Apr 2017 21:03:18 +0000 (21:03 +0000)]
[msan] Choose in runtime if IPv4 or IPv6 are supported.

Summary: This reverts commit cab5051c691ce27a7ffac41e8e76ceb222ad9549.

Reviewers: eugenis

Subscribers: mgorny, llvm-commits

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

llvm-svn: 299884

7 years agoEmit less compiler optimization remarks in samplepgo to reduce a call to findCalleeFu...
Dehao Chen [Mon, 10 Apr 2017 20:49:16 +0000 (20:49 +0000)]
Emit less compiler optimization remarks in samplepgo to reduce a call to findCalleeFunctionSamples which is going to be refactored.

Summary: Now the SamplePGO support is more stable, we do not need so many verbose optimization remarks emitted.

Reviewers: dnovillo, davidxl

Reviewed By: davidxl

Subscribers: fhahn, llvm-commits

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

llvm-svn: 299883

7 years ago[GVNHoist] Call isGuaranteedToTransferExecutionToSuccessor on each instruction
Geoff Berry [Mon, 10 Apr 2017 20:45:17 +0000 (20:45 +0000)]
[GVNHoist] Call isGuaranteedToTransferExecutionToSuccessor on each instruction

w.r.t. https://bugs.llvm.org/show_bug.cgi?id=32153
The consensus seems to be isGuaranteedToTransferExecutionToSuccessor should be called for each function.

Patch by Aditya Kumar

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

llvm-svn: 299882

7 years agoRevert "[asan] Fix dead stripping of globals on Linux (compiler-rt)."
Evgeniy Stepanov [Mon, 10 Apr 2017 20:36:43 +0000 (20:36 +0000)]
Revert "[asan] Fix dead stripping of globals on Linux (compiler-rt)."

This reverts r299698, which caused a big increase in object file size.

llvm-svn: 299881

7 years agoRevert "[asan] Put ctor/dtor in comdat."
Evgeniy Stepanov [Mon, 10 Apr 2017 20:36:36 +0000 (20:36 +0000)]
Revert "[asan] Put ctor/dtor in comdat."

This reverts commit r299696, which is causing mysterious test failures.

llvm-svn: 299880

7 years agoRevert "[asan] Fix dead stripping of globals on Linux."
Evgeniy Stepanov [Mon, 10 Apr 2017 20:36:30 +0000 (20:36 +0000)]
Revert "[asan] Fix dead stripping of globals on Linux."

This reverts commit r299697, which caused a big increase in object file size.

llvm-svn: 299879

7 years agoRevert "[IR] Make AttributeSetNode public, avoid temporary AttributeList copies"
Reid Kleckner [Mon, 10 Apr 2017 20:34:19 +0000 (20:34 +0000)]
Revert "[IR] Make AttributeSetNode public, avoid temporary AttributeList copies"

This reverts r299875. A Linux bot came back with a test failure:
http://bb.pgr.jp/builders/test-clang-i686-linux-RA/builds/741/steps/test_clang/logs/Clang%20%3A%3A%20CodeGen__2006-05-19-SingleEltReturn.c

llvm-svn: 299878

7 years agoUpdate for lifetime intrinsic signature change
Matt Arsenault [Mon, 10 Apr 2017 20:18:45 +0000 (20:18 +0000)]
Update for lifetime intrinsic signature change

llvm-svn: 299877

7 years agoAdd address space mangling to lifetime intrinsics
Matt Arsenault [Mon, 10 Apr 2017 20:18:21 +0000 (20:18 +0000)]
Add address space mangling to lifetime intrinsics

In preparation for allowing allocas to have non-0 addrspace.

llvm-svn: 299876

7 years ago[IR] Make AttributeSetNode public, avoid temporary AttributeList copies
Reid Kleckner [Mon, 10 Apr 2017 20:18:10 +0000 (20:18 +0000)]
[IR] Make AttributeSetNode public, avoid temporary AttributeList copies

Summary:
AttributeList::get(Fn|Ret|Param)Attributes no longer creates a temporary
AttributeList just to hide the AttributeSetNode type.

I've also added a factory method to create AttributeLists from a
parallel array of AttributeSetNodes. I think this simplifies
construction of AttributeLists when rewriting function prototypes.
Previously we would test if a particular index had attributes, and
conditionally add a temporary attribute list to a vector. Now the
attribute set vector is parallel to the argument vector already that
these passes already construct.

My long term vision is to wrap AttributeSetNode* inside an AttributeSet
type that holds the enum attributes, but that will come in a follow up
change.

I haven't done any performance measurements for this change because
profiling hasn't shown that any of the affected code is hot.

Reviewers: pete, chandlerc, sanjoy, hfinkel

Reviewed By: pete

Subscribers: jfb, llvm-commits

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

llvm-svn: 299875

7 years agoRemove svn:eol-style properties from some files so 'git llvm push' works for them
Reid Kleckner [Mon, 10 Apr 2017 20:16:54 +0000 (20:16 +0000)]
Remove svn:eol-style properties from some files so 'git llvm push' works for them

llvm-svn: 299874

7 years agoFix signed / unsigned comparison warnings.
Zachary Turner [Mon, 10 Apr 2017 20:01:50 +0000 (20:01 +0000)]
Fix signed / unsigned comparison warnings.

llvm-svn: 299873

7 years ago[mips] Use Triple::isLittleEndian to check endianness. NFC
Simon Atanasyan [Mon, 10 Apr 2017 19:42:44 +0000 (19:42 +0000)]
[mips] Use Triple::isLittleEndian to check endianness. NFC

llvm-svn: 299872

7 years ago[InstCombine] improve variable names; NFCI
Sanjay Patel [Mon, 10 Apr 2017 19:38:36 +0000 (19:38 +0000)]
[InstCombine] improve variable names; NFCI

llvm-svn: 299871

7 years ago[InstSimplify] Use cast instead of dyn_cast after isa<> check. NFCI
Craig Topper [Mon, 10 Apr 2017 19:37:10 +0000 (19:37 +0000)]
[InstSimplify] Use cast instead of dyn_cast after isa<> check. NFCI

llvm-svn: 299870