Commit Graph

229008 Commits

Author SHA1 Message Date
Philip Reames e5030e85ea [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
2016-04-26 22:52:30 +00:00
Philip Reames d5c62a0aad [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
2016-04-26 22:31:53 +00:00
Adrian McCarthy fd5c9be4bb 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
2016-04-26 22:25:40 +00:00
Sanjay Patel d2d2aa52cd [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
2016-04-26 22:23:38 +00:00
Justin Bogner 90744d215b Reassociate: Simplify using lambdas. NFC
llvm-svn: 267614
2016-04-26 22:22:18 +00:00
Rafael Espindola 1763dc44b9 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
2016-04-26 22:00:04 +00:00
Adrian Prantl 90931c4853 Module debugging: Add testcase for member classes of class template specializations.
llvm-svn: 267612
2016-04-26 21:58:23 +00:00
Adrian Prantl 88d7917970 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
2016-04-26 21:58:18 +00:00
Mike Aizatsky a3060c1159 [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
2016-04-26 21:56:14 +00:00
Philip Reames 38c87c2e50 [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
2016-04-26 21:48:16 +00:00
Andrew Kaylor 2bee5ef462 Optimization bisect support in X86-specific passes
Differential Revision: http://reviews.llvm.org/D19439

llvm-svn: 267608
2016-04-26 21:44:24 +00:00
Ahmed Bougacha 128f8732a5 [CodeGen] Add getBuildVector and getSplatBuildVector helpers. NFCI.
Differential Revision: http://reviews.llvm.org/D17176

llvm-svn: 267606
2016-04-26 21:15:30 +00:00
David Majnemer abb9f55c80 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
2016-04-26 21:04:47 +00:00
Erik Pilkington ce26eac511 Test commit
llvm-svn: 267604
2016-04-26 20:55:48 +00:00
Rafael Espindola 6c75238aca Call repl in getSymbolBody. NFC.
Every caller was doing it.

llvm-svn: 267603
2016-04-26 20:45:31 +00:00
Rui Ueyama cf0dd1ebf2 Move utility functions to DriverUtils.cpp.
llvm-svn: 267602
2016-04-26 20:41:32 +00:00
Nico Weber 197e5cfe34 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
2016-04-26 20:40:23 +00:00
Rui Ueyama 673b609586 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
2016-04-26 20:36:46 +00:00
Nico Weber 2f1459cbb7 Try to get ResponseFile.ll passing on Windows after r267556.
llvm-svn: 267599
2016-04-26 20:32:51 +00:00
Zachary Turner c3c4e15697 Remove more unused variables.
llvm-svn: 267598
2016-04-26 20:32:35 +00:00
Elena Demikhovsky 308a7eb0d2 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
2016-04-26 20:18:04 +00:00
Justin Bogner 4563a06cee PM: Port Internalize to the new pass manager
llvm-svn: 267596
2016-04-26 20:15:52 +00:00
Zachary Turner 7756127077 [llvm-pdbdump] Fix version reading on big endian systems.
llvm-svn: 267595
2016-04-26 19:48:18 +00:00
Jim Ingham dae50baf44 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
2016-04-26 19:46:39 +00:00
Andrew Kaylor 5b444a21df Add optimization bisect opt-in calls for Hexagon passes
Differential Revision: http://reviews.llvm.org/D19509

llvm-svn: 267593
2016-04-26 19:46:28 +00:00
Alexander Kornienko 900cadd3ad [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
2016-04-26 19:33:49 +00:00
Marshall Clow 8dc9dcaeac 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
2016-04-26 19:29:35 +00:00
Yaxun Liu 382d355359 [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
2016-04-26 19:25:46 +00:00
Zachary Turner ff788aa0ee Fix warnings and -Werror build on clang.
llvm-svn: 267589
2016-04-26 19:24:10 +00:00
Rui Ueyama 3578d334fb 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
2016-04-26 19:04:35 +00:00
Alexander Kornienko 1af58fc1e5 [clang-tidy] Added misc-move-const-arg docs.
llvm-svn: 267587
2016-04-26 18:48:59 +00:00
Marcin Koscielnicki 3f9d7a217d [sanitizers] [NFC] Add defines for the various PowerPC ABIs.
Differential Revision: http://reviews.llvm.org/D19542

llvm-svn: 267586
2016-04-26 18:44:13 +00:00
Zachary Turner 53a65ba5c9 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
2016-04-26 18:42:34 +00:00
Chris Bieneman 35c913dd4c [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
2016-04-26 18:39:20 +00:00
Krzysztof Parzyszek 4773f647bd [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
2016-04-26 18:36:34 +00:00
Tim Northover 4397837be2 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
2016-04-26 18:29:16 +00:00
Justin Bogner 4d0dcb9891 Internalize: More consistent file header and include guards. NFC
Match the style here to the other headers in Transforms/IPO.

llvm-svn: 267581
2016-04-26 18:25:30 +00:00
David Majnemer 8cd77baebc [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
2016-04-26 18:16:49 +00:00
Manman Ren 1c3f65a18c 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
2016-04-26 18:08:06 +00:00
Saleem Abdulrasool 4c6c4e2bbb 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
2016-04-26 17:54:21 +00:00
Saleem Abdulrasool 601e029ba3 test: remove some bleeding whitespace
Kill bleeding whitespace.  NFC

llvm-svn: 267577
2016-04-26 17:54:16 +00:00
Eugene Zelenko ca943b3929 [Release notes] Mention Clang-tidy misc-fold-init-type check.
Highlighting consistency in Clang-tidy misc-fold-init-type check documentation.

llvm-svn: 267576
2016-04-26 17:54:00 +00:00
Chris Bieneman 380ebd0b2c [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
2016-04-26 17:53:25 +00:00
Etienne Bergeron bda187decd [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
2016-04-26 17:30:30 +00:00
Konstantin Zhuravlyov 71515e57f9 [AMDGPU] Move reserved vgpr count for trap handler usage to SIMachineFunctionInfo + minor commenting changes
Differential Revision: http://reviews.llvm.org/D19537

llvm-svn: 267573
2016-04-26 17:24:40 +00:00
Sanjay Patel d66607bd8c [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
2016-04-26 17:11:17 +00:00
Zachary Turner ce36c1f2ec Fix build broken due to order of initialization problem.
llvm-svn: 267571
2016-04-26 16:57:53 +00:00
Etienne Bergeron 1b94f6504b [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
2016-04-26 16:53:21 +00:00
Peter Collingbourne dbcf5b99d0 Remove unnecessary function type directives for ifuncs.
llvm-svn: 267569
2016-04-26 16:50:02 +00:00
Rafael Espindola 1b65ad1725 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
2016-04-26 16:26:45 +00:00