platform/upstream/llvm.git
8 years ago[MachineInstrBundle] Update the comment for PhysRegInfo::DeadDef.
Quentin Colombet [Tue, 26 Apr 2016 23:55:41 +0000 (23:55 +0000)]
[MachineInstrBundle] Update the comment for PhysRegInfo::DeadDef.

I missed read the comment when I commited r267621 and thought the
comment did not need update. Matthias kindly proved me wrong.
Fixing that.

llvm-svn: 267638

8 years agoELF: Move code to where it is used, and related cleanups. NFC.
Peter Collingbourne [Tue, 26 Apr 2016 23:52:44 +0000 (23:52 +0000)]
ELF: Move code to where it is used, and related cleanups. NFC.

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

llvm-svn: 267637

8 years agoAdd optimization bisect opt-in calls for SystemZ passes
Andrew Kaylor [Tue, 26 Apr 2016 23:49:41 +0000 (23:49 +0000)]
Add optimization bisect opt-in calls for SystemZ passes

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

llvm-svn: 267636

8 years agoAdd optimization bisect opt-in calls for NVPTX passes
Andrew Kaylor [Tue, 26 Apr 2016 23:44:31 +0000 (23:44 +0000)]
Add optimization bisect opt-in calls for NVPTX passes

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

llvm-svn: 267635

8 years ago[X86] Make sure it is safe to clobber EFLAGS, if need be, when choosing
Quentin Colombet [Tue, 26 Apr 2016 23:44:14 +0000 (23:44 +0000)]
[X86] Make sure it is safe to clobber EFLAGS, if need be, when choosing
the prologue.

Do not use basic blocks that have EFLAGS live-in as prologue if we need
to realign the stack. Realigning the stack uses AND instruction and this
clobbers EFLAGS.

An other alternative would have been to save and restore EFLAGS around
the stack realignment code, but this is likely inefficient.

Fixes PR27531.

llvm-svn: 267634

8 years agoModule debugging: Add an assertion.
Adrian Prantl [Tue, 26 Apr 2016 23:42:43 +0000 (23:42 +0000)]
Module debugging: Add an assertion.

llvm-svn: 267633

8 years agoPR27513: When determining which declaration to put into an exported lookup
Richard Smith [Tue, 26 Apr 2016 23:40:43 +0000 (23:40 +0000)]
PR27513: When determining which declaration to put into an exported lookup
table for a module / PCH, never map from a normal declaration of a class to an
injected-class-name declaration (or vice versa). Those declarations live in
distinct lookup tables and should not be confused.

We really shouldn't be using a CXXRecordDecl to represent an
injected-class-name in the first place; I've filed PR27532 so we don't forget.

llvm-svn: 267632

8 years agoPM: Port Reassociate to the new pass manager
Justin Bogner [Tue, 26 Apr 2016 23:39:29 +0000 (23:39 +0000)]
PM: Port Reassociate to the new pass manager

llvm-svn: 267631

8 years agoModule debugging: Also correctly handle typedef'd foward-declared members.
Adrian Prantl [Tue, 26 Apr 2016 23:37:38 +0000 (23:37 +0000)]
Module debugging: Also correctly handle typedef'd foward-declared members.
Thanks again to Richard Smith for pointing this out.

llvm-svn: 267630

8 years ago[X86] Replace -mcpu with -mattr in several tests
Mitch Bodart [Tue, 26 Apr 2016 23:36:38 +0000 (23:36 +0000)]
[X86] Replace -mcpu with -mattr in several tests
Differential Revision: http://reviews.llvm.org/D19568

llvm-svn: 267629

8 years agoReassociate: Convert another functor into a lambda. NFC
Justin Bogner [Tue, 26 Apr 2016 23:32:00 +0000 (23:32 +0000)]
Reassociate: Convert another functor into a lambda. NFC

Also move the explanatory comment with it.

llvm-svn: 267628

8 years ago[LVI] Cut short search if we know we can't return a useful result
Philip Reames [Tue, 26 Apr 2016 23:27:33 +0000 (23:27 +0000)]
[LVI] Cut short search if we know we can't return a useful result

Previously we were recursing on our operands for unary and binary operators regardless of whether we knew how to reason about the operator in question.  This has the effect of doing a potentially large amount of work, only to throw it away.  By checking whether the operation is one LVI can handle, we can cut short the search and return the (overdefined) answer more quickly.  The quality of the results produced should not change.

llvm-svn: 267626

8 years agoCheck 'r' and 'y specifiers of freebsd_kernel_printf format strings on PS4
Sunil Srivastava [Tue, 26 Apr 2016 23:19:00 +0000 (23:19 +0000)]
Check 'r' and 'y specifiers of freebsd_kernel_printf format strings on PS4

This is an addendum to r229921.

llvm-svn: 267625

8 years ago[SimplifyCFG] propagate branch metadata when creating select
Sanjay Patel [Tue, 26 Apr 2016 23:15:48 +0000 (23:15 +0000)]
[SimplifyCFG] propagate branch metadata when creating select

llvm-svn: 267624

8 years ago[X86] Teach the expansion of copy instructions how to do proper liveness.
Quentin Colombet [Tue, 26 Apr 2016 23:14:32 +0000 (23:14 +0000)]
[X86] Teach the expansion of copy instructions how to do proper liveness.

When the simple analysis provided by MachineBasicBlock::computeRegisterLiveness
fails, fall back on the LivePhysReg utility.

llvm-svn: 267623

8 years ago[MachineBasicBlock] Take advantage of the partially dead information.
Quentin Colombet [Tue, 26 Apr 2016 23:14:29 +0000 (23:14 +0000)]
[MachineBasicBlock] Take advantage of the partially dead information.

Thanks to that information we wouldn't lie on a register being live whereas it
is not.

llvm-svn: 267622

8 years ago[MachineInstrBundle] Improvement the recognition of dead definitions.
Quentin Colombet [Tue, 26 Apr 2016 23:14:24 +0000 (23:14 +0000)]
[MachineInstrBundle] Improvement the recognition of dead definitions.

Now, it is possible to know that partial definitions are dead definitions and
recognize that clobbered registers are also dead.

llvm-svn: 267621

8 years ago[LVI] Apply transfer rule for overdefine inputs for binary operators
Philip Reames [Tue, 26 Apr 2016 23:10:35 +0000 (23:10 +0000)]
[LVI] Apply transfer rule for overdefine inputs for binary operators

As pointed out by John Regehr over in http://reviews.llvm.org/D19485, LVI was being incredibly stupid about applying its transfer rules.  Rather than gathering local facts from the expression itself, it was simply giving up entirely if one of the inputs was overdefined.  This greatly impacts the precision of the overall analysis and makes it far more fragile as well.

This patch builds on 267609 which did the same thing for unary casts.

llvm-svn: 267620

8 years ago[NVPTX] Fix some usages of CodeGenOpt::None.
Jingyue Wu [Tue, 26 Apr 2016 22:59:25 +0000 (22:59 +0000)]
[NVPTX] Fix some usages of CodeGenOpt::None.

NVPTXLowerKernelArgs is required for correctness, so it should not be guarded
by CodeGenOpt::None.

NVPTXPeephole is optimization only, so it should be skipped when
CodeGenOpt::None.

llvm-svn: 267619

8 years ago[LVI] A better fix for the assertion error introduced by 267609
Philip Reames [Tue, 26 Apr 2016 22:52:30 +0000 (22:52 +0000)]
[LVI] A better fix for the assertion error introduced by 267609

Essentially, I was using the wrong size function.  For types which were sized, but not primitive, I wasn't getting a useful size for the operand and failed an assert.  I fixed this, and also added a guard that the input is a sized type.  Test case is for the original mistake.  I'm not sure how to actually exercise the sized type check.

llvm-svn: 267618

8 years ago[LVI] Speculative fix for assertion seen in clang bots
Philip Reames [Tue, 26 Apr 2016 22:31:53 +0000 (22:31 +0000)]
[LVI] Speculative fix for assertion seen in clang bots

I'll clean this up and add a test case shortly.  I want to make sure this does actually fix the bots; if not, I'll revert.

llvm-svn: 267617

8 years agoFix TestRegisterVariables.py on Windows
Adrian McCarthy [Tue, 26 Apr 2016 22:25:40 +0000 (22:25 +0000)]
Fix TestRegisterVariables.py on Windows

Use __attribute__((regparm(x))) to ensure the compiler enregisters at least some arguments when calling functions.

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

llvm-svn: 267616

8 years ago[LowerExpectIntrinsic] make default likely/unlikely ratio bigger
Sanjay Patel [Tue, 26 Apr 2016 22:23:38 +0000 (22:23 +0000)]
[LowerExpectIntrinsic] make default likely/unlikely ratio bigger

We need the default ratio to be sufficiently large that it triggers transforms
based on block frequency info (BFI) and plays well with the recently introduced
BranchProbability used by CGP.

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

llvm-svn: 267615

8 years agoReassociate: Simplify using lambdas. NFC
Justin Bogner [Tue, 26 Apr 2016 22:22:18 +0000 (22:22 +0000)]
Reassociate: Simplify using lambdas. NFC

llvm-svn: 267614

8 years agoReturn R_GOTREL for R_MIPS_GPREL*.
Rafael Espindola [Tue, 26 Apr 2016 22:00:04 +0000 (22:00 +0000)]
Return R_GOTREL for R_MIPS_GPREL*.

This lets Writer.cpp know that they are got relative, which will allow
further simplifications.

llvm-svn: 267613

8 years agoModule debugging: Add testcase for member classes of class template specializations.
Adrian Prantl [Tue, 26 Apr 2016 21:58:23 +0000 (21:58 +0000)]
Module debugging: Add testcase for member classes of class template specializations.

llvm-svn: 267612

8 years agoModule debugging: Use the definition to determine module-defined types.
Adrian Prantl [Tue, 26 Apr 2016 21:58:18 +0000 (21:58 +0000)]
Module debugging: Use the definition to determine module-defined types.

Follow-up to r267464. Thanks to Richard Smith for pointing this out!

llvm-svn: 267611

8 years ago[sanitizers] rewriting test assuming assert() changes coverage.
Mike Aizatsky [Tue, 26 Apr 2016 21:56:14 +0000 (21:56 +0000)]
[sanitizers] rewriting test assuming assert() changes coverage.

Summary:
On windows platform assert() call creates two distinct CFG edges
which are coverage-instrumented. Simply calling assert would
change coverage numbers on the platform.

Subscribers: kubabrecka

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

llvm-svn: 267610

8 years ago[LVI] Infer local facts from unary expressions
Philip Reames [Tue, 26 Apr 2016 21:48:16 +0000 (21:48 +0000)]
[LVI] Infer local facts from unary expressions

As pointed out by John Regehr over in http://reviews.llvm.org/D19485, LVI was being incredibly stupid about applying its transfer rules. Rather than gathering local facts from the expression itself, it was simply giving up entirely if one of the inputs was overdefined. This greatly impacts the precision of the overall analysis and makes it far more fragile as well.

This patch implements only the unary operation case. Once this is in, I'll implement the same for the binary operations.

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

llvm-svn: 267609

8 years agoOptimization bisect support in X86-specific passes
Andrew Kaylor [Tue, 26 Apr 2016 21:44:24 +0000 (21:44 +0000)]
Optimization bisect support in X86-specific passes

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

llvm-svn: 267608

8 years ago[CodeGen] Add getBuildVector and getSplatBuildVector helpers. NFCI.
Ahmed Bougacha [Tue, 26 Apr 2016 21:15:30 +0000 (21:15 +0000)]
[CodeGen] Add getBuildVector and getSplatBuildVector helpers. NFCI.

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

llvm-svn: 267606

8 years agoRevert "[SimplifyLibCalls] sprintf doesn't copy null bytes"
David Majnemer [Tue, 26 Apr 2016 21:04:47 +0000 (21:04 +0000)]
Revert "[SimplifyLibCalls] sprintf doesn't copy null bytes"

The destination buffer that sprintf uses is restrict qualified, we do
not need to worry about derived pointers referenced via format
specifiers.

This reverts commit r267580.

llvm-svn: 267605

8 years agoTest commit
Erik Pilkington [Tue, 26 Apr 2016 20:55:48 +0000 (20:55 +0000)]
Test commit

llvm-svn: 267604

8 years agoCall repl in getSymbolBody. NFC.
Rafael Espindola [Tue, 26 Apr 2016 20:45:31 +0000 (20:45 +0000)]
Call repl in getSymbolBody. NFC.

Every caller was doing it.

llvm-svn: 267603

8 years agoMove utility functions to DriverUtils.cpp.
Rui Ueyama [Tue, 26 Apr 2016 20:41:32 +0000 (20:41 +0000)]
Move utility functions to DriverUtils.cpp.

llvm-svn: 267602

8 years agoTry to get at_file_missing.c passing after LLVM r267556.
Nico Weber [Tue, 26 Apr 2016 20:40:23 +0000 (20:40 +0000)]
Try to get at_file_missing.c passing after LLVM r267556.

r267556 made backslashes escape the next character
unconditionally in rsp files.  This test echos a path into
a rsp file, and paths contain backslashes on Windows. Since
it's not important for this test to get the filename from
the rsp file, just pass it regularly.

llvm-svn: 267601

8 years agoHandle Windows drive letters and ".." for --reproduce.
Rui Ueyama [Tue, 26 Apr 2016 20:36:46 +0000 (20:36 +0000)]
Handle Windows drive letters and ".." for --reproduce.

When --reproduce <path> is given, then we need to concatenate input
file paths to the given path to save input files to the directory.
Previously, path concatenation didn't handle Windows drive letters
so it could generate invalid paths such as "C:\D:\foo". It also didn't
handle ".." path components, so it could produce some bad paths
such as "foo/../../etc/passwd".

In this patch, Windows drive letters and ".." are removed before
concatenating paths.

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

llvm-svn: 267600

8 years agoTry to get ResponseFile.ll passing on Windows after r267556.
Nico Weber [Tue, 26 Apr 2016 20:32:51 +0000 (20:32 +0000)]
Try to get ResponseFile.ll passing on Windows after r267556.

llvm-svn: 267599

8 years agoRemove more unused variables.
Zachary Turner [Tue, 26 Apr 2016 20:32:35 +0000 (20:32 +0000)]
Remove more unused variables.

llvm-svn: 267598

8 years agoMasked Store in Loop Vectorizer - bugfix
Elena Demikhovsky [Tue, 26 Apr 2016 20:18:04 +0000 (20:18 +0000)]
Masked Store in Loop Vectorizer - bugfix

Fixed a bug in loop vectorization with conditional store.

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

llvm-svn: 267597

8 years agoPM: Port Internalize to the new pass manager
Justin Bogner [Tue, 26 Apr 2016 20:15:52 +0000 (20:15 +0000)]
PM: Port Internalize to the new pass manager

llvm-svn: 267596

8 years ago[llvm-pdbdump] Fix version reading on big endian systems.
Zachary Turner [Tue, 26 Apr 2016 19:48:18 +0000 (19:48 +0000)]
[llvm-pdbdump] Fix version reading on big endian systems.

llvm-svn: 267595

8 years agoUtilityFunction::MakeFunctionCaller uses the Error to report failure,
Jim Ingham [Tue, 26 Apr 2016 19:46:39 +0000 (19:46 +0000)]
UtilityFunction::MakeFunctionCaller uses the Error to report failure,
but when there's was no process it was just returning an null pointer
and not setting the error.  I don't have a scenario where this might
go wrong, just code inspection...

llvm-svn: 267594

8 years agoAdd optimization bisect opt-in calls for Hexagon passes
Andrew Kaylor [Tue, 26 Apr 2016 19:46:28 +0000 (19:46 +0000)]
Add optimization bisect opt-in calls for Hexagon passes

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

llvm-svn: 267593

8 years ago[clang-tidy] Now adding correct misc-move-const-arg documentation ;]
Alexander Kornienko [Tue, 26 Apr 2016 19:33:49 +0000 (19:33 +0000)]
[clang-tidy] Now adding correct misc-move-const-arg documentation ;]

+ brushed the code a bit and renamed the test file to match the check name

llvm-svn: 267592

8 years agoApparently XFAIL tests that are supposed to fail to compile can be problematic. They...
Marshall Clow [Tue, 26 Apr 2016 19:29:35 +0000 (19:29 +0000)]
Apparently XFAIL tests that are supposed to fail to compile can be problematic. They still get compiled, and if the compile succeeds, the buildbots complain. Replace the XFAIL with #error.

llvm-svn: 267591

8 years ago[OpenCL] Add predefined macros.
Yaxun Liu [Tue, 26 Apr 2016 19:25:46 +0000 (19:25 +0000)]
[OpenCL] Add predefined macros.

OpenCL spec requires __OPENCL_C_VERSION__ to be defined based on -cl-std option. This patch implements that.

The patch also defines __FAST_RELAXED_MATH__ based on -cl-fast-relaxed-math option.

Also fixed a test using -std=c99 for OpenCL program. Limit allowed language standard of OpenCL to be OpenCL standards.

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

llvm-svn: 267590

8 years agoFix warnings and -Werror build on clang.
Zachary Turner [Tue, 26 Apr 2016 19:24:10 +0000 (19:24 +0000)]
Fix warnings and -Werror build on clang.

llvm-svn: 267589

8 years agoMake test/ELF/reproduces.s test to work on Windows.
Rui Ueyama [Tue, 26 Apr 2016 19:04:35 +0000 (19:04 +0000)]
Make test/ELF/reproduces.s test to work on Windows.

Previously, the test didn't work on Windows because it tried to
concatenate two (possibly) absolute paths. If two paths are absolute
paths that have drive letters, then the result would become something
like C:\foo\D:\bar. That's not a valid path. I changed the test to
use relative paths.

llvm-svn: 267588

8 years ago[clang-tidy] Added misc-move-const-arg docs.
Alexander Kornienko [Tue, 26 Apr 2016 18:48:59 +0000 (18:48 +0000)]
[clang-tidy] Added misc-move-const-arg docs.

llvm-svn: 267587

8 years ago[sanitizers] [NFC] Add defines for the various PowerPC ABIs.
Marcin Koscielnicki [Tue, 26 Apr 2016 18:44:13 +0000 (18:44 +0000)]
[sanitizers] [NFC] Add defines for the various PowerPC ABIs.

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

llvm-svn: 267586

8 years agoParse and dump PDB DBI Stream Header Information
Zachary Turner [Tue, 26 Apr 2016 18:42:34 +0000 (18:42 +0000)]
Parse and dump PDB DBI Stream Header Information

The DBI stream contains a lot of bookkeeping information for other
streams. In particular it contains information about section contributions
and linked modules. This patch is a first attempt at parsing some of the
information out of the DBI stream. It currently only parses and dumps the
headers of the DBI stream, so none of the module data or section
contribution data is pulled out.

This is just a proof of concept that we understand the basic properties of
the DBI stream's metadata, and followup patches will try to extract more
detailed information out.

Differential Revision: http://reviews.llvm.org/D19500
Reviewed By: majnemer, ruiu

llvm-svn: 267585

8 years ago[CMake] Use just-built clang and build iOS support when building stage2
Chris Bieneman [Tue, 26 Apr 2016 18:39:20 +0000 (18:39 +0000)]
[CMake] Use just-built clang and build iOS support when building stage2

The Apple stage2 build should include compiler-rt iOS libraries and be built with the stage2 compiler. This matches Apple's production clang builds.

llvm-svn: 267584

8 years ago[Tail duplication] Handle source registers with subregisters
Krzysztof Parzyszek [Tue, 26 Apr 2016 18:36:34 +0000 (18:36 +0000)]
[Tail duplication] Handle source registers with subregisters

When a block is tail-duplicated, the PHI nodes from that block are
replaced with appropriate COPY instructions. When those PHI nodes
contained use operands with subregisters, the subregisters were
dropped from the COPY instructions, resulting in incorrect code.

Keep track of the subregister information and use this information
when remapping instructions from the duplicated block.

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

llvm-svn: 267583

8 years agoReapply: "ARM: put correct symbol index on indirect pointers in __thread_ptr.""
Tim Northover [Tue, 26 Apr 2016 18:29:16 +0000 (18:29 +0000)]
Reapply: "ARM: put correct symbol index on indirect pointers in __thread_ptr.""

A latent bug in llvm-objdump used the wrong format specifier on 32-bit
targets, causing the test to fail. This fixes the issue.

llvm-svn: 267582

8 years agoInternalize: More consistent file header and include guards. NFC
Justin Bogner [Tue, 26 Apr 2016 18:25:30 +0000 (18:25 +0000)]
Internalize: More consistent file header and include guards. NFC

Match the style here to the other headers in Transforms/IPO.

llvm-svn: 267581

8 years ago[SimplifyLibCalls] sprintf doesn't copy null bytes
David Majnemer [Tue, 26 Apr 2016 18:16:49 +0000 (18:16 +0000)]
[SimplifyLibCalls] sprintf doesn't copy null bytes

sprintf doesn't read or copy the terminating null byte from it's string
operands.  sprintf will append it's own after processing all of the
format specifiers.

This fixes PR27526.

llvm-svn: 267580

8 years agoSwift Calling Convention: use %RAX for sret.
Manman Ren [Tue, 26 Apr 2016 18:08:06 +0000 (18:08 +0000)]
Swift Calling Convention: use %RAX for sret.

We don't need to copy the sret argument into %rax upon return.
rdar://25671494

llvm-svn: 267579

8 years agotests: tweak MIR for ARM tests to correct MI issues
Saleem Abdulrasool [Tue, 26 Apr 2016 17:54:21 +0000 (17:54 +0000)]
tests: tweak MIR for ARM tests to correct MI issues

The Machine Instruction Verifier flagged some issues in the serialized MIR.
Adjust the input to correct them.

Fixes the remaining portion of PR27480.

llvm-svn: 267578

8 years agotest: remove some bleeding whitespace
Saleem Abdulrasool [Tue, 26 Apr 2016 17:54:16 +0000 (17:54 +0000)]
test: remove some bleeding whitespace

Kill bleeding whitespace.  NFC

llvm-svn: 267577

8 years ago[Release notes] Mention Clang-tidy misc-fold-init-type check.
Eugene Zelenko [Tue, 26 Apr 2016 17:54:00 +0000 (17:54 +0000)]
[Release notes] Mention Clang-tidy misc-fold-init-type check.

Highlighting consistency in Clang-tidy misc-fold-init-type check documentation.

llvm-svn: 267576

8 years ago[CMake] [PR27403] Fix COMPILER_RT_ENABLE_IOS when using Xcode from the App Store.
Chris Bieneman [Tue, 26 Apr 2016 17:53:25 +0000 (17:53 +0000)]
[CMake] [PR27403] Fix COMPILER_RT_ENABLE_IOS when using Xcode from the App Store.

This change modifies find_darwin_sdk_dir to set a variable if a Darwin "Internal" SDK is present which allows CMake to disable components that require internal-only APIs.

This mechanism is then used to disable TSan when an internal SDK is not present.

llvm-svn: 267575

8 years ago[clang-tidy] New checker for redundant expressions.
Etienne Bergeron [Tue, 26 Apr 2016 17:30:30 +0000 (17:30 +0000)]
[clang-tidy] New checker for redundant expressions.

Summary:
This checker finds redundant expression on both side of a binary operator.

The current implementation provide a function to check whether expressions
are equivalent. This implementation is able to recognize the common
subset encounter in C++ program. Side-effects like "x++" are not considered
to be equivalent.

There are many False Positives related to macros and to floating point
computations (detecting NaN). The checker is ignoring these cases.

Example:
```
    if( !dst || dst->depth != desired_depth ||
        dst->nChannels != desired_num_channels ||
        dst_size.width != src_size.width ||
        dst_size.height != dst_size.height )    <<--- bug
    {
```

Reviewers: alexfh

Subscribers: danielmarjamaki, fahlgren, jordan_rose, zaks.anna, Eugene.Zelenko, cfe-commits

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

llvm-svn: 267574

8 years ago[AMDGPU] Move reserved vgpr count for trap handler usage to SIMachineFunctionInfo...
Konstantin Zhuravlyov [Tue, 26 Apr 2016 17:24:40 +0000 (17:24 +0000)]
[AMDGPU] Move reserved vgpr count for trap handler usage to SIMachineFunctionInfo + minor commenting changes

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

llvm-svn: 267573

8 years ago[CodeGenPrepare] use branch weight metadata to decide if a select should be turned...
Sanjay Patel [Tue, 26 Apr 2016 17:11:17 +0000 (17:11 +0000)]
[CodeGenPrepare] use branch weight metadata to decide if a select should be turned into a branch

This is part of solving PR27344:
https://llvm.org/bugs/show_bug.cgi?id=27344

CGP should undo the SimplifyCFG transform for the same reason that earlier patches have used this
same mechanism: it's possible that passes between SimplifyCFG and CGP may be able to optimize the
IR further with a select in place.

For the TLI hook default, >99% taken or not taken is chosen as the default threshold for a highly
predictable branch. Even the most limited HW branch predictors will be correct on this branch almost
all the time, so even a massive mispredict penalty perf loss would be overcome by the win from all
the times the branch was predicted correctly.

As a follow-up, we could make the default target hook less conservative by using the SchedMachineModel's
MispredictPenalty. Or we could just let targets override the default by implementing the hook with that
and other target-specific options. Note that trying to statically determine mispredict rates for
close-to-balanced profile weight data is generally impossible if the HW is sufficiently advanced. Ie,
50/50 taken/not-taken might still be 100% predictable.

Finally, note that this patch as-is will not solve PR27344 because the current __builtin_unpredictable()
branch weight default values are 4 and 64. A proposal to change that is in D19435.

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

llvm-svn: 267572

8 years agoFix build broken due to order of initialization problem.
Zachary Turner [Tue, 26 Apr 2016 16:57:53 +0000 (16:57 +0000)]
Fix build broken due to order of initialization problem.

llvm-svn: 267571

8 years ago[clang-tidy] Enhance misc-suspicious-string-compare to move down false-positives.
Etienne Bergeron [Tue, 26 Apr 2016 16:53:21 +0000 (16:53 +0000)]
[clang-tidy] Enhance misc-suspicious-string-compare to move down false-positives.

Summary:
The checker was noisy when running over llvm code base.
This patch is impriving the way string-compare functions are matched.

1) By default, do not report !strcmp(...) unless it's activate by the user,
2) Only match suspicious expression over a subset of expression (binary operator),
3) Added matching of macro wrapper used with clang on linux.

See bug: 27465.

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 267570

8 years agoRemove unnecessary function type directives for ifuncs.
Peter Collingbourne [Tue, 26 Apr 2016 16:50:02 +0000 (16:50 +0000)]
Remove unnecessary function type directives for ifuncs.

llvm-svn: 267569

8 years agoDon't gc symbols that have to go in the dynamic symbol table.
Rafael Espindola [Tue, 26 Apr 2016 16:26:45 +0000 (16:26 +0000)]
Don't gc symbols that have to go in the dynamic symbol table.

We were only doing it for .so and --export-dynamic, but those are not
the only ways a symbol ends up in the dynamic symbol table.

Problem diagnostic and earlier patch version by Peter Collingbourne.

llvm-svn: 267568

8 years ago#include <test_macros.h> in all the regex tests, and remove all mentions of __cpluplu...
Marshall Clow [Tue, 26 Apr 2016 16:24:44 +0000 (16:24 +0000)]
#include <test_macros.h> in all the regex tests, and remove all mentions of __cpluplus (use TEST_STD_VERS and/or XFAIL instead). No functional change

llvm-svn: 267567

8 years agoELF: Treat IFunc definitions in DSOs as functions.
Peter Collingbourne [Tue, 26 Apr 2016 16:22:51 +0000 (16:22 +0000)]
ELF: Treat IFunc definitions in DSOs as functions.

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

llvm-svn: 267566

8 years ago[ELF] Avoid polluting source directory with temp files.
Davide Italiano [Tue, 26 Apr 2016 16:21:59 +0000 (16:21 +0000)]
[ELF] Avoid polluting source directory with temp files.

llvm-svn: 267565

8 years agoRefactor some more PDB reading code into DebugInfoPDB.
Zachary Turner [Tue, 26 Apr 2016 16:20:00 +0000 (16:20 +0000)]
Refactor some more PDB reading code into DebugInfoPDB.

Differential Revision: http://reviews.llvm.org/D19445
Reviewed By: David Majnemer

llvm-svn: 267564

8 years ago[AMDGPU] Reserve VGPRs for trap handler usage if instructed
Konstantin Zhuravlyov [Tue, 26 Apr 2016 15:43:14 +0000 (15:43 +0000)]
[AMDGPU] Reserve VGPRs for trap handler usage if instructed

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

llvm-svn: 267563

8 years agoFix send and receive of ACK byte in test infrastructure for Python 3.5
Adrian McCarthy [Tue, 26 Apr 2016 15:15:29 +0000 (15:15 +0000)]
Fix send and receive of ACK byte in test infrastructure for Python 3.5

Python 3.5 is pickier about the distinction between chars and bytes (and strings and bytearrays) than Python 2.7.

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

llvm-svn: 267562

8 years ago[SPIR] Remove an assert mandating SPIR for OpenCL sources only.
Anastasia Stulova [Tue, 26 Apr 2016 15:14:01 +0000 (15:14 +0000)]
[SPIR] Remove an assert mandating SPIR for OpenCL sources only.

SPIR target can be used for C/C++ inputs too (i.e. in OpenCL compatible mode for the libs creation).

Patch by Neil Henning!

Review: http://reviews.llvm.org/D19478
llvm-svn: 267561

8 years ago[OpenMP] Improve mappable expressions Sema.
Samuel Antao [Tue, 26 Apr 2016 14:54:23 +0000 (14:54 +0000)]
[OpenMP] Improve mappable expressions Sema.

Summary:
This patch adds logic to save the components of mappable expressions in the clause that uses it, so that they don't have to be recomputed during codegen. Given that the mappable components are (will be) used in several clauses a new geneneric implementation `OMPMappableExprListClause` is used that extends the existing `OMPVarListClause`.

This patch does not add new tests. The goal is to preserve the existing functionality while storing more info in the clauses.

Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev

Subscribers: cfe-commits, caomhin

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

llvm-svn: 267560

8 years agoAllow unsigned comparisons
Johannes Doerfert [Tue, 26 Apr 2016 14:33:12 +0000 (14:33 +0000)]
Allow unsigned comparisons

  With this patch we will optimistically assume that the result of an unsigned
  comparison is the same as the result of the same comparison interpreted as
  signed.

llvm-svn: 267559

8 years agoHandle --as-needed with symbols, not relocations.
Rafael Espindola [Tue, 26 Apr 2016 13:56:26 +0000 (13:56 +0000)]
Handle --as-needed with symbols, not relocations.

This matches the behavior of both gold and bfd.

llvm-svn: 267558

8 years agoUpdate test after LLVM r267556.
Nico Weber [Tue, 26 Apr 2016 13:54:29 +0000 (13:54 +0000)]
Update test after LLVM r267556.

llvm-svn: 267557

8 years agoUse gcc's rules for parsing gcc-style response files
Nico Weber [Tue, 26 Apr 2016 13:53:56 +0000 (13:53 +0000)]
Use gcc's rules for parsing gcc-style response files

In gcc, \ escapes every character in response files. It is true that this makes
it harder to mention Windows files in rsp files, but not doing this means clang
disagrees with gcc, and also disagrees with the shell (on non-Windows) which
rsp file quoting is supposed to match. clang isn't free to choose what to do
here.

In general, the idea for response files is to take bits of your command line
and write them to a file unchanged, and have things work the same way. Since
the command line would've been interpreted by the shell, things in the rsp file
need to be subject to the same shell quoting rules.

People who want to put Windows-style paths in their response files either need
to do any of:
* escape their backslashes
* or use clang-cl which uses cl.exe/cmd.exe quoting rules
* pass --rsp-quoting=windows to clang to tell it to use
  cl.exe/cmd.exe quoting rules for response files.

Fixes PR27464.
http://reviews.llvm.org/D19417

llvm-svn: 267556

8 years agoStore the binding in the Symbol.
Rafael Espindola [Tue, 26 Apr 2016 13:50:46 +0000 (13:50 +0000)]
Store the binding in the Symbol.

This remove a fixme, cleans up the weak undef interaction with archives and
lets us keep weak undefs still weak if they resolve to shared.

llvm-svn: 267555

8 years agoBump up timeout in TestCallWithTimeout
Pavel Labath [Tue, 26 Apr 2016 13:37:24 +0000 (13:37 +0000)]
Bump up timeout in TestCallWithTimeout

Expression very rarely (linux buildbot, build 13907) completed before we managed to interrupt it.

llvm-svn: 267554

8 years ago[AMDGPU] Assembler: basic support for SDWA instructions
Sam Kolton [Tue, 26 Apr 2016 13:33:56 +0000 (13:33 +0000)]
[AMDGPU] Assembler: basic support for SDWA instructions

Support for SDWA instructions for VOP1 and VOP2 encoding.
Not done yet:
  - converters for support optional operands and modifiers
  - VOPC
  - sext() modifier
  - intrinsics
  - VOP2b (see vop_dpp.s)
  - V_MAC_F32 (see vop_dpp.s)

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

llvm-svn: 267553

8 years ago[FIX] Adjust assumption space for zext instructions
Johannes Doerfert [Tue, 26 Apr 2016 12:44:01 +0000 (12:44 +0000)]
[FIX] Adjust assumption space for zext instructions

llvm-svn: 267552

8 years ago[X86] PR27502: Fix the LEA optimization pass.
Andrey Turetskiy [Tue, 26 Apr 2016 12:18:12 +0000 (12:18 +0000)]
[X86] PR27502: Fix the LEA optimization pass.

Handle MachineBasicBlock as a memory displacement operand in the LEA optimization pass.

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

llvm-svn: 267551

8 years agorL267291: Architecture change to thumb on parsing arm.attributes causes regression.
Omair Javaid [Tue, 26 Apr 2016 11:26:00 +0000 (11:26 +0000)]
rL267291: Architecture change to thumb on parsing arm.attributes causes regression.

Remove case handling elf arm attribute Tag_THUMB_ISA_use and setting architecture to thumb.

Differential revision: http://reviews.llvm.org/D19520

llvm-svn: 267550

8 years ago[Sparc] Fix build error introduced by rL267545.
Marcin Koscielnicki [Tue, 26 Apr 2016 10:43:47 +0000 (10:43 +0000)]
[Sparc] Fix build error introduced by rL267545.

llvm-svn: 267549

8 years ago[sanitizer] [SystemZ] Add ptrace support bits.
Marcin Koscielnicki [Tue, 26 Apr 2016 10:41:30 +0000 (10:41 +0000)]
[sanitizer] [SystemZ] Add ptrace support bits.

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

llvm-svn: 267548

8 years ago[sanitizer] [SystemZ] Implement internal_clone.
Marcin Koscielnicki [Tue, 26 Apr 2016 10:41:19 +0000 (10:41 +0000)]
[sanitizer] [SystemZ] Implement internal_clone.

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

llvm-svn: 267547

8 years ago[PowerPC] Add support for llvm.thread.pointer
Marcin Koscielnicki [Tue, 26 Apr 2016 10:37:22 +0000 (10:37 +0000)]
[PowerPC] Add support for llvm.thread.pointer

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

llvm-svn: 267546

8 years ago[SPARC] [SSP] Add support for LOAD_STACK_GUARD.
Marcin Koscielnicki [Tue, 26 Apr 2016 10:37:14 +0000 (10:37 +0000)]
[SPARC] [SSP] Add support for LOAD_STACK_GUARD.

This fixes PR22248 on sparc.

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

llvm-svn: 267545

8 years ago[SPARC] Add support for llvm.thread.pointer.
Marcin Koscielnicki [Tue, 26 Apr 2016 10:37:01 +0000 (10:37 +0000)]
[SPARC] Add support for llvm.thread.pointer.

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

llvm-svn: 267544

8 years agoThinLTOCodeGenerator: preserve linkonce when in "MustPreserved" set
Mehdi Amini [Tue, 26 Apr 2016 10:35:01 +0000 (10:35 +0000)]
ThinLTOCodeGenerator: preserve linkonce when in "MustPreserved" set

If the linker specifically requested for a linkonce to be preserved,
we need to make sure we won't drop it even if all the uses in the
current module disappear.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 267543

8 years agoA clang-tidy check for std:accumulate.
Alexander Kornienko [Tue, 26 Apr 2016 10:05:45 +0000 (10:05 +0000)]
A clang-tidy check for std:accumulate.

Summary:
For folds (e.g. std::accumulate), check matches between the provided init value and the range's value_type. A typical error is "std::accumulate(begin, end, 0);", where begin and end have float value_type. See the documentation for more examples.

For now we check std::accumulate, std::reduce and std::inner_product.

Reviewers: hokein, alexfh

Subscribers: Prazek, aaron.ballman, cfe-commits, courbet

Patch by ClĂ©ment Courbet!

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

llvm-svn: 267542

8 years agoRevert "ARM: put correct symbol index on indirect pointers in __thread_ptr."
Renato Golin [Tue, 26 Apr 2016 10:02:02 +0000 (10:02 +0000)]
Revert "ARM: put correct symbol index on indirect pointers in __thread_ptr."

This reverts commit r267488, as it broke some ARM buildbots.

llvm-svn: 267541

8 years ago[MSVC] PR27337: allow static_cast from private base to derived for WTL
Dmitry Polukhin [Tue, 26 Apr 2016 09:21:17 +0000 (09:21 +0000)]
[MSVC] PR27337: allow static_cast from private base to derived for WTL

MSVC doesn't report even warning for cast from private base class to
derived.

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

llvm-svn: 267534

8 years agoDo not use the number of parameters in the complexity check
Johannes Doerfert [Tue, 26 Apr 2016 09:20:41 +0000 (09:20 +0000)]
Do not use the number of parameters in the complexity check

llvm-svn: 267532

8 years agoDo not add but record signed-unsigned assumptions
Johannes Doerfert [Tue, 26 Apr 2016 09:16:36 +0000 (09:16 +0000)]
Do not add but record signed-unsigned assumptions

llvm-svn: 267528

8 years ago[ppc64] Reenable sibling call optimization on ppc64 since fixed tsan library tail...
Chuang-Yu Cheng [Tue, 26 Apr 2016 07:38:24 +0000 (07:38 +0000)]
[ppc64] Reenable sibling call optimization on ppc64 since fixed tsan library tail-call issue

print-stack-trace.cc test failure of compiler-rt has been fixed by
r266869 (http://reviews.llvm.org/D19148), so reenable sibling call
optimization on ppc64

Reviewers: nemanjai kbarton
llvm-svn: 267527