OSDN Git Service

android-x86/external-llvm.git
8 years ago[LoopSimplify] Preserve LCSSA when merging exit blocks.
Michael Zolotukhin [Wed, 8 Jun 2016 23:13:21 +0000 (23:13 +0000)]
[LoopSimplify] Preserve LCSSA when merging exit blocks.

Summary:
This fixes PR26682. Also add LCSSA as a preserved pass to LoopSimplify,
that looks correct to me and allows to write a test for the issue.

Reviewers: chandlerc, bogner, sanjoy

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272224 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[PDB] Move PDB functions to a separate file.
Rui Ueyama [Wed, 8 Jun 2016 23:11:14 +0000 (23:11 +0000)]
[PDB] Move PDB functions to a separate file.

We are going to use the hash functions from TPI streams.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272223 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[LoopUnroll] Check that DT is available before trying to verify it.
Michael Zolotukhin [Wed, 8 Jun 2016 22:49:59 +0000 (22:49 +0000)]
[LoopUnroll] Check that DT is available before trying to verify it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272221 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CMake] Cleanup version check for 2.8.11
Chris Bieneman [Wed, 8 Jun 2016 22:48:12 +0000 (22:48 +0000)]
[CMake] Cleanup version check for 2.8.11

We are always greater than CMake 2.8.11, so we don't need this check.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272220 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CMake] Cleanup version check for 2.8.12
Chris Bieneman [Wed, 8 Jun 2016 22:48:01 +0000 (22:48 +0000)]
[CMake] Cleanup version check for 2.8.12

Since we're always greater than 2.8.12, we don't need this check anymore.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272219 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CMake] Cleanup version checks for CMake 3.0
Chris Bieneman [Wed, 8 Jun 2016 22:38:30 +0000 (22:38 +0000)]
[CMake] Cleanup version checks for CMake 3.0

This just removes some redundant checks and updates warning text.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272218 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agocmake: Simplify add_lit_testsuites
Justin Bogner [Wed, 8 Jun 2016 22:36:37 +0000 (22:36 +0000)]
cmake: Simplify add_lit_testsuites

cmake 3.4 introduced LIST_DIRECTORIES to glob recurse, which can be
used to simplify this code greatly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272217 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CMake] Cleanup uses of USES_TERMINAL
Chris Bieneman [Wed, 8 Jun 2016 22:19:25 +0000 (22:19 +0000)]
[CMake] Cleanup uses of USES_TERMINAL

Now that we are on CMake 3.4.3 we no longer need a version check around this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272211 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[RegBankSelect] Print out the actual mapping of the operands.
Quentin Colombet [Wed, 8 Jun 2016 21:55:30 +0000 (21:55 +0000)]
[RegBankSelect] Print out the actual mapping of the operands.

This improves the debuggability of the pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272210 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[RegBankSelect] Remove a debug print of a potentially dead instruction.
Quentin Colombet [Wed, 8 Jun 2016 21:55:29 +0000 (21:55 +0000)]
[RegBankSelect] Remove a debug print of a potentially dead instruction.

For complex rewrittings, which do not occur currently, the related
machine instruction may have been deleted in the process. Therefore, do
not try to print it after the mapping is applied.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272209 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[RegisterBankInfo] Avoid code duplication in OperandsMapper for the computation of...
Quentin Colombet [Wed, 8 Jun 2016 21:55:26 +0000 (21:55 +0000)]
[RegisterBankInfo] Avoid code duplication in OperandsMapper for the computation of the end of range.

Refactor the code so that we do not compute in two different places the
end iterator for the range of new virtual registers for a given operand.
Although this refactoring was intended as NFC, this is not the case
because it actually fixes a bug where we were returning a range off by 1
(too long). Right now, this could not result in an actual bug because we
were accessing this range via the BreakDown size of the related operand.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272208 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[RegisterBankInfo] Add dump/print methods for OperandsMapper.
Quentin Colombet [Wed, 8 Jun 2016 21:55:23 +0000 (21:55 +0000)]
[RegisterBankInfo] Add dump/print methods for OperandsMapper.

Improve debuggability of the OperandsMapper helper class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272207 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[SLPVectorizer] Handle GEP with differing constant index types
Michael Zolotukhin [Wed, 8 Jun 2016 21:55:16 +0000 (21:55 +0000)]
[SLPVectorizer] Handle GEP with differing constant index types

Summary:
This fixes PR27617.

Bug description: The SLPVectorizer asserts on encountering GEPs with different index types, such as i8 and i64.

The patch includes a simple relaxation of the assert to allow constants being of different types, along with a regression test that will provoke the unrelaxed assert.

Reviewers: nadav, mzolotukhin

Subscribers: JesperAntonsson, llvm-commits, mzolotukhin

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

Patch by Jesper Antonsson!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272206 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[PM] Add missing caching of GlobalsAA to EarlyCSE.
Davide Italiano [Wed, 8 Jun 2016 21:31:55 +0000 (21:31 +0000)]
[PM] Add missing caching of GlobalsAA to EarlyCSE.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272204 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevive http://reviews.llvm.org/D12778 to handle forward-hot-prob and backward-hot...
Dehao Chen [Wed, 8 Jun 2016 21:30:12 +0000 (21:30 +0000)]
Revive reviews.llvm.org/D12778 to handle forward-hot-prob and backward-hot-prob consistently.

Summary:
Consider the following diamond CFG:

 A
/ \
B C
 \/
 D

Suppose A->B and A->C have probabilities 81% and 19%. In block-placement, A->B is called a hot edge and the final placement should be ABDC. However, the current implementation outputs ABCD. This is because when choosing the next block of B, it checks if Freq(C->D) > Freq(B->D) * 20%, which is true (if Freq(A) = 100, then Freq(B->D) = 81, Freq(C->D) = 19, and 19 > 81*20%=16.2). Actually, we should use 25% instead of 20% as the probability here, so that we have 19 < 81*25%=20.25, and the desired ABDC layout will be generated.

Reviewers: djasper, davidxl

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272203 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CMake] Fixing a typo
Chris Bieneman [Wed, 8 Jun 2016 21:22:03 +0000 (21:22 +0000)]
[CMake] Fixing a typo

This was called out on the list a long time ago and just got pointed out to me again. Need to fix it before I forget.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272201 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CMake] Support overriding binary install directory
Chris Bieneman [Wed, 8 Jun 2016 21:19:26 +0000 (21:19 +0000)]
[CMake] Support overriding binary install directory

This patch adds a new option LLVM_TOOLS_INSTALL_DIR which allows customizing the location executables and symlinks get installed to. This adds the functionality provided by autoconf's --bindir flag.

This patch is based on patches from and collaboration with Tony Kelman, and replaces http://reviews.llvm.org/D20934.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272200 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[InstCombine] move fold of select of add/sub to helper function; NFCI
Sanjay Patel [Wed, 8 Jun 2016 21:10:01 +0000 (21:10 +0000)]
[InstCombine] move fold of select of add/sub to helper function; NFCI

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272199 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[DebugInfo] Add calling convention support for DWARF and CodeView
Reid Kleckner [Wed, 8 Jun 2016 20:34:29 +0000 (20:34 +0000)]
[DebugInfo] Add calling convention support for DWARF and CodeView

Summary:
Now DISubroutineType has a 'cc' field which should be a DW_CC_ enum.  If
it is present and non-zero, the backend will emit it as a
DW_AT_calling_convention attribute. On the CodeView side, we translate
it to the appropriate enum for the LF_PROCEDURE record.

I added a new LLVM vendor specific enum to the list of DWARF calling
conventions. DWARF does not appear to attempt to standardize these, so I
assume it's OK to do this until we coordinate with GCC on how to emit
vectorcall convention functions.

Reviewers: dexonsmith, majnemer, aaboud, amccarth

Subscribers: mehdi_amini, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272197 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[InstCombine] fix outdated comment, simplify logic; NFCI
Sanjay Patel [Wed, 8 Jun 2016 20:31:52 +0000 (20:31 +0000)]
[InstCombine] fix outdated comment, simplify logic; NFCI

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272196 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoThe patch set unroll disable pragma when unroll
Evgeny Stupachenko [Wed, 8 Jun 2016 20:21:24 +0000 (20:21 +0000)]
The patch set unroll disable pragma when unroll
with user specified count has been applied.

Summary:
Previously SetLoopAlreadyUnrolled() set the disable pragma only if
there was some loop metadata.
Now it set the pragma in all cases. This helps to prevent multiple
unroll when -unroll-count=N is given.

Reviewers: mzolotukhin

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

From: Evgeny Stupachenko <evstupac@gmail.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272195 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[PM] Refector LoopAccessInfo analysis code
Xinliang David Li [Wed, 8 Jun 2016 20:15:37 +0000 (20:15 +0000)]
[PM] Refector LoopAccessInfo analysis code

This is the preparation patch to port the analysis to new PM

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272194 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[InstCombine] reduce indent; NFC
Sanjay Patel [Wed, 8 Jun 2016 20:09:04 +0000 (20:09 +0000)]
[InstCombine] reduce indent; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272193 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[MemCpyOpt] Do not exchange llvm.lifetime.start and llvm.memcpy
Tim Shen [Wed, 8 Jun 2016 19:42:32 +0000 (19:42 +0000)]
[MemCpyOpt] Do not exchange llvm.lifetime.start and llvm.memcpy

Reviewers: iteratee

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272192 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[InstCombine] use copyIRFlags() ; NFCI
Sanjay Patel [Wed, 8 Jun 2016 19:33:52 +0000 (19:33 +0000)]
[InstCombine] use copyIRFlags() ; NFCI

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272191 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoApply most suggestions of clang-tidy's performance-unnecessary-value-param
Benjamin Kramer [Wed, 8 Jun 2016 19:09:22 +0000 (19:09 +0000)]
Apply most suggestions of clang-tidy's performance-unnecessary-value-param

Avoids unnecessary copies. All changes audited & pass tests with asan.
No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272190 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoGenerate codeview for array type metadata.
Adrian McCarthy [Wed, 8 Jun 2016 18:22:59 +0000 (18:22 +0000)]
Generate codeview for array type metadata.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272187 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CodeView] Remove manual expansion of the default copy ctor.
Benjamin Kramer [Wed, 8 Jun 2016 18:19:38 +0000 (18:19 +0000)]
[CodeView] Remove manual expansion of the default copy ctor.

It provides nothing over the default one but makes the class not
trivially copyable. No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272186 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAttempt #2 to appease the buildbots.
George Burgess IV [Wed, 8 Jun 2016 17:56:35 +0000 (17:56 +0000)]
Attempt #2 to appease the buildbots.

MSVC calls the copy ctor on StratifiedSets for some reason. So,
undelete it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272184 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[codeview] Avoid emitting an empty file checksum table
Reid Kleckner [Wed, 8 Jun 2016 17:50:29 +0000 (17:50 +0000)]
[codeview] Avoid emitting an empty file checksum table

Again, the Microsoft linker does not like empty substreams.

We still emit an empty string table if CodeView is enabled, but that
doesn't cause problems because it always contains at least one null
byte.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272183 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[SCEV] Break out of loop if there is no more work to do
Sanjoy Das [Wed, 8 Jun 2016 17:48:46 +0000 (17:48 +0000)]
[SCEV] Break out of loop if there is no more work to do

This is NFC as far as externally visible behavior is concerned, but will
keep us from spinning in the worklist traversal algorithm unnecessarily.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272182 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[SCEV] Track no-abnormal-exits instead of no-throw calls
Sanjoy Das [Wed, 8 Jun 2016 17:48:42 +0000 (17:48 +0000)]
[SCEV] Track no-abnormal-exits instead of no-throw calls

Absence of may-unwind calls is not enough to guarantee that a
UB-generating use of an add-rec poison in the loop latch will actually
cause UB.  We also need to guard against calls that terminate the thread
or infinite loop themselves.

This partially addresses PR28012.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272181 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoTeach isGuarantdToTransferExecToSuccessor about debug info intrinsics
Sanjoy Das [Wed, 8 Jun 2016 17:48:36 +0000 (17:48 +0000)]
Teach isGuarantdToTransferExecToSuccessor about debug info intrinsics

Calls to `@llvm.dbg.*` can be assumed to terminate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272180 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix a bug in SCEV's poison value propagation
Sanjoy Das [Wed, 8 Jun 2016 17:48:31 +0000 (17:48 +0000)]
Fix a bug in SCEV's poison value propagation

The worklist algorithm introduced in rL271151 didn't check to see if the
direct users of the post-inc add recurrence propagates poison.  This
change fixes the problem and makes the code structure more obvious.

Note for release managers: correctness wise, this bug wasn't a
regression introduced by rL271151 -- the behavior of SCEV around
post-inc add recurrences was strictly improved (in terms of correctness)
in rL271151.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272179 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[RegBankSelect] Silence an unused variable warning in release mode.
Quentin Colombet [Wed, 8 Jun 2016 17:39:47 +0000 (17:39 +0000)]
[RegBankSelect] Silence an unused variable warning in release mode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272177 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[RegBankSelect] Comment on how we could improve repairing with copies.
Quentin Colombet [Wed, 8 Jun 2016 17:39:43 +0000 (17:39 +0000)]
[RegBankSelect] Comment on how we could improve repairing with copies.

When repairing with a copy, instead of accounting for the cost of that
copy and actually inserting it, we may be able to use an alternative
source for the register to repair and just use it.

Make sure this is documented, so that we consider that opportunity at
some point.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272176 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[pdb] Fix build errors in PDB unit tests.
Zachary Turner [Wed, 8 Jun 2016 17:32:25 +0000 (17:32 +0000)]
[pdb] Fix build errors in PDB unit tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272174 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoTry to appease buildbots.
George Burgess IV [Wed, 8 Jun 2016 17:27:14 +0000 (17:27 +0000)]
Try to appease buildbots.

r272064 apparently made them angry. This undoes some changes made in
r272064 (defaulting move ctors) to make them happy again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272173 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[pdb] Handle stream index errors better.
Zachary Turner [Wed, 8 Jun 2016 17:26:39 +0000 (17:26 +0000)]
[pdb] Handle stream index errors better.

Reviewed By: ruiu
Differential Revision: http://reviews.llvm.org/D21128

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272172 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRemove a patch .rej file.
Rui Ueyama [Wed, 8 Jun 2016 16:54:31 +0000 (16:54 +0000)]
Remove a patch .rej file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272171 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[AArch64][RegisterBankInfo] G_OR are fine on either GPR or FPR.
Quentin Colombet [Wed, 8 Jun 2016 16:53:32 +0000 (16:53 +0000)]
[AArch64][RegisterBankInfo] G_OR are fine on either GPR or FPR.

Teach AArch64RegisterBankInfo that G_OR can be mapped on either GPR or
FPR for 64-bit or 32-bit values.

Add test cases demonstrating how this information is used to coalesce a
computation on a single register bank.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272170 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[RegBankSelect] Use RegisterBankInfo applyMapping method.
Quentin Colombet [Wed, 8 Jun 2016 16:45:04 +0000 (16:45 +0000)]
[RegBankSelect] Use RegisterBankInfo applyMapping method.

The RegBankSelect pass can now rely on the target to do the remapping of
the instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272169 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[ProfileData] Update llvm's copy of InstrProfData.inc
Vedant Kumar [Wed, 8 Jun 2016 16:39:32 +0000 (16:39 +0000)]
[ProfileData] Update llvm's copy of InstrProfData.inc

The new version of the header introduces the INSTR_PROF_VISIBILITY
macro. See http://reviews.llvm.org/D21116 for more details.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272166 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[RegisterBankInfo] Implement the method to apply a mapping.
Quentin Colombet [Wed, 8 Jun 2016 16:39:21 +0000 (16:39 +0000)]
[RegisterBankInfo] Implement the method to apply a mapping.

Now, the target will be able to provide its how implementation to remap
an instruction. This open the way to crazier optimizations, but to
beginning with, we will be able to handle something else than the
default mapping.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272165 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[RegBankSelect] Use the OperandMapper class to hold remap information.
Quentin Colombet [Wed, 8 Jun 2016 16:30:55 +0000 (16:30 +0000)]
[RegBankSelect] Use the OperandMapper class to hold remap information.

Now that we have an entity that hold the remap information the
rewritting should be easier to do.

No functional changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272164 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[RegBankSelect] Use const_iterator instead of iterator for repairReg.
Quentin Colombet [Wed, 8 Jun 2016 16:24:55 +0000 (16:24 +0000)]
[RegBankSelect] Use const_iterator instead of iterator for repairReg.

The repairing code has no reason to change the source or destination of
the registers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272163 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[RegisterBankInfo] Introduce OperandsMapper class.
Quentin Colombet [Wed, 8 Jun 2016 16:18:13 +0000 (16:18 +0000)]
[RegisterBankInfo] Introduce OperandsMapper class.

This helper class is used to encapsulate the necessary information
to remap an instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272161 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Target] Introduce a generic opcode for bitwise OR: G_OR.
Quentin Colombet [Wed, 8 Jun 2016 16:12:19 +0000 (16:12 +0000)]
[Target] Introduce a generic opcode for bitwise OR: G_OR.

This G_OR is used in GlobalISel to represent bitwise OR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272160 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[RegBankSelect] Introduce a command line option to override the running mode.
Quentin Colombet [Wed, 8 Jun 2016 15:49:23 +0000 (15:49 +0000)]
[RegBankSelect] Introduce a command line option to override the running mode.

When the command line option is set, it overrides any thing that the
target may have set. The rationale is that we get what we asked for.

Options are respectively regbankselect-fast and regbankselect-greedy for
fast and greedy mode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272158 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[RegBankSelect] Explain what it would take to support non-copy
Quentin Colombet [Wed, 8 Jun 2016 15:40:32 +0000 (15:40 +0000)]
[RegBankSelect] Explain what it would take to support non-copy
repairing.

Copies are easy because we repair only when there is a mismatch. For
non-copy repairing, i.e., cases that involves breaking down or gathering
up the value, one of the operand may not have a register bank yet. Thus,
derivate a cost from that, requires more work.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272157 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[ARM] MSR instructions implicitly set CPSR
Oliver Stannard [Wed, 8 Jun 2016 15:26:34 +0000 (15:26 +0000)]
[ARM] MSR instructions implicitly set CPSR

The MSR instructions can write to the CPSR, but we did not model this
fact, so we could emit them in the middle of IT blocks, changing the
condition flags for later instructions in the block.

The tests use two calls to llvm.write_register.i32 because it is valid
to use these instructions at the end of an IT block, which if conversion
does do in some cases. With two calls, the first clobbers the flags, so
a branch has to be used to make the second one conditional.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272154 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[lit] Ensure we get bytes when reading redirected output files.
Daniel Dunbar [Wed, 8 Jun 2016 14:41:44 +0000 (14:41 +0000)]
[lit] Ensure we get bytes when reading redirected output files.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272147 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoSupport: correct AArch64 TargetParser implementation
Saleem Abdulrasool [Wed, 8 Jun 2016 14:30:00 +0000 (14:30 +0000)]
Support: correct AArch64 TargetParser implementation

The architecture enumeration is shared across ARM and AArch64.  However, the
data is not.  The code incorrectly would index into the array using the
architecture index which was offset by the ARMv7 architecture enumeration.  We
do not have a marker for indicating the architectural family to which the
enumeration belongs so we cannot be clever about offsetting the index (at least
it is not immediately apparent to me).  Instead, fall back to the tried-and-true
method of slowly iterating the array (its not a large array, so the impact of
this is not too high).

Because of the incorrect indexing, if we were lucky, we would crash, but usually
we would return an invalid StringRef.  We did not have any tests for the AArch64
target parser previously;.  Extend the previous tests I had added for ARM to
cover AArch64 for ensuring that we return expected StringRefs.

Take the opportunity to change some iterator types to references.

This work is needed to support parsing `.arch name` directives in the AArch64
target asm parser.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272145 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[PM] LoopSimplify. Remove unneeded pass dependencies. NFCI.
Davide Italiano [Wed, 8 Jun 2016 13:56:59 +0000 (13:56 +0000)]
[PM] LoopSimplify. Remove unneeded pass dependencies. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272140 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[PM/SimplifyCFG] Preserve GlobalsAA even if the IR is mutated.
Davide Italiano [Wed, 8 Jun 2016 13:32:23 +0000 (13:32 +0000)]
[PM/SimplifyCFG] Preserve GlobalsAA even if the IR is mutated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272139 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[mips] Add a proper file header in MipsFastISel.cpp
Vasileios Kalintiris [Wed, 8 Jun 2016 13:13:15 +0000 (13:13 +0000)]
[mips] Add a proper file header in MipsFastISel.cpp

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272138 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Hexagon] Modify HexagonExpandCondsets to handle subregisters
Krzysztof Parzyszek [Wed, 8 Jun 2016 12:31:16 +0000 (12:31 +0000)]
[Hexagon] Modify HexagonExpandCondsets to handle subregisters

Also, switch to using functions from LiveIntervalAnalysis to update
live intervals, instead of performing the updates manually.

Re-committing r272045.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272135 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[ARM] Remove redundant check. NFC
Diana Picus [Wed, 8 Jun 2016 10:29:02 +0000 (10:29 +0000)]
[ARM] Remove redundant check. NFC

isSwift is tested earlier and known to be false when we reach this code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272127 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAvoid copies of std::strings and APInt/APFloats where we only read from it
Benjamin Kramer [Wed, 8 Jun 2016 10:01:20 +0000 (10:01 +0000)]
Avoid copies of std::strings and APInt/APFloats where we only read from it

As suggested by clang-tidy's performance-unnecessary-copy-initialization.
This can easily hit lifetime issues, so I audited every change and ran the
tests under asan, which came back clean.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272126 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[AVX512] Fix cvtusi2sd instruction Opcode, it should be 0x7B instead of 0x2A.
Igor Breger [Wed, 8 Jun 2016 07:48:23 +0000 (07:48 +0000)]
[AVX512] Fix cvtusi2sd instruction Opcode, it should be 0x7B instead of 0x2A.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272122 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoMake LiveDebugValues preserve CFG
Matt Arsenault [Wed, 8 Jun 2016 05:18:01 +0000 (05:18 +0000)]
Make LiveDebugValues preserve CFG

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272117 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[libFuzzer] add 'weak' back to __sanitizer_malloc_hook and __sanitizer_free_hook
Kostya Serebryany [Wed, 8 Jun 2016 04:49:29 +0000 (04:49 +0000)]
[libFuzzer] add 'weak' back to __sanitizer_malloc_hook and __sanitizer_free_hook

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272116 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[libFuzzer] add a test that is built w/o coverage instrumentation but has the coverag...
Kostya Serebryany [Wed, 8 Jun 2016 01:46:13 +0000 (01:46 +0000)]
[libFuzzer] add a test that is built w/o coverage instrumentation but has the coverage rt (it should now fail with a descriptive message)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272090 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[libFuzzer] docs: merge two lines with cmake instructions, add -DLLVM_ENABLE_ASSERTI...
Kostya Serebryany [Wed, 8 Jun 2016 01:31:40 +0000 (01:31 +0000)]
[libFuzzer] docs: merge two lines with cmake instructions, add  -DLLVM_ENABLE_ASSERTIONS=ON

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272088 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[AArch64][RegisterBankInfo] Use the generic implementation of copyCost.
Quentin Colombet [Wed, 8 Jun 2016 01:24:00 +0000 (01:24 +0000)]
[AArch64][RegisterBankInfo] Use the generic implementation of copyCost.

Long term we may want to give high cost at FPR to/from GPR copies.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272086 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[RegisterBankInfo] Adapt the copy cost logic to give something sane by default.
Quentin Colombet [Wed, 8 Jun 2016 01:17:10 +0000 (01:17 +0000)]
[RegisterBankInfo] Adapt the copy cost logic to give something sane by default.

The generic implementation stated that all copies were free, which is
unlikely. Now, only the copies within the same register bank are free.
We assume they will get coalesced.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272085 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[RegisterBankInfo] Add a size argument for the cost of copy.
Quentin Colombet [Wed, 8 Jun 2016 01:11:03 +0000 (01:11 +0000)]
[RegisterBankInfo] Add a size argument for the cost of copy.

The cost of a copy may be different based on how many bits we have to
copy around. E.g., a 8-bit copy may be different than a 32-bit copy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272084 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[RegisterBankInfo] Move a hidden function into a static method. NFC.
Quentin Colombet [Wed, 8 Jun 2016 01:04:32 +0000 (01:04 +0000)]
[RegisterBankInfo] Move a hidden function into a static method. NFC.

This will allow code reuse in the coming commits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272083 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoMIR: Fix parsing of stack object references in MachineMemOperands
Matthias Braun [Wed, 8 Jun 2016 00:47:07 +0000 (00:47 +0000)]
MIR: Fix parsing of stack object references in MachineMemOperands

The MachineMemOperand parser lacked the code to handle %stack.X
references (%fixed-stack.X was working).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272082 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[pdb] Try to fix use after free.
Zachary Turner [Wed, 8 Jun 2016 00:25:08 +0000 (00:25 +0000)]
[pdb] Try to fix use after free.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272078 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoIR: Call dropAllReferences from GlobalVariable's destructor.
Peter Collingbourne [Wed, 8 Jun 2016 00:13:39 +0000 (00:13 +0000)]
IR: Call dropAllReferences from GlobalVariable's destructor.

We were previously failing to do this and as a result failing to drop
attached metadata.

Not sure if there's a good way to test this. An in-progress patch exposed this
problem by allocating a GlobalVariable at the same address as a previously
allocated GlobalVariable.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272077 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[pdbdump] Print out # of hash buckets.
Rui Ueyama [Tue, 7 Jun 2016 23:53:43 +0000 (23:53 +0000)]
[pdbdump] Print out # of hash buckets.

In the reference code, the field name is `cHashBuckets`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272075 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[pdbdump] Print out TPI hash key size.
Rui Ueyama [Tue, 7 Jun 2016 23:44:27 +0000 (23:44 +0000)]
[pdbdump] Print out TPI hash key size.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272073 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[LibFuzzer] Declare and use sanitizer functions in ``fuzzer::ExternalFunctions``
Dan Liew [Tue, 7 Jun 2016 23:32:50 +0000 (23:32 +0000)]
[LibFuzzer] Declare and use sanitizer functions in ``fuzzer::ExternalFunctions``

This fixes linking problems on OSX.

Unfortunately it turns out we need to use an instance of the
``fuzzer::ExternalFunctions`` object in several places so this
commit also replaces all instances with a single global instance.

It also turns out initializing a global ``fuzzer::ExternalFunctions``
before main is entered (i.e. letting the object be initialised by the
global initializers) is not safe (on OSX the call to ``Printf()`` in the
CTOR crashes if it is called from a global initializer) so we instead
have a global ``fuzzer::ExternalFunctions*`` and initialize it inside
``FuzzerDriver()``.

Multiple unit tests depend also depend on the
``fuzzer::ExternalFunctions*`` global so a ``main()`` function has been
added that initializes it before running any tests.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272072 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[docs] fix the build by including ScudoHardenedAllocator into toc; mention SourceBase...
Kostya Serebryany [Tue, 7 Jun 2016 23:13:54 +0000 (23:13 +0000)]
[docs] fix the build by including ScudoHardenedAllocator into toc; mention SourceBasedCodeCoverage.html in libFuzzer docs

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272070 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRetry^4 "[llvm-profdata] Add option to ingest filepaths from a file"
Vedant Kumar [Tue, 7 Jun 2016 22:47:31 +0000 (22:47 +0000)]
Retry^4 "[llvm-profdata] Add option to ingest filepaths from a file"

Changes since the initial commit:
- Use echo instead of printf. This should side-step the character
  escaping issues on Windows.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272068 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[lit] Ignore errors when decoding redirected output.
Daniel Dunbar [Tue, 7 Jun 2016 22:06:57 +0000 (22:06 +0000)]
[lit] Ignore errors when decoding redirected output.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272066 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoUse FileCheck instead of grepping for patterns. NFC.
Easwaran Raman [Tue, 7 Jun 2016 21:46:14 +0000 (21:46 +0000)]
Use FileCheck instead of grepping for patterns. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272065 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CFLAA] Kill dead code/fix comments in StratifiedSets.
George Burgess IV [Tue, 7 Jun 2016 21:41:18 +0000 (21:41 +0000)]
[CFLAA] Kill dead code/fix comments in StratifiedSets.

Also use default/delete instead of hand-written ctors.

Thanks to Jia Chen for bringing this stuff up.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272064 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAMDGPU: Add amdgpu-ps-wqm-outputs function attributes
Nicolai Haehnle [Tue, 7 Jun 2016 21:37:17 +0000 (21:37 +0000)]
AMDGPU: Add amdgpu-ps-wqm-outputs function attributes

Summary:
The presence of this attribute indicates that VGPR outputs should be computed
in whole quad mode. This will be used by Mesa for prolog pixel shaders, so
that derivatives can be taken of shader inputs computed by the prolog, fixing
a bug.

The generated code could certainly be improved: if a prolog pixel shader is
used (which isn't common in modern OpenGL - they're used for gl_Color, polygon
stipples, and forcing per-sample interpolation), Mesa will use this attribute
unconditionally, because it has to be conservative. So WQM may be used in the
prolog when it isn't really needed, and furthermore a silly back-and-forth
switch is likely to happen at the boundary between prolog and main shader
parts.

Fixing this is a bit involved: we'd first have to add a mechanism by which
LLVM writes the WQM-related input requirements to the main shader part binary,
and then Mesa specializes the prolog part accordingly. At that point, we may
as well just compile a monolithic shader...

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95130

Reviewers: arsenm, tstellarAMD, mareko

Subscribers: arsenm, llvm-commits, kzhuravl

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272063 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[LibFuzzer] Split the fuzzer-oom.test into two tests.
Dan Liew [Tue, 7 Jun 2016 21:23:30 +0000 (21:23 +0000)]
[LibFuzzer] Split the fuzzer-oom.test into two tests.

This is necessary because the existing fuzzer-oom.test was Linux
specific due to its use of __sanitizer_print_memory_profile() which
is only available on Linux right now and so the test would fail on OSX.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272061 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[X86][SSE4A] Regenerated SSE4A intrinsics tests
Simon Pilgrim [Tue, 7 Jun 2016 21:15:45 +0000 (21:15 +0000)]
[X86][SSE4A] Regenerated SSE4A intrinsics tests

There are no VEX encoded versions of SSE4A instructions, make sure that AVX targets give the same output

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272060 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[pdb] Fix broken unit test compilation.
Zachary Turner [Tue, 7 Jun 2016 20:46:39 +0000 (20:46 +0000)]
[pdb] Fix broken unit test compilation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272059 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[pdb] Convert StringRefs to ArrayRef<uint8_t>s.
Zachary Turner [Tue, 7 Jun 2016 20:38:37 +0000 (20:38 +0000)]
[pdb] Convert StringRefs to ArrayRef<uint8_t>s.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272058 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd info to SourceLevelDebugging about CodeView
Reid Kleckner [Tue, 7 Jun 2016 20:27:30 +0000 (20:27 +0000)]
Add info to SourceLevelDebugging about CodeView

Adds some discussion of the nature of the format, and some developer
docs on how to work with it in LLVM.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272057 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert "Differential Revision: http://reviews.llvm.org/D20557"
Eric Christopher [Tue, 7 Jun 2016 20:27:12 +0000 (20:27 +0000)]
Revert "Differential Revision: reviews.llvm.org/D20557"

Author: Wei Ding <wei.ding2@amd.com>
Date:   Tue Jun 7 19:04:44 2016 +0000

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

    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272044
    91177308-0d34-0410-b5e6-96231b3b80d8

as it was breaking the bots.

This reverts commit r272044.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272056 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoReformat for some clarity and 80-columns. NFC.
Eric Christopher [Tue, 7 Jun 2016 20:27:06 +0000 (20:27 +0000)]
Reformat for some clarity and 80-columns. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272055 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[libfuzzer] custom crossover interface function.
Mike Aizatsky [Tue, 7 Jun 2016 20:22:15 +0000 (20:22 +0000)]
[libfuzzer] custom crossover interface function.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272054 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[stack-protection] Add support for MSVC buffer security check
Etienne Bergeron [Tue, 7 Jun 2016 20:15:35 +0000 (20:15 +0000)]
[stack-protection] Add support for MSVC buffer security check

Summary:
This patch is adding support for the MSVC buffer security check implementation

The buffer security check is turned on with the '/GS' compiler switch.
  * https://msdn.microsoft.com/en-us/library/8dbf701c.aspx
  * To be added to clang here: http://reviews.llvm.org/D20347

Some overview of buffer security check feature and implementation:
  * https://msdn.microsoft.com/en-us/library/aa290051(VS.71).aspx
  * http://www.ksyash.com/2011/01/buffer-overflow-protection-3/
  * http://blog.osom.info/2012/02/understanding-vs-c-compilers-buffer.html

For the following example:
```
int example(int offset, int index) {
  char buffer[10];
  memset(buffer, 0xCC, index);
  return buffer[index];
}
```

The MSVC compiler is adding these instructions to perform stack integrity check:
```
        push        ebp
        mov         ebp,esp
        sub         esp,50h
  [1]   mov         eax,dword ptr [__security_cookie (01068024h)]
  [2]   xor         eax,ebp
  [3]   mov         dword ptr [ebp-4],eax
        push        ebx
        push        esi
        push        edi
        mov         eax,dword ptr [index]
        push        eax
        push        0CCh
        lea         ecx,[buffer]
        push        ecx
        call        _memset (010610B9h)
        add         esp,0Ch
        mov         eax,dword ptr [index]
        movsx       eax,byte ptr buffer[eax]
        pop         edi
        pop         esi
        pop         ebx
  [4]   mov         ecx,dword ptr [ebp-4]
  [5]   xor         ecx,ebp
  [6]   call        @__security_check_cookie@4 (01061276h)
        mov         esp,ebp
        pop         ebp
        ret
```

The instrumentation above is:
  * [1] is loading the global security canary,
  * [3] is storing the local computed ([2]) canary to the guard slot,
  * [4] is loading the guard slot and ([5]) re-compute the global canary,
  * [6] is validating the resulting canary with the '__security_check_cookie' and performs error handling.

Overview of the current stack-protection implementation:
  * lib/CodeGen/StackProtector.cpp
    * There is a default stack-protection implementation applied on intermediate representation.
    * The target can overload 'getIRStackGuard' method if it has a standard location for the stack protector cookie.
    * An intrinsic 'Intrinsic::stackprotector' is added to the prologue. It will be expanded by the instruction selection pass (DAG or Fast).
    * Basic Blocks are added to every instrumented function to receive the code for handling stack guard validation and errors handling.
    * Guard manipulation and comparison are added directly to the intermediate representation.

  * lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
  * lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
    * There is an implementation that adds instrumentation during instruction selection (for better handling of sibbling calls).
      * see long comment above 'class StackProtectorDescriptor' declaration.
    * The target needs to override 'getSDagStackGuard' to activate SDAG stack protection generation. (note: getIRStackGuard MUST be nullptr).
      * 'getSDagStackGuard' returns the appropriate stack guard (security cookie)
    * The code is generated by 'SelectionDAGBuilder.cpp' and 'SelectionDAGISel.cpp'.

  * include/llvm/Target/TargetLowering.h
    * Contains function to retrieve the default Guard 'Value'; should be overriden by each target to select which implementation is used and provide Guard 'Value'.

  * lib/Target/X86/X86ISelLowering.cpp
    * Contains the x86 specialisation; Guard 'Value' used by the SelectionDAG algorithm.

Function-based Instrumentation:
  * The MSVC doesn't inline the stack guard comparison in every function. Instead, a call to '__security_check_cookie' is added to the epilogue before every return instructions.
  * To support function-based instrumentation, this patch is
    * adding a function to get the function-based check (llvm 'Value', see include/llvm/Target/TargetLowering.h),
      * If provided, the stack protection instrumentation won't be inlined and a call to that function will be added to the prologue.
    * modifying (SelectionDAGISel.cpp) do avoid producing basic blocks used for inline instrumentation,
    * generating the function-based instrumentation during the ISEL pass (SelectionDAGBuilder.cpp),
    * if FastISEL (not SelectionDAG), using the fallback which rely on the same function-based implemented over intermediate representation (StackProtector.cpp).

Modifications
  * adding support for MSVC (lib/Target/X86/X86ISelLowering.cpp)
  * adding support function-based instrumentation (lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp, .h)

Results

  * IR generated instrumentation:
```
clang-cl /GS test.cc /Od /c -mllvm -print-isel-input
```

```
*** Final LLVM Code input to ISel ***

; Function Attrs: nounwind sspstrong
define i32 @"\01?example@@YAHHH@Z"(i32 %offset, i32 %index) #0 {
entry:
  %StackGuardSlot = alloca i8*                                                  <<<-- Allocated guard slot
  %0 = call i8* @llvm.stackguard()                                              <<<-- Loading Stack Guard value
  call void @llvm.stackprotector(i8* %0, i8** %StackGuardSlot)                  <<<-- Prologue intrinsic call (store to Guard slot)
  %index.addr = alloca i32, align 4
  %offset.addr = alloca i32, align 4
  %buffer = alloca [10 x i8], align 1
  store i32 %index, i32* %index.addr, align 4
  store i32 %offset, i32* %offset.addr, align 4
  %arraydecay = getelementptr inbounds [10 x i8], [10 x i8]* %buffer, i32 0, i32 0
  %1 = load i32, i32* %index.addr, align 4
  call void @llvm.memset.p0i8.i32(i8* %arraydecay, i8 -52, i32 %1, i32 1, i1 false)
  %2 = load i32, i32* %index.addr, align 4
  %arrayidx = getelementptr inbounds [10 x i8], [10 x i8]* %buffer, i32 0, i32 %2
  %3 = load i8, i8* %arrayidx, align 1
  %conv = sext i8 %3 to i32
  %4 = load volatile i8*, i8** %StackGuardSlot                                  <<<-- Loading Guard slot
  call void @__security_check_cookie(i8* %4)                                    <<<-- Epilogue function-based check
  ret i32 %conv
}
```

  * SelectionDAG generated instrumentation:

```
clang-cl /GS test.cc /O1 /c /FA
```

```
"?example@@YAHHH@Z":                    # @"\01?example@@YAHHH@Z"
# BB#0:                                 # %entry
        pushl   %esi
        subl    $16, %esp
        movl    ___security_cookie, %eax                                        <<<-- Loading Stack Guard value
        movl    28(%esp), %esi
        movl    %eax, 12(%esp)                                                  <<<-- Store to Guard slot
        leal    2(%esp), %eax
        pushl   %esi
        pushl   $204
        pushl   %eax
        calll   _memset
        addl    $12, %esp
        movsbl  2(%esp,%esi), %esi
        movl    12(%esp), %ecx                                                  <<<-- Loading Guard slot
        calll   @__security_check_cookie@4                                      <<<-- Epilogue function-based check
        movl    %esi, %eax
        addl    $16, %esp
        popl    %esi
        retl
```

Reviewers: kcc, pcc, eugenis, rnk

Subscribers: majnemer, llvm-commits, hans, thakis, rnk

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272053 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[lit] Fix an uninitialized var on Windows.
Daniel Dunbar [Tue, 7 Jun 2016 20:14:17 +0000 (20:14 +0000)]
[lit] Fix an uninitialized var on Windows.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272052 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[yaml] Add a ScalarTraits for mapping endian aware types.
Zachary Turner [Tue, 7 Jun 2016 19:32:09 +0000 (19:32 +0000)]
[yaml] Add a ScalarTraits for mapping endian aware types.

This allows mapping of any endian-aware type whose underlying
type (e.g. uint32_t) provides a ScalarTraits specialization.

Reviewed by: majnemer
Differential Revision: http://reviews.llvm.org/D21057

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272049 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert r272045 since GCC doesn't know how to compile it.
Krzysztof Parzyszek [Tue, 7 Jun 2016 19:25:28 +0000 (19:25 +0000)]
Revert r272045 since GCC doesn't know how to compile it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272048 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Hexagon] Modify HexagonExpandCondsets to handle subregisters
Krzysztof Parzyszek [Tue, 7 Jun 2016 19:06:23 +0000 (19:06 +0000)]
[Hexagon] Modify HexagonExpandCondsets to handle subregisters

Also, switch to using functions from LiveIntervalAnalysis to update
live intervals, instead of performing the updates manually.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272045 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoDifferential Revision: http://reviews.llvm.org/D20557
Wei Ding [Tue, 7 Jun 2016 19:04:44 +0000 (19:04 +0000)]
Differential Revision: reviews.llvm.org/D20557

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272044 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[pdb] Fix a potential overflow and remove unnecessary comments.
Zachary Turner [Tue, 7 Jun 2016 18:42:39 +0000 (18:42 +0000)]
[pdb] Fix a potential overflow and remove unnecessary comments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272043 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CFLAA] Add AttrEscaped, remove bit twiddling functions.
George Burgess IV [Tue, 7 Jun 2016 18:35:37 +0000 (18:35 +0000)]
[CFLAA] Add AttrEscaped, remove bit twiddling functions.

This patch does a few things:

- Unifies AttrAll and AttrUnknown (since they were used for more or less
  the same purpose anyway).

- Introduces AttrEscaped, an attribute that notes that a value escapes
  our analysis for a given set, but not that an unknown value flows into
  said set.

- Removes functions that take bit indices, since we also had functions
  that took bitsets, and the use of both (with similar names) was
  unclear and bug-prone.

Patch by Jia Chen.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272040 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[libfuzzer] prune_corpus option for disabling pruning during the load.
Mike Aizatsky [Tue, 7 Jun 2016 18:16:32 +0000 (18:16 +0000)]
[libfuzzer] prune_corpus option for disabling pruning during the load.

Summary:
The option is very useful for testing, plus I intend to measure
its effect on fuzzer effectiveness.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272035 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert "Use CMAKE_INSTALL_BINDIR instead of hardcoding bin for tools install paths"
Chris Bieneman [Tue, 7 Jun 2016 18:04:37 +0000 (18:04 +0000)]
Revert "Use CMAKE_INSTALL_BINDIR instead of hardcoding bin for tools install paths"

This reverts commit 0dc5a55f66ed06d7859c4e0474a87428d27775e6.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272033 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoUse CMAKE_INSTALL_BINDIR instead of hardcoding bin for tools install paths
Chris Bieneman [Tue, 7 Jun 2016 18:01:16 +0000 (18:01 +0000)]
Use CMAKE_INSTALL_BINDIR instead of hardcoding bin for tools install paths

Summary:
This allows customizing the location executables and symlinks get installed to,
as with --bindir in autotools.

Reviewers: loladiro, beanz

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272031 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoReapply [AArch64] Fix isLegalAddImmediate() to return true for valid negative values.
Geoff Berry [Tue, 7 Jun 2016 16:48:43 +0000 (16:48 +0000)]
Reapply [AArch64] Fix isLegalAddImmediate() to return true for valid negative values.

Originally reviewed here: http://reviews.llvm.org/D17463

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272023 91177308-0d34-0410-b5e6-96231b3b80d8