platform/upstream/llvm.git
8 years agoFix LWG issue #2106: move_iterators returning prvalues
Eric Fiselier [Fri, 22 Apr 2016 00:49:12 +0000 (00:49 +0000)]
Fix LWG issue #2106: move_iterators returning prvalues

llvm-svn: 267091

8 years agoFix C++03 build breakage
Eric Fiselier [Fri, 22 Apr 2016 00:47:15 +0000 (00:47 +0000)]
Fix C++03 build breakage

llvm-svn: 267090

8 years agoTry to get test passing on OS X (see comment at top of file).
Nico Weber [Fri, 22 Apr 2016 00:38:09 +0000 (00:38 +0000)]
Try to get test passing on OS X (see comment at top of file).

llvm-svn: 267089

8 years ago[asan] Disable one test on windows.
Evgeniy Stepanov [Fri, 22 Apr 2016 00:34:10 +0000 (00:34 +0000)]
[asan] Disable one test on windows.

Patch by Vitaly Buka.

llvm-svn: 267088

8 years agoclangTidyReadabilityModule: Add clangTidyUtils in libdeps, corresponding to r267003.
NAKAMURA Takumi [Fri, 22 Apr 2016 00:33:39 +0000 (00:33 +0000)]
clangTidyReadabilityModule: Add clangTidyUtils in libdeps, corresponding to r267003.

llvm-svn: 267087

8 years agoInline SectionRule::match.
Rui Ueyama [Fri, 22 Apr 2016 00:23:52 +0000 (00:23 +0000)]
Inline SectionRule::match.

This short function was used only once and didn't provide much value.

llvm-svn: 267086

8 years agoComplete LWG issue #2016. Allocators must be nothrow swappable
Eric Fiselier [Fri, 22 Apr 2016 00:15:18 +0000 (00:15 +0000)]
Complete LWG issue #2016. Allocators must be nothrow swappable

llvm-svn: 267085

8 years agoEnable stack-use-after-scope tests.
Evgeniy Stepanov [Fri, 22 Apr 2016 00:10:23 +0000 (00:10 +0000)]
Enable stack-use-after-scope tests.

Fix and enable working stack-use-after-scope tests.
Add more failing tests for the feature, for fix later.

PR27453.

Patch by Vitaly Buka.

llvm-svn: 267084

8 years agoELF: Make the special variable "." as a LinkerScript class member.
Rui Ueyama [Fri, 22 Apr 2016 00:03:13 +0000 (00:03 +0000)]
ELF: Make the special variable "." as a LinkerScript class member.

I will eventually make `evaluate` function a usual parse function
rather than a function that works on a separate token list.
This is the first step toward that.

llvm-svn: 267083

8 years ago[WebAssembly] Limit alignment hints to natural alignment.
Dan Gohman [Thu, 21 Apr 2016 23:59:48 +0000 (23:59 +0000)]
[WebAssembly] Limit alignment hints to natural alignment.

This follows the current binary format rules.

llvm-svn: 267082

8 years agoDon't gc protected symbols.
Rafael Espindola [Thu, 21 Apr 2016 23:59:19 +0000 (23:59 +0000)]
Don't gc protected symbols.

llvm-svn: 267081

8 years agoARM: restrict register class for WIN__DBZCHK
Saleem Abdulrasool [Thu, 21 Apr 2016 23:53:19 +0000 (23:53 +0000)]
ARM: restrict register class for WIN__DBZCHK

WIN__DBZCHK will insert a CBZ instruction into the stream.  This instruction
reserves 3 bits for the condition register (rn).  As such, we must ensure that
we restrict the register to a low register.  Use the tGPR class instead of GPR
to ensure that this is properly constrained.  In debug builds, we would attempt
to use lr as a condition register which would silently get truncated with no
hint that the register selection was incorrect.

llvm-svn: 267080

8 years agoAdd is_swappable/is_nothrow_swappable traits
Eric Fiselier [Thu, 21 Apr 2016 23:38:59 +0000 (23:38 +0000)]
Add is_swappable/is_nothrow_swappable traits

llvm-svn: 267079

8 years ago[sancov] using normalized filenames for blacklist checks.
Mike Aizatsky [Thu, 21 Apr 2016 23:38:45 +0000 (23:38 +0000)]
[sancov] using normalized filenames for blacklist checks.

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

llvm-svn: 267078

8 years agoFix more -Wunused-variable in non-asserts build.
David Blaikie [Thu, 21 Apr 2016 23:24:09 +0000 (23:24 +0000)]
Fix more -Wunused-variable in non-asserts build.

llvm-svn: 267077

8 years agoMake ios_base::failure visibility specified consistent
Eric Fiselier [Thu, 21 Apr 2016 23:00:33 +0000 (23:00 +0000)]
Make ios_base::failure visibility specified consistent

llvm-svn: 267076

8 years agoMachO: enable .data_region directives everywhere
Tim Northover [Thu, 21 Apr 2016 23:00:17 +0000 (23:00 +0000)]
MachO: enable .data_region directives everywhere

We'd disabled them on x86 because back in the early days some host tools
couldn't handle the new load commands. This no longer holds: anyone capable of
deploying Clang should be able to deploy its copies of ar/ranlib/etc.

rdar://25254790

llvm-svn: 267075

8 years agoFix most GCC attribute ignored warnings
Eric Fiselier [Thu, 21 Apr 2016 22:54:21 +0000 (22:54 +0000)]
Fix most GCC attribute ignored warnings

llvm-svn: 267074

8 years agoFix some -Wunused-variable warnings in non-asserts builds.
David Blaikie [Thu, 21 Apr 2016 22:53:33 +0000 (22:53 +0000)]
Fix some -Wunused-variable warnings in non-asserts builds.

llvm-svn: 267073

8 years ago[Support] Fix Wcast-qual warning
Vedant Kumar [Thu, 21 Apr 2016 22:40:59 +0000 (22:40 +0000)]
[Support] Fix Wcast-qual warning

llvm-svn: 267072

8 years agoFix PDB warnings and test
Reid Kleckner [Thu, 21 Apr 2016 22:37:55 +0000 (22:37 +0000)]
Fix PDB warnings and test

llvm-svn: 267071

8 years agoImprove error message reporting for MachineFunctionProperties
Derek Schuff [Thu, 21 Apr 2016 22:19:24 +0000 (22:19 +0000)]
Improve error message reporting for MachineFunctionProperties

When printing the properties required by a pass, only print the
properties that are set, and not those that are clear (only properties
that are set are verified, clear properties are "don't-care").

llvm-svn: 267070

8 years agoRemove dead code. NFC
Amaury Sechet [Thu, 21 Apr 2016 22:17:39 +0000 (22:17 +0000)]
Remove dead code. NFC

llvm-svn: 267069

8 years agoFix -Wreturn-type warning with HAVE_DIA_SDK is false.
Zachary Turner [Thu, 21 Apr 2016 22:16:19 +0000 (22:16 +0000)]
Fix -Wreturn-type warning with HAVE_DIA_SDK is false.

llvm-svn: 267068

8 years agoFix pdbdump-headers.test after guid format change.
Zachary Turner [Thu, 21 Apr 2016 22:13:25 +0000 (22:13 +0000)]
Fix pdbdump-headers.test after guid format change.

llvm-svn: 267067

8 years agoFix for case sensitive filename failure.
Zachary Turner [Thu, 21 Apr 2016 22:08:27 +0000 (22:08 +0000)]
Fix for case sensitive filename failure.

llvm-svn: 267066

8 years agoELF: Change how to handle KEEP linker script command.
Rui Ueyama [Thu, 21 Apr 2016 22:00:51 +0000 (22:00 +0000)]
ELF: Change how to handle KEEP linker script command.

You can instruct the linker to not discard sections even if they
are unused and --gc-sections option is given. The linker script
command for doing that is KEEP. The syntax is KEEP(foo) where foo
is a section name. KEEP commands are written in SECTIONS command,
so you can specify the order of sections *and* which sections
will be kept.

Each sub-command in SECTIONS command are translated into SectionRule
object. Previously, each SectionRule has `Keep` bit. However,
if you think about it, this hid information in too deep in elements
of a list. Semantically, KEEP commands aren't really related to
SECTIONS subcommands. We can keep the section list for KEEP in a
separate list. This patch does that.

llvm-svn: 267065

8 years agoFixed flag description
Mike Aizatsky [Thu, 21 Apr 2016 22:00:13 +0000 (22:00 +0000)]
Fixed flag description

Summary:
asan-use-after-return control feature we call use-after-return or
stack-use-after-return.

Reviewers: kcc, aizatsky, eugenis

Subscribers: llvm-commits

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

llvm-svn: 267064

8 years agoInternalize linkonce_odr more often.
Rafael Espindola [Thu, 21 Apr 2016 21:44:25 +0000 (21:44 +0000)]
Internalize linkonce_odr more often.

Since there is a copy in every translation unit that uses them, they can
be omitted from the symbol table if the address is not significant.

This still doesn't catch as many cases as the gold plugin. The
difference is that we check canBeOmittedFromSymbolTable in each file and
use lazy loading which limits what it can do. Gold checks it in the merged file.

I think the correct way of getting the same results as gold is just to
cache in the IR the result of canBeOmittedFromSymbolTable.

llvm-svn: 267063

8 years ago[CUDA] removed unneeded __nvvm_reflect_anchor()
Artem Belevich [Thu, 21 Apr 2016 21:40:27 +0000 (21:40 +0000)]
[CUDA] removed unneeded __nvvm_reflect_anchor()

Since r265060 LLVM infers correct __nvvm_reflect attributes, so
explicit declaration of __nvvm_reflect() is no longer needed.

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

llvm-svn: 267062

8 years agoRemove various warnings. NFC
Amaury Sechet [Thu, 21 Apr 2016 21:36:11 +0000 (21:36 +0000)]
Remove various warnings. NFC

llvm-svn: 267061

8 years ago[esan] EfficiencySanitizer base runtime library
Derek Bruening [Thu, 21 Apr 2016 21:32:25 +0000 (21:32 +0000)]
[esan] EfficiencySanitizer base runtime library

Summary:
Adds the initial version of a runtime library for the new
EfficiencySanitizer ("esan") family of tools.  The library includes:

+ Slowpath code via callouts from the compiler instrumentation for
  each memory access.

+ Registration of atexit() to call finalization code.

+ Runtime option flags controlled by the environment variable
  ESAN_OPTIONS.  The common sanitizer flags are supported such as
  verbosity and log_path.

+ An initial simple test.

Still TODO: common code for libc interceptors and shadow memory mapping,
and tool-specific code for shadow state updating.

Reviewers: eugenis, vitalybuka, aizatsky, filcab

Subscribers: filcab, vkalintiris, kubabrecka, llvm-commits, zhaoqin, kcc

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

llvm-svn: 267060

8 years ago[esan] EfficiencySanitizer driver flags
Derek Bruening [Thu, 21 Apr 2016 21:32:04 +0000 (21:32 +0000)]
[esan] EfficiencySanitizer driver flags

Summary:
Adds a framework to enable the instrumentation pass for the new
EfficiencySanitizer ("esan") family of tools.  Adds a flag for esan's
cache fragmentation tool via -fsanitize=efficiency-cache-frag.
Adds appropriate tests for the new flag.

Reviewers: eugenis, vitalybuka, aizatsky, filcab

Subscribers: filcab, kubabrecka, llvm-commits, zhaoqin, kcc

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

llvm-svn: 267059

8 years ago[esan] EfficiencySanitizer instrumentation pass
Derek Bruening [Thu, 21 Apr 2016 21:30:22 +0000 (21:30 +0000)]
[esan] EfficiencySanitizer instrumentation pass

Summary:
Adds an instrumentation pass for the new EfficiencySanitizer ("esan")
performance tuning family of tools.  Multiple tools will be supported
within the same framework.  Preliminary support for a cache fragmentation
tool is included here.

The shared instrumentation includes:
+ Turn mem{set,cpy,move} instrinsics into library calls.
+ Slowpath instrumentation of loads and stores via callouts to
  the runtime library.
+ Fastpath instrumentation will be per-tool.
+ Which memory accesses to ignore will be per-tool.

Reviewers: eugenis, vitalybuka, aizatsky, filcab

Subscribers: filcab, vkalintiris, pcc, silvas, llvm-commits, zhaoqin, kcc

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

llvm-svn: 267058

8 years agoAdd utility function to manipulate attributes on CallSite. NFC
Amaury Sechet [Thu, 21 Apr 2016 21:29:10 +0000 (21:29 +0000)]
Add utility function to manipulate attributes on CallSite. NFC

Summary: As per title. This will help work on the C API.

Reviewers: Wallbraker, whitequark, joker.eph, echristo, rafael

Subscribers: joker.eph, llvm-commits

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

llvm-svn: 267057

8 years agoFix a typo in an error message. Caught by Sean Silva!
Kevin Enderby [Thu, 21 Apr 2016 21:20:40 +0000 (21:20 +0000)]
Fix a typo in an error message.  Caught by Sean Silva!

llvm-svn: 267056

8 years ago[ProfileData] Report errors from InstrProfSymtab::create
Vedant Kumar [Thu, 21 Apr 2016 21:07:25 +0000 (21:07 +0000)]
[ProfileData] Report errors from InstrProfSymtab::create

InstrProfSymtab::create can fail with instrprof_error::malformed, but
this error is silently dropped. Propagate the error up to the caller so
we fail early.

Eventually, I'd like to transition ProfileData over to the new Error
class so we can't ignore hard failures like this.

llvm-svn: 267055

8 years agoSplit interesting warnings off from -Wfloat-conversion
Richard Trieu [Thu, 21 Apr 2016 21:04:55 +0000 (21:04 +0000)]
Split interesting warnings off from -Wfloat-conversion

Restructure the implict floating point to integer conversions so that
interesting sub-groups are under different flags.  Breakdown of warnings:

No warning:
Exact conversions from floating point to integer:
int x = 10.0;
int x = 1e10;

-Wliteral-conversion - Floating point literal to integer with rounding:
int x = 5.5;
int x = -3.4;

-Wfloat-conversion - All conversions not covered by the above two:
int x = GetFloat();
int x = 5.5 + 3.5;

-Wfloat-zero-conversion - The expression converted has a non-zero floating
point value that gets converted to a zero integer value, excluded the cases
falling under -Wliteral-conversion.  Subset of -Wfloat-conversion.
int x = 1.0 / 2.0;

-Wfloat-overflow-conversion - The floating point value is outside the range
of the integer type, exluding cases from -Wliteral conversion.  Subset of
-Wfloat-conversion.
char x = 500;
char x = -1000;

-Wfloat-bool-conversion - Any conversion of a floating point type to bool.
Subset of -Wfloat-conversion.
if (GetFloat()) {}
bool x = 5.0;

-Wfloat-bool-constant-conversion - Conversion of a compile time evaluatable
floating point value to bool.  Subset of -Wfloat-bool-conversion.
bool x = 1.0;
bool x = 4.0 / 20.0;

Also add EvaluateAsFloat to Sema, which is similar to EvaluateAsInt, but for
floating point values.

llvm-svn: 267054

8 years agoadd tests for disguised fabs/fneg
Sanjay Patel [Thu, 21 Apr 2016 21:02:25 +0000 (21:02 +0000)]
add tests for disguised fabs/fneg

llvm-svn: 267053

8 years ago[MachineBasicBlock] Make the pass argument truly mandatory when
Quentin Colombet [Thu, 21 Apr 2016 21:01:13 +0000 (21:01 +0000)]
[MachineBasicBlock] Make the pass argument truly mandatory when
splitting edges.

MachineBasicBlock::SplitCriticalEdges will crash if a nullptr would have
been passed for the Pass argument. Do not allow that by turning this
argument into a reference.
The alternative would have been to make the Pass a truly optional
argument, but although this is easy to do, I was afraid users using it
like this would not be aware the livness information, dominator tree and
such would silently be broken.

llvm-svn: 267052

8 years agouse FileCheck; add test for disguised fabs
Sanjay Patel [Thu, 21 Apr 2016 20:58:58 +0000 (20:58 +0000)]
use FileCheck; add test for disguised fabs

llvm-svn: 267051

8 years agoAdd natvis visualizers for endian types.
Zachary Turner [Thu, 21 Apr 2016 20:58:41 +0000 (20:58 +0000)]
Add natvis visualizers for endian types.

This allows ulittle* and ubig* types to be visualized properly
in VS.

Differential Revision: http://reviews.llvm.org/D19339
Reviewed By: Aaron Ballman

llvm-svn: 267050

8 years agoRefactor raw pdb dumper into library
Zachary Turner [Thu, 21 Apr 2016 20:58:35 +0000 (20:58 +0000)]
Refactor raw pdb dumper into library

PDB parsing code was hand-rolled into llvm-pdbdump. This patch moves the
parsing of this code into DebugInfoPDB and makes the dumper use this.

This is achieved by implementing the skeleton of RawPdbSession, the
non-DIA counterpart to the existing PDB read interface. None of the type /
source file / etc information is accessible yet, so this implementation is
not yet close to achieving parity with the DIA counterpart, but the
RawSession class simply holds a reference to a PDBFile class which handles
parsing the file format. Additionally a PDBStream class is introduced
which allows accessing the bytes of a particular stream in a PDB file.

Differential Revision: http://reviews.llvm.org/D19343
Reviewed By: majnemer

llvm-svn: 267049

8 years agoUpdate Go OS Plugin for newer runtimes.
Ryan Brown [Thu, 21 Apr 2016 20:57:28 +0000 (20:57 +0000)]
Update Go OS Plugin for newer runtimes.

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

llvm-svn: 267048

8 years agoRemove SymPair and instead use two DefinedRegulars instead.
Rui Ueyama [Thu, 21 Apr 2016 20:50:15 +0000 (20:50 +0000)]
Remove SymPair and instead use two DefinedRegulars instead.

I noticed that I was looking for the definition of SymPair when hacking
the Writer, only to find that it is just a pair of DefinedRegular symbols.
I don't think it provides more values than the cost of using brainpower
to memorize the type. I didn't roll back r266317, which introduced SymPair,
because the patch removes code repetitions. I ported that change to new
code.

llvm-svn: 267047

8 years ago[MachineBasicBlock] Refactor SplitCriticalEdge to expose a query API.
Quentin Colombet [Thu, 21 Apr 2016 20:46:27 +0000 (20:46 +0000)]
[MachineBasicBlock] Refactor SplitCriticalEdge to expose a query API.

Introduce canSplitCriticalEdge, so that clients can now query whether or
not a critical edge can be split without actually needing to split it.
This may be useful when gathering information for cost models for
instance.

llvm-svn: 267046

8 years agoStart adding support for internalizing shared libraries.
Rafael Espindola [Thu, 21 Apr 2016 20:35:25 +0000 (20:35 +0000)]
Start adding support for internalizing shared libraries.

llvm-svn: 267045

8 years agoELF: Change the return type of getSectionOrder.
Rui Ueyama [Thu, 21 Apr 2016 20:30:00 +0000 (20:30 +0000)]
ELF: Change the return type of getSectionOrder.

Also changed the function name and added comments.

llvm-svn: 267044

8 years agohange the variable name big_size to BigSize. Caught by Rafael Espíndola!
Kevin Enderby [Thu, 21 Apr 2016 20:29:49 +0000 (20:29 +0000)]
hange the variable name big_size to BigSize. Caught by Rafael Espíndola!

llvm-svn: 267043

8 years agoZero-initialize members of the CpuHashInfoTy structure for AsmParser
Andrew Kaylor [Thu, 21 Apr 2016 20:09:35 +0000 (20:09 +0000)]
Zero-initialize members of the CpuHashInfoTy structure for AsmParser

llvm-svn: 267042

8 years ago[RuntimeDyld] Fix conservative over-allocation of memory for common symbols.
Lang Hames [Thu, 21 Apr 2016 20:08:06 +0000 (20:08 +0000)]
[RuntimeDyld] Fix conservative over-allocation of memory for common symbols.

The previous allocation code was over-estimating the amount of memory required.

No test case: we don't currently have a good way to detect conervative
over-allocation.

llvm-svn: 267041

8 years agoclang-cl: Don't assert on using /Yc with non-source files, PR27450
Nico Weber [Thu, 21 Apr 2016 19:59:10 +0000 (19:59 +0000)]
clang-cl: Don't assert on using /Yc with non-source files, PR27450

Move phase handling after input type validation.

llvm-svn: 267040

8 years agoNFC: fix copy / paste comment
JF Bastien [Thu, 21 Apr 2016 19:53:39 +0000 (19:53 +0000)]
NFC: fix copy / paste comment

llvm-svn: 267039

8 years ago[Hexagon] Properly recognize register alt names
Krzysztof Parzyszek [Thu, 21 Apr 2016 19:49:53 +0000 (19:49 +0000)]
[Hexagon] Properly recognize register alt names

llvm-svn: 267038

8 years agoFix crash in llvm-objdump with -macho -objc-meta-data that was trying dump a non...
Kevin Enderby [Thu, 21 Apr 2016 19:49:29 +0000 (19:49 +0000)]
Fix crash in llvm-objdump with -macho -objc-meta-data that was trying dump a non-existent section.

Showed up in running on a large binary with the missing section.  I could create a fake
test case if anyone really wants but the fix is pretty obvious.

rdar://25837034

llvm-svn: 267037

8 years agoNFC: fix nonsensical comment
JF Bastien [Thu, 21 Apr 2016 19:41:48 +0000 (19:41 +0000)]
NFC: fix nonsensical comment

llvm-svn: 267036

8 years agoFolding compares with unescaped allocations
Sanjoy Das [Thu, 21 Apr 2016 19:26:45 +0000 (19:26 +0000)]
Folding compares with unescaped allocations

Summary:
If we know that the pointer allocated within a function does not escape,
we can fold away comparisons that are done with global pointers

Patch by Anna Thomas!

Reviewers: reames, majnemer, sanjoy

Subscribers: mgrang, mcrosier, majnemer, llvm-commits

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

llvm-svn: 267035

8 years ago[Hexagon] Expand handling of the small-data/bss section
Krzysztof Parzyszek [Thu, 21 Apr 2016 18:56:45 +0000 (18:56 +0000)]
[Hexagon] Expand handling of the small-data/bss section

llvm-svn: 267034

8 years ago[RegisterBankInfo] Change the API for the verify methods.
Quentin Colombet [Thu, 21 Apr 2016 18:34:43 +0000 (18:34 +0000)]
[RegisterBankInfo] Change the API for the verify methods.

Return bool instead of void so that it is natural to put the calls into
asserts.

llvm-svn: 267033

8 years agoELF: support -- version of discard-{all,locals}
Saleem Abdulrasool [Thu, 21 Apr 2016 18:29:13 +0000 (18:29 +0000)]
ELF: support -- version of discard-{all,locals}

GNU ld and gold only support the discard-all and discard-locals with two dashes.
Retain the compatibility with the one dash spelling, but also accept the two
dashed form.

llvm-svn: 267032

8 years agoELF: alias `--no-copy-dt-needed-entries` to `--no-add-needed`
Saleem Abdulrasool [Thu, 21 Apr 2016 18:29:09 +0000 (18:29 +0000)]
ELF: alias `--no-copy-dt-needed-entries` to `--no-add-needed`

`--add-needed` and `--no-add-needed` have been deprecated due to the similarity
of their spelling to `--as-needed` and `--no-as-needed`.  They have been renamed
to `--copy-dt-needed-entries` and `--no-copy-dt-needed-entries`.

llvm-svn: 267031

8 years agoAMDGPU: Fix debug name of pass to better match
Matt Arsenault [Thu, 21 Apr 2016 18:21:54 +0000 (18:21 +0000)]
AMDGPU: Fix debug name of pass to better match

I get this wrong every time I try to debug this.

llvm-svn: 267030

8 years agoLegalizeDAG: Move unaligned load/store expansion to TLI
Matt Arsenault [Thu, 21 Apr 2016 18:19:11 +0000 (18:19 +0000)]
LegalizeDAG: Move unaligned load/store expansion to TLI

When custom lowered, this is not called if the store is custom
lowered. Move it to be a utility function so targets can
easily expand unaligned accesses when custom lowering.

llvm-svn: 267029

8 years ago[asan] Mark strdup test as unsupported on arm/linux.
Evgeniy Stepanov [Thu, 21 Apr 2016 18:18:09 +0000 (18:18 +0000)]
[asan] Mark strdup test as unsupported on arm/linux.

llvm-svn: 267028

8 years ago[clang-tidy] Fix broken build bot.
Etienne Bergeron [Thu, 21 Apr 2016 18:15:35 +0000 (18:15 +0000)]
[clang-tidy] Fix broken build bot.

Summary:
There is a build bot that doesn't support 'constexpr'.

```
FAILED: C:\PROGRA~2\MICROS~1.0\VC\bin\amd64\cl.exe   /nologo /TP /DWIN32 /D_WINDOWS   /W4 -wd4141 -wd4146 -wd4180 -wd4244 -wd4258 -wd4267 -wd4291 -wd4345 -wd4351 -wd4355 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4800 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4324 -w14062 -we4238 /Zc:inline /Oi /Zc:rvalueCast /MD /O2 /Ob2 -Itools\clang\tools\extra\clang-tidy\misc -ID:\buildslave\clang-x64-ninja-win7\llvm\tools\clang\tools\extra\clang-tidy\misc -ID:\buildslave\clang-x64-ninja-win7\llvm\tools\clang\include -Itools\clang\include -Iinclude -ID:\buildslave\clang-x64-ninja-win7\llvm\include    -UNDEBUG  /EHs-c- /GR- /showIncludes -DCLANG_ENABLE_ARCMT -DCLANG_ENABLE_OBJC_REWRITER -DCLANG_ENABLE_STATIC_ANALYZER -DGTEST_HAS_RTTI=0 -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_DEBUG_POINTER_IMPL="" -D_GNU_SOURCE -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS /Fotools\clang\tools\extra\clang-tidy\misc\CMakeFiles\clangTidyMiscModule.dir\SuspiciousStringCompareCheck.cpp.obj /Fdtools\clang\tools\extra\clang-tidy\misc\CMakeFiles\clangTidyMiscModule.dir\ /FS -c D:\buildslave\clang-x64-ninja-win7\llvm\tools\clang\tools\extra\clang-tidy\misc\SuspiciousStringCompareCheck.cpp
D:\buildslave\clang-x64-ninja-win7\llvm\tools\clang\tools\extra\clang-tidy\misc\SuspiciousStringCompareCheck.cpp(25) : error C2144: syntax error : 'char' should be preceded by ';'
D:\buildslave\clang-x64-ninja-win7\llvm\tools\clang\tools\extra\clang-tidy\misc\SuspiciousStringCompareCheck.cpp(25) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
ninja: build stopped: subcommand failed.
program finished with exit code 1
```

Reviewers: alexfh, sbenza

Subscribers: cfe-commits

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

llvm-svn: 267027

8 years ago[Release Notes] Mention Clang-tidy misc-string-constructor and misc-suspicious-string...
Eugene Zelenko [Thu, 21 Apr 2016 18:13:09 +0000 (18:13 +0000)]
[Release Notes] Mention Clang-tidy misc-string-constructor and misc-suspicious-string-compare checks.

Fix excessive line in misc-string-constructor documentation.

llvm-svn: 267026

8 years ago[RegisterBankInfo] Change the representation of the partial mappings.
Quentin Colombet [Thu, 21 Apr 2016 18:09:34 +0000 (18:09 +0000)]
[RegisterBankInfo] Change the representation of the partial mappings.

Instead of holding a mask, hold two value: the start index and the
length of the mapping. This is a more compact representation, although
less powerful. That being said, arbitrary masks would not have worked
for the generic so do not allow them in the first place.

llvm-svn: 267025

8 years agoDAGCombiner: Reduce 64-bit BFE pattern to pattern on 32-bit component
Matt Arsenault [Thu, 21 Apr 2016 18:03:06 +0000 (18:03 +0000)]
DAGCombiner: Reduce 64-bit BFE pattern to pattern on 32-bit component

If the extracted bits are restricted to the upper half or lower half,
this can be truncated.

llvm-svn: 267024

8 years ago[instcombine][unordered] Extend load(select) transform to handle unordered loads
Philip Reames [Thu, 21 Apr 2016 17:59:40 +0000 (17:59 +0000)]
[instcombine][unordered] Extend load(select) transform to handle unordered loads

llvm-svn: 267023

8 years agoInitial implementation of optimization bisect support.
Andrew Kaylor [Thu, 21 Apr 2016 17:58:54 +0000 (17:58 +0000)]
Initial implementation of optimization bisect support.

This patch implements a optimization bisect feature, which will allow optimizations to be selectively disabled at compile time in order to track down test failures that are caused by incorrect optimizations.

The bisection is enabled using a new command line option (-opt-bisect-limit).  Individual passes that may be skipped call the OptBisect object (via an LLVMContext) to see if they should be skipped based on the bisect limit.  A finer level of control (disabling individual transformations) can be managed through an addition OptBisect method, but this is not yet used.

The skip checking in this implementation is based on (and replaces) the skipOptnoneFunction check.  Where that check was being called, a new call has been inserted in its place which checks the bisect limit and the optnone attribute.  A new function call has been added for module and SCC passes that behaves in a similar way.

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

llvm-svn: 267022

8 years agoSplit IntrReadArgMem into IntrReadMem and IntrArgMemOnly
Nicolai Haehnle [Thu, 21 Apr 2016 17:48:02 +0000 (17:48 +0000)]
Split IntrReadArgMem into IntrReadMem and IntrArgMemOnly

Summary:
IntrReadWriteArgMem simply becomes IntrArgMemOnly.

So there are fewer intrinsic properties that express their orthogonality
better, and correspond more closely to the corresponding IR attributes.

Suggested by: Philip Reames

Reviewers: joker.eph, reames, tstellarAMD

Subscribers: jholewinski, arsenm, llvm-commits

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

llvm-svn: 267021

8 years ago[LTO] Discard names for values that are not global by default.
Davide Italiano [Thu, 21 Apr 2016 17:46:38 +0000 (17:46 +0000)]
[LTO] Discard names for values that are not global by default.

Rafael reported on the mailing list that this reduces peak memory
usage while linking llvm-as by 15%. It makes sense to make it
the default, and introduce an inverse knob -lto-no-discard-value-names
for those who want to restore the old behavior.

llvm-svn: 267020

8 years ago[unordered] unordered loads from null are still unreachable
Philip Reames [Thu, 21 Apr 2016 17:45:05 +0000 (17:45 +0000)]
[unordered] unordered loads from null are still unreachable

llvm-svn: 267019

8 years agoReduce templating. NFC.
Rafael Espindola [Thu, 21 Apr 2016 17:37:11 +0000 (17:37 +0000)]
Reduce templating. NFC.

llvm-svn: 267018

8 years ago[PowerPC] [SSP] Fix stack guard load for 32-bit.
Marcin Koscielnicki [Thu, 21 Apr 2016 17:36:05 +0000 (17:36 +0000)]
[PowerPC] [SSP] Fix stack guard load for 32-bit.

r266809 incorrectly used LD to load the stack guard, it should be LWZ.

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

llvm-svn: 267017

8 years ago[LoopUtils] Fix typo in comment
Adam Nemet [Thu, 21 Apr 2016 17:33:22 +0000 (17:33 +0000)]
[LoopUtils] Fix typo in comment

llvm-svn: 267016

8 years ago[LoopUtils] Add asserts to findStringMetadataForLoop. NFC
Adam Nemet [Thu, 21 Apr 2016 17:33:20 +0000 (17:33 +0000)]
[LoopUtils] Add asserts to findStringMetadataForLoop. NFC

These ensure that operand array has at least one element and it is the
self-reference.

llvm-svn: 267015

8 years ago[LoopUtils] Move def of findStringMetadataForLoop to LoopUtils.cpp. NFC
Adam Nemet [Thu, 21 Apr 2016 17:33:17 +0000 (17:33 +0000)]
[LoopUtils] Move def of findStringMetadataForLoop to LoopUtils.cpp. NFC

The decl is in LoopUtils.h.  I think that this was added to
LoopVersioningLICM.cpp by mistake.

llvm-svn: 267014

8 years ago[LoopUtils] Rename {check->find}StringMetadata{Into->For}Loop. NFC
Adam Nemet [Thu, 21 Apr 2016 17:33:12 +0000 (17:33 +0000)]
[LoopUtils] Rename {check->find}StringMetadata{Into->For}Loop. NFC

"Into" was misleading.  I am also planning to use this helper to look
for loop metadata and return the argument, so find seems like a better
name.

llvm-svn: 267013

8 years agoDelete the needsPlt target hook.
Rafael Espindola [Thu, 21 Apr 2016 17:30:24 +0000 (17:30 +0000)]
Delete the needsPlt target hook.

It can be made redundant with getRelExpr.

llvm-svn: 267012

8 years ago[clang-tidy] New checker to detect suspicious string constructor.
Etienne Bergeron [Thu, 21 Apr 2016 17:28:08 +0000 (17:28 +0000)]
[clang-tidy] New checker to detect suspicious string constructor.

Summary:
Checker to validate string constructor parameters.

A common mistake is to swap parameter for the fill-constructor.
```
  std::string str('x', 4);
  std::string str('4', x);
```

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 267011

8 years agoFix builds broken in r267008.
Eugene Zelenko [Thu, 21 Apr 2016 17:27:04 +0000 (17:27 +0000)]
Fix builds broken in r267008.

llvm-svn: 267010

8 years ago[clang-tidy] Add new checker for comparison with runtime string functions.
Etienne Bergeron [Thu, 21 Apr 2016 17:19:36 +0000 (17:19 +0000)]
[clang-tidy] Add new checker for comparison with runtime string functions.

Summary:
This checker is validating suspicious usage of string compare functions.

Example:
```
  if (strcmp(...))       // Implicitly compare to zero
  if (!strcmp(...))      // Won't warn
  if (strcmp(...) != 0)  // Won't warn
```

This patch was checked over large amount of code.
There is three checks:
  [*] Implicit comparator to zero (coding-style, many warnings found),
  [*] Suspicious implicit cast to non-integral (bugs!?, almost none found),
  [*] Comparison to suspicious constant (bugs!?, found two cases),

Example:
[[https://github.com/kylepjohnson/sigma/blob/master/sigma/native-installers/debian/dependencies/files/opt/sigma/E/HEURISTICS/che_to_precgen.c |
https://github.com/kylepjohnson/sigma/blob/master/sigma/native-installers/debian/dependencies/files/opt/sigma/E/HEURISTICS/che_to_precgen.c]]

```
      else if(strcmp(id, "select") == 0)
      {
         array->array[i].key1 = 25;
      }
      else if(strcmp(id, "sk") == 28)      // BUG!?
      {
         array->array[i].key1 = 20;
      }
```

Reviewers: alexfh

Subscribers: Eugene.Zelenko, cfe-commits

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

llvm-svn: 267009

8 years agoFix Clang-tidy misc-unused-using-decls and Include What You Use warnings.
Eugene Zelenko [Thu, 21 Apr 2016 17:14:10 +0000 (17:14 +0000)]
Fix Clang-tidy misc-unused-using-decls and Include What You Use warnings.

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

llvm-svn: 267008

8 years ago[LTO] An interesting case which shows up how we handle common symbols.
Davide Italiano [Thu, 21 Apr 2016 17:11:39 +0000 (17:11 +0000)]
[LTO] An interesting case which shows up how we handle common symbols.

The gold plugin logic for common symbols is a little bit convoluted
as the plugin API has not an explicit way to update the alignment.
In gold, then, we need to keep the bitcode symbol @a around because
that's the only way to get the alignment right in the final object.

In lld, this is not true. We already have all the informations we
need about common symbols (size/alignment) so we don't have to
keep the existing symbol and pass it to the mover.

llvm-svn: 267007

8 years ago[instcombine][unordered] Implement *-load forwarding for unordered atomics
Philip Reames [Thu, 21 Apr 2016 17:03:33 +0000 (17:03 +0000)]
[instcombine][unordered] Implement *-load forwarding for unordered atomics

This builds on 266999 which made FindAvailableValue do the right thing.  Tests included show the newly enabled transforms and those which disabled either due to conservatism or correctness requirements.

llvm-svn: 267006

8 years agoDon't recompute getRelExpr. NFC.
Rafael Espindola [Thu, 21 Apr 2016 16:59:25 +0000 (16:59 +0000)]
Don't recompute getRelExpr. NFC.

llvm-svn: 267005

8 years agoFixed Dwarf debug info emission to skip DILexicalBlockFile entries.
Amjad Aboud [Thu, 21 Apr 2016 16:58:49 +0000 (16:58 +0000)]
Fixed Dwarf debug info emission to skip DILexicalBlockFile entries.
Before this fix, DILexicalBlockFile entries were skipped only in some cases and were not in other cases.

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

llvm-svn: 267004

8 years ago[clang-tidy] Cleanup some ast-matchers and lift some to utils.
Etienne Bergeron [Thu, 21 Apr 2016 16:57:56 +0000 (16:57 +0000)]
[clang-tidy] Cleanup some ast-matchers and lift some to utils.

Summary:
Little cleanup to lift-out and to remove some frequently used
ast-matchers.

Some of theses matchers are candidates to be lifted to ASTMatchers.h.

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 267003

8 years agoMoves needsPlt to Writer.cpp.
Rafael Espindola [Thu, 21 Apr 2016 16:57:32 +0000 (16:57 +0000)]
Moves needsPlt to Writer.cpp.

It was only used there.

llvm-svn: 267002

8 years agoAPI: fix a -Wunused-variable warning
Saleem Abdulrasool [Thu, 21 Apr 2016 16:56:02 +0000 (16:56 +0000)]
API: fix a -Wunused-variable warning

expr_log is only conditionally used via preprocessing.  Ensure that we guard the
definition accordingly.  NFC.

llvm-svn: 267001

8 years agoHost: fix some -Wformat-pedantic warnings
Saleem Abdulrasool [Thu, 21 Apr 2016 16:55:58 +0000 (16:55 +0000)]
Host: fix some -Wformat-pedantic warnings

Add explicit casts for function pointer to void * for %p conversion.  NFC.

llvm-svn: 267000

8 years ago[unordered] Add tests and conservative handling in support of future changes [NFCI]
Philip Reames [Thu, 21 Apr 2016 16:51:08 +0000 (16:51 +0000)]
[unordered] Add tests and conservative handling in support of future changes [NFCI]

This change adds a couple of test cases to make sure FindAvailableLoadedValue does the right thing.  At the moment, the code added is dead, but separating it makes follow on changes far more obvious.

llvm-svn: 266999

8 years agoAddress Philip's post-commit feedback for r266987. NFC.
Chad Rosier [Thu, 21 Apr 2016 16:18:02 +0000 (16:18 +0000)]
Address Philip's post-commit feedback for r266987. NFC.

llvm-svn: 266998

8 years agoMinor comment cleanup [NFC]
Philip Reames [Thu, 21 Apr 2016 16:15:19 +0000 (16:15 +0000)]
Minor comment cleanup [NFC]

llvm-svn: 266997

8 years agoFix test to run everywhere.
Rafael Espindola [Thu, 21 Apr 2016 15:51:28 +0000 (15:51 +0000)]
Fix test to run everywhere.

Because of X86 instead of x86 is was masked as unsupported everywhere.

llvm-svn: 266996

8 years agoFix recursive -only-needed.
Rafael Espindola [Thu, 21 Apr 2016 14:56:33 +0000 (14:56 +0000)]
Fix recursive -only-needed.

We were assuming that only linkonce_odr GVs were lazy linked.

llvm-svn: 266995

8 years ago[tsan] Rename ReportThread->pid to ReportThread->os_id
Kuba Brecka [Thu, 21 Apr 2016 14:49:25 +0000 (14:49 +0000)]
[tsan] Rename ReportThread->pid to ReportThread->os_id

The field "pid" in ReportThread is used to store the OS-provided thread ID (pthread_self or gettid). The name "pid" suggests it's a process ID, which it isn't. Let's rename it.

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

llvm-svn: 266994

8 years ago[x86] Force mixes asm syntax test to check for x86
Renato Golin [Thu, 21 Apr 2016 14:40:06 +0000 (14:40 +0000)]
[x86] Force mixes asm syntax test to check for x86

llvm-svn: 266993

8 years ago[Clang-tidy] Fix for crash in modernize-raw-string-literal check
Alexander Kornienko [Thu, 21 Apr 2016 14:39:12 +0000 (14:39 +0000)]
[Clang-tidy] Fix for crash in modernize-raw-string-literal check

Summary:
Clang-tidy modernize-raw-string-literal check crashes on run-time assert while it is evaluating compiler predefined identifiers such as
- __FUNCTION__
- __func__
- __PRETTY_FUNCTION__

Check is asserting because it cannot find opening quote for such string literal. It occurs only on debug build config.
I think that it would be good to prune such cases by crossing off predefined expressions - there is no need to evaluate such matches.

Reviewers: LegalizeAdulthood, alexfh

Subscribers: cfe-commits

Patch by Marek Jenda!

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

llvm-svn: 266992