platform/upstream/llvm.git
8 years ago[OpenCL] Moved nosvm attribute handling in Sema to other OpenCL attrs
Anastasia Stulova [Fri, 1 Apr 2016 16:05:09 +0000 (16:05 +0000)]
[OpenCL] Moved nosvm attribute handling in Sema to other OpenCL attrs

llvm-svn: 265146

8 years ago[ADT] Make StringMap's tombstone aligned.
Benjamin Kramer [Fri, 1 Apr 2016 15:51:51 +0000 (15:51 +0000)]
[ADT] Make StringMap's tombstone aligned.

This avoids undefined behavior when casting pointers to it. Also make
sure that we don't cast to a derived StringMapEntry before checking for
tombstone, as that may have different alignment requirements.

llvm-svn: 265145

8 years ago[PGOProfile] Rename a test to make it more reusable, NFC
Vedant Kumar [Fri, 1 Apr 2016 15:45:33 +0000 (15:45 +0000)]
[PGOProfile] Rename a test to make it more reusable, NFC

llvm-svn: 265144

8 years agoPass a const pointer to getImplicitAddend. NFC.
Rafael Espindola [Fri, 1 Apr 2016 14:36:09 +0000 (14:36 +0000)]
Pass a const pointer to getImplicitAddend. NFC.

llvm-svn: 265143

8 years agoRefactor duplicated code.
Rafael Espindola [Fri, 1 Apr 2016 14:14:48 +0000 (14:14 +0000)]
Refactor duplicated code.

We had almost identical code to handle creating a plt entry in two
places.

llvm-svn: 265142

8 years ago[AMDGPU] fix MADAK/MADMK instructions operand namings to match encoding fields.
Valery Pykhtin [Fri, 1 Apr 2016 13:13:12 +0000 (13:13 +0000)]
[AMDGPU] fix MADAK/MADMK instructions operand namings to match encoding fields.

$vsrc1 -> $src1, $k -> $imm

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

llvm-svn: 265141

8 years agoFix clean rule for a makefile
Pavel Labath [Fri, 1 Apr 2016 12:59:37 +0000 (12:59 +0000)]
Fix clean rule for a makefile

The test was failing on windows because the clean rule (which is executed even if the test is
skipped) returned an error there.

llvm-svn: 265140

8 years agoAvoid creating duplicated relocations.
Rafael Espindola [Fri, 1 Apr 2016 12:54:27 +0000 (12:54 +0000)]
Avoid creating duplicated relocations.

llvm-svn: 265139

8 years ago[x86] Remove redundant call to setTargetDAGCombine for BUILD_VECTOR node type.
Andrea Di Biagio [Fri, 1 Apr 2016 12:25:44 +0000 (12:25 +0000)]
[x86] Remove redundant call to setTargetDAGCombine for BUILD_VECTOR node type.

Since revision 235394, we no longer perform target specific combines on
build_vector nodes. No functional change intended.

llvm-svn: 265138

8 years agoFix linux buildbot after r265136
George Rimar [Fri, 1 Apr 2016 12:24:28 +0000 (12:24 +0000)]
Fix linux buildbot after r265136

http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/20138

Fix: Move method above class that uses it.
Works fine with MSVS.

llvm-svn: 265137

8 years agoMake dummySectionsNum() to be not a member of writer. NFC.
George Rimar [Fri, 1 Apr 2016 11:59:32 +0000 (11:59 +0000)]
Make dummySectionsNum() to be not a member of writer. NFC.

llvm-svn: 265136

8 years ago[X86][AVX512] Regenerated intrinsics tests
Simon Pilgrim [Fri, 1 Apr 2016 11:57:51 +0000 (11:57 +0000)]
[X86][AVX512] Regenerated intrinsics tests

llvm-svn: 265135

8 years ago[MIPS][LLVM-MC] Fix JR encoding for MIPSR6 ISA
Sagar Thakur [Fri, 1 Apr 2016 11:55:33 +0000 (11:55 +0000)]
[MIPS][LLVM-MC] Fix JR encoding for MIPSR6 ISA

Summary: The assembler was picking the wrong JR variant because the pre-R6 one was still enabled at R6.

Author: nitesh.jain
Reviewers: vkalintiris, dsanders
Subscribers: dsanders, llvm-commits, mohit.bhakkad, sagar, bhushan, jaydeep
Differential: D18387
llvm-svn: 265134

8 years ago[ThinLTO] Fix uninitialized flags.
Benjamin Kramer [Fri, 1 Apr 2016 11:49:59 +0000 (11:49 +0000)]
[ThinLTO] Fix uninitialized flags.

Found by msan. Patch by Adrian Kuegel!

llvm-svn: 265133

8 years ago[FIX] Adjust the insert point for non-affine region PHIs
Johannes Doerfert [Fri, 1 Apr 2016 11:25:47 +0000 (11:25 +0000)]
[FIX] Adjust the insert point for non-affine region PHIs

  If a non-affine region PHI is generated we should not move the insert
  point prior to the synthezised value in the same block as we might
  split that block at the insert point later on. Only if the incoming
  value should be placed in a different block we should change the
  insertion point.

llvm-svn: 265132

8 years agoSplit Writer::assignAddresses(): extract common code to fixFileOff(). NFC.
George Rimar [Fri, 1 Apr 2016 11:04:47 +0000 (11:04 +0000)]
Split Writer::assignAddresses(): extract common code to fixFileOff(). NFC.

llvm-svn: 265131

8 years agoSplit Writer::assignAddresses(): extract assignPhdrs(). NFC.
George Rimar [Fri, 1 Apr 2016 10:49:14 +0000 (10:49 +0000)]
Split Writer::assignAddresses(): extract assignPhdrs(). NFC.

llvm-svn: 265130

8 years ago[ELF] - Move calculation of _end to fixAbsoluteSymbols()
George Rimar [Fri, 1 Apr 2016 10:23:32 +0000 (10:23 +0000)]
[ELF] - Move calculation of _end to fixAbsoluteSymbols()

That is consistent with other symbols: _edata, _etext
and can help to avoid duplicate code.

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

llvm-svn: 265129

8 years ago[X86] Introduce Lakemont CPU.
Andrey Turetskiy [Fri, 1 Apr 2016 10:16:15 +0000 (10:16 +0000)]
[X86] Introduce Lakemont CPU.

Add a new Intel MCU CPU Lakemont, which doesn't support X87.

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

llvm-svn: 265128

8 years ago[OPENMP] Fixed documentation category for 'declare simd' attribute, NFC.
Alexey Bataev [Fri, 1 Apr 2016 10:12:06 +0000 (10:12 +0000)]
[OPENMP] Fixed documentation category for 'declare simd' attribute, NFC.

llvm-svn: 265127

8 years ago[Lexer] Let the compiler infer string lengths. No functionality change intended.
Benjamin Kramer [Fri, 1 Apr 2016 10:04:07 +0000 (10:04 +0000)]
[Lexer] Let the compiler infer string lengths. No functionality change intended.

llvm-svn: 265126

8 years ago[Lexer] Don't read out of bounds if a conflict marker is at the end of a file
Benjamin Kramer [Fri, 1 Apr 2016 09:58:45 +0000 (09:58 +0000)]
[Lexer] Don't read out of bounds if a conflict marker is at the end of a file

This can happen as we look for '<<<<' while scanning tokens but then expect
'<<<<\n' to tell apart perforce from diff3 conflict markers. Just harden
the pointer arithmetic.

Found by libfuzzer + asan!

llvm-svn: 265125

8 years agoChange a recently added assert into lldbassert
Pavel Labath [Fri, 1 Apr 2016 09:57:30 +0000 (09:57 +0000)]
Change a recently added assert into lldbassert

llvm-svn: 265124

8 years ago[OPENMP] Avoid useless recursive calls in getDSA if it is called in a loop, NFC
Dmitry Polukhin [Fri, 1 Apr 2016 09:52:30 +0000 (09:52 +0000)]
[OPENMP] Avoid useless recursive calls in getDSA if it is called in a loop, NFC

llvm-svn: 265123

8 years agoFix for pr24346: arm asm label calculation error in sub
James Molloy [Fri, 1 Apr 2016 09:40:47 +0000 (09:40 +0000)]
Fix for pr24346: arm asm label calculation error in sub

Some ARM instructions encode 32-bit immediates as a 8-bit integer (0-255)
and a 4-bit rotation (0-30, even) in its least significant 12 bits. The
original fixup, FK_Data_4, patches the instruction by the value bit-to-bit,
regardless of the encoding. For example, assuming the label L1 and L2 are
0x0 and 0x104 respectively, the following instruction:

  add r0, r0, #(L2 - L1) ; expects 0x104, i.e., 260

would be assembled to the following, which adds 1 to r0, instead of 260:

  e2800104 add r0, r0, #4, 2 ; equivalently 1

The new fixup kind fixup_arm_mod_imm takes care of the encoding:

  e2800f41 add r0, r0, #260

Patch by Ting-Yuan Huang!

llvm-svn: 265122

8 years ago[OPENMP 4.5] Allow data members as loop counters in loop-based
Alexey Bataev [Fri, 1 Apr 2016 09:23:34 +0000 (09:23 +0000)]
[OPENMP 4.5] Allow data members as loop counters in loop-based
directives.

OpenMP 4.5 allows privatization of non-static data members in non-static
member functions. Patch allows to use and implicit privatization of data
members used as counters in loop-based directives.

llvm-svn: 265121

8 years ago[AArch64] Better errors for out-of-range fixups
Oliver Stannard [Fri, 1 Apr 2016 09:14:50 +0000 (09:14 +0000)]
[AArch64] Better errors for out-of-range fixups

When a fixup that can be resolved by the assembler is out of range, we should
report an error in the source, rather than crashing.

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

llvm-svn: 265120

8 years agoRevert "[OPENMP] Allow skip expression after comma in clauses with lists."
Alexey Bataev [Fri, 1 Apr 2016 08:43:42 +0000 (08:43 +0000)]
Revert "[OPENMP] Allow skip expression after comma in clauses with lists."

This reverts commit http://reviews.llvm.org/rL265003. After some
thoughts decided to emit errors here.

llvm-svn: 265119

8 years agoThinLTO: move ObjCARCContractPass in the CodeGen pipeline
Mehdi Amini [Fri, 1 Apr 2016 08:22:59 +0000 (08:22 +0000)]
ThinLTO: move ObjCARCContractPass in the CodeGen pipeline

This is to be coherent with Full LTO.

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

8 years ago[clang-tidy] Don't delete unused parameter in class override method in anonymous...
Haojian Wu [Fri, 1 Apr 2016 07:57:30 +0000 (07:57 +0000)]
[clang-tidy] Don't delete unused parameter in class override method in anonymous namespace.

Summary: Fixes PR26740.

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 265117

8 years ago[OCaml] Use LLVMCreateMessage with constant strings when calling llvm_raise
Jeroen Ketema [Fri, 1 Apr 2016 07:56:17 +0000 (07:56 +0000)]
[OCaml] Use LLVMCreateMessage with constant strings when calling llvm_raise

The llvm_string_of_message function, called by llvm_raise, calls
LLVMDisposeMessage, which expects the message to be dynamically
allocated; it fails freeing the message otherwise. So always
dynamically allocate with LLVMCreateMessage.

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

llvm-svn: 265116

8 years ago[OCaml] Reinstate data_layout
Jeroen Ketema [Fri, 1 Apr 2016 07:54:24 +0000 (07:54 +0000)]
[OCaml] Reinstate data_layout

Expose LLVMCreateTargetMachineData as data_layout.

As r263530 did for go. From that commit: "LLVMGetTargetDataLayout was
removed from the C API, and then TargetMachine.TargetData was removed.
Later, LLVMCreateTargetMachineData was added to the C API"

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

llvm-svn: 265115

8 years agoScoPDetection: Obtain a known free diagnostic ID
Tobias Grosser [Fri, 1 Apr 2016 07:15:19 +0000 (07:15 +0000)]
ScoPDetection: Obtain a known free diagnostic ID

... instead of hardcoding something that has been free at some point. This fixes
a crash triggered by r265084, where the diagnostic IDs have been shifted in a
way that resulted our hardcode ID to not be assigned any implementation.  Our ID
was likely already wrong earlier on, but this time we really crashed nicely.

llvm-svn: 265114

8 years agoAdd a libLTO API to stop/restart ThinLTO between optimizations and CodeGen
Mehdi Amini [Fri, 1 Apr 2016 06:47:02 +0000 (06:47 +0000)]
Add a libLTO API to stop/restart ThinLTO between optimizations and CodeGen

This allows the linker to instruct ThinLTO to perform only the
optimization part or only the codegen part of the process.

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

8 years ago[PPC64] Bug fix: when enabling sibling-call-opt and shrink-wrapping, the tail call...
Chuang-Yu Cheng [Fri, 1 Apr 2016 06:44:32 +0000 (06:44 +0000)]
[PPC64] Bug fix: when enabling sibling-call-opt and shrink-wrapping, the tail call branch instruction might disappear

Bug Pattern:
    # BB#0:                                 # %entry
    cmpldi  3, 0
    beq-  0, .LBB0_2
    # BB#1:                                 # %exit
    lwz 4, 0(3)
    #TC_RETURNd8 LVComputationKind 0
    .LBB0_2:                                # %cond.false
    mflr 0
    std 0, 16(1)
    stdu 1, -96(1)
    .Ltmp0:
    .cfi_def_cfa_offset 96
    .Ltmp1:
    .cfi_offset lr, 16
    bl __assert_fail
    nop

The branch instruction for tail call return is not generated, because the
shrink-wrapping pass choosing a new Restore Point: %cond.false, so %exit
block is not sent to emitEpilogue, that's why the branch is not generated.

Thanks Kit's opinions!
Reviewers: nemanjai hfinkel tjablin kbarton

http://reviews.llvm.org/D17606

llvm-svn: 265112

8 years agoAdd a module Hash in the bitcode and the combined index, implementing a kind of ...
Mehdi Amini [Fri, 1 Apr 2016 05:33:11 +0000 (05:33 +0000)]
Add a module Hash in the bitcode and the combined index, implementing a kind of "build-id"

This is intended to be used for ThinLTO incremental build.

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

This is a recommit of r265095 after fixing the Windows issues.

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

8 years agoFix MSVC warning "comparison of integers of different signs" (NFC)
Mehdi Amini [Fri, 1 Apr 2016 05:19:14 +0000 (05:19 +0000)]
Fix MSVC warning "comparison of integers of different signs" (NFC)

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

8 years agoFix S390 big endian detection
Mehdi Amini [Fri, 1 Apr 2016 05:12:24 +0000 (05:12 +0000)]
Fix S390 big endian detection

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

8 years agoConst correctness in raw_sha1_ostream (NFC)
Mehdi Amini [Fri, 1 Apr 2016 05:12:18 +0000 (05:12 +0000)]
Const correctness in raw_sha1_ostream (NFC)

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

8 years agoAdd support for computing SHA1 in LLVM
Mehdi Amini [Fri, 1 Apr 2016 04:30:16 +0000 (04:30 +0000)]
Add support for computing SHA1 in LLVM

Provide a class to generate a SHA1 from a sequence of bytes, and
a convenience raw_ostream adaptor.
This will be used to provide a "build-id" by hashing the Module
block when writing bitcode. ThinLTO will use this information for
incremental build.

Reapply r265094 which was reverted in r265102 because it broke
MSVC bots (constexpr is not supported).

http://reviews.llvm.org/D16325

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

8 years agoImprove CHECK-NOT robustness of dllexport tests
Sean Silva [Fri, 1 Apr 2016 03:54:03 +0000 (03:54 +0000)]
Improve CHECK-NOT robustness of dllexport tests

This changes some dllexport tests, to verify that some symbols that
should not be exported are not, in a way that improves the robustness
of CHECK-SAME interaction with CHECK-NOT.

We plan to enable dllimport/dllexport support for the PS4, and these
changes are for points we noticed in our internal testing.

Patch by Warren Ristow!

llvm-svn: 265106

8 years agoUse range-based for loops. NFC.
Michael Kuperstein [Fri, 1 Apr 2016 03:45:08 +0000 (03:45 +0000)]
Use range-based for loops. NFC.

llvm-svn: 265105

8 years agoVisual Studio native visualizers for clang::TemplateSpecializationType
Mike Spertus [Fri, 1 Apr 2016 03:31:43 +0000 (03:31 +0000)]
Visual Studio native visualizers for clang::TemplateSpecializationType

Displays a template specialization as, say, A<int, double>. Does not
yet handle UncommonTemplateNameStorage, QualifiedTemplateName, or
DependentTemplateName, but still more than worthwhile

llvm-svn: 265104

8 years ago[analyzer] Prefer accessor method in extension over category in CallEvent.
Devin Coughlin [Fri, 1 Apr 2016 03:24:13 +0000 (03:24 +0000)]
[analyzer] Prefer accessor method in extension over category in CallEvent.

In ObjCMethodCall:getRuntimeDefinition(), if the method is an accessor in a
category, and it doesn't have a self declaration, first try to find the method
in a class extension. This works around a bug in Sema where multiple accessors
are synthesized for properties in class extensions that are redeclared in a
category. The implicit parameters are not filled in for the method on the
category, which causes a crash when trying to synthesize a getter for the
property in BodyFarm. The Sema bug is tracked as rdar://problem/25481164.

rdar://problem/25056531

llvm-svn: 265103

8 years agoRevert "Add support for computing SHA1 in LLVM"
Mehdi Amini [Fri, 1 Apr 2016 03:03:21 +0000 (03:03 +0000)]
Revert "Add support for computing SHA1 in LLVM"

This reverts commit r265096, r265095, and r265094.
Windows build is broken, and the validation does not pass.

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

8 years agoDon't insert stackrestore on deoptimizing returns
Sanjoy Das [Fri, 1 Apr 2016 02:51:30 +0000 (02:51 +0000)]
Don't insert stackrestore on deoptimizing returns

They're not necessary (since the stack pointer is trivially restored on
return), and the way LLVM inserts the stackrestore calls breaks the
IR (we get a stackrestore between the deoptimize call and the return).

llvm-svn: 265101

8 years agoDon't insert lifetime end markers on deoptimizing returns
Sanjoy Das [Fri, 1 Apr 2016 02:51:26 +0000 (02:51 +0000)]
Don't insert lifetime end markers on deoptimizing returns

They're not necessary (since the lifetime of the alloca is trivially
over due to the return), and the way LLVM inserts the lifetime.end
markers breaks the IR (we get a lifetime end marker between the
deoptimize call and the return).

llvm-svn: 265100

8 years agoDon't use an i64 return type with webkit_jscc
Sanjoy Das [Fri, 1 Apr 2016 02:51:21 +0000 (02:51 +0000)]
Don't use an i64 return type with webkit_jscc

Re-enable an assertion enabled by Justin Lebar in rL265092.  rL265092
was breaking test/CodeGen/X86/deopt-intrinsic.ll because webkit_jscc
does not like non-i64 return types.  Change the test case to not do
that.

llvm-svn: 265099

8 years agoAArch64ISelLowering: Remove unused variables/arguments; NFC
Matthias Braun [Fri, 1 Apr 2016 02:49:17 +0000 (02:49 +0000)]
AArch64ISelLowering: Remove unused variables/arguments; NFC

llvm-svn: 265098

8 years agoFix Sub-register Rewriting in Aggressive Anti-Dependence Breaker
Chuang-Yu Cheng [Fri, 1 Apr 2016 02:05:29 +0000 (02:05 +0000)]
Fix Sub-register Rewriting in Aggressive Anti-Dependence Breaker

Previously, HandleLastUse would delete RegRef information for sub-registers
if they were dead even if their corresponding super-register were still live.

If the super-register were later renamed, then the definitions of the
sub-register would not be updated appropriately. This patch alters the
behavior so that RegInfo information for sub-registers is only deleted when
the sub-register and super-register are both dead.

This resolves PR26775. This is the mirror image of Hal's r227311 commit.

Author: Tom Jablin (tjablin)
Reviewers: kbarton uweigand nemanjai hfinkel

http://reviews.llvm.org/D18448

llvm-svn: 265097

8 years agoAdd missing test for the "Module hash in bitcode" added in r265095
Mehdi Amini [Fri, 1 Apr 2016 01:37:52 +0000 (01:37 +0000)]
Add missing test for the "Module hash in bitcode" added in r265095

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

8 years agoAdd a module Hash in the bitcode and the combined index, implementing a kind of ...
Mehdi Amini [Fri, 1 Apr 2016 01:30:06 +0000 (01:30 +0000)]
Add a module Hash in the bitcode and the combined index, implementing a kind of "build-id"

This is intended to be used for ThinLTO incremental build.

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

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

8 years agoAdd support for computing SHA1 in LLVM
Mehdi Amini [Fri, 1 Apr 2016 01:29:54 +0000 (01:29 +0000)]
Add support for computing SHA1 in LLVM

Provide a class to generate a SHA1 from a sequence of bytes, and
a convenience raw_ostream adaptor.
This will be used to provide a "build-id" by hashing the Module
block when writing bitcode. ThinLTO will use this information for
incremental build.

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

8 years agoRevert "Protect some assertions with NDEBUG rather than DEBUG()."
Justin Lebar [Fri, 1 Apr 2016 01:23:23 +0000 (01:23 +0000)]
Revert "Protect some assertions with NDEBUG rather than DEBUG()."

This reverts r265092, because it breaks CodeGen/X86/deopt-intrinsic.ll.

llvm-svn: 265093

8 years agoProtect some assertions with NDEBUG rather than DEBUG().
Justin Lebar [Fri, 1 Apr 2016 01:09:12 +0000 (01:09 +0000)]
Protect some assertions with NDEBUG rather than DEBUG().

DEBUG() only runs if you pass -debug, but these assertions are generally
useful.

llvm-svn: 265092

8 years ago[NVPTX] Add a truncate DAG node to some calls.
Justin Lebar [Fri, 1 Apr 2016 01:09:10 +0000 (01:09 +0000)]
[NVPTX] Add a truncate DAG node to some calls.

Summary:
Previously, we were running afoul of the assertion

  EVT(CLI.Ins[i].VT) == InVals[i].getValueType() && "LowerCall emitted a value with the wrong type!"

in SelectionDAGBuilder.cpp when running the NVPTX/i8-param.ll test.
This is because our backend (for some reason) treats small return values
as i32, but it wasn't ever truncating the i32 back down to the expected
width in the DAG.

Unclear to me whether this fixes any actual bugs -- in this test, at
least, the generated code is unchanged.

Reviewers: jingyue

Subscribers: llvm-commits, tra, jholewinski

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

llvm-svn: 265091

8 years ago[NVPTX] Read __CUDA_FTZ from module flags in NVVMReflect.
Justin Lebar [Fri, 1 Apr 2016 01:09:07 +0000 (01:09 +0000)]
[NVPTX] Read __CUDA_FTZ from module flags in NVVMReflect.

Summary:
Previously the NVVMReflect pass would read its configuration from
command-line flags or a static configuration given to the pass at
instantiation time.

This doesn't quite work for clang's use-case.  It needs to pass a value
for __CUDA_FTZ down on a per-module basis.  We use a module flag for
this, so the NVVMReflect pass needs to be updated to read said flag.

Reviewers: tra, rnk

Subscribers: cfe-commits, jholewinski

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

llvm-svn: 265090

8 years ago[NVPTX] Annotate some instructions as hasSideEffects = 0.
Justin Lebar [Fri, 1 Apr 2016 01:09:05 +0000 (01:09 +0000)]
[NVPTX] Annotate some instructions as hasSideEffects = 0.

Summary:
Tablegen tries to infer this from the selection DAG patterns defined for
the instructions, but it can't always.

An instructive example is CLZr64.  CLZr32 is correctly inferred to have
no side-effects, but the selection DAG pattern for CLZr64 is slightly
more complicated, and in particular the ctlz DAG node is not at the root
of the pattern.  Thus tablegen can't infer that CLZr64 has no
side-effects.

Reviewers: jholewinski

Subscribers: jholewinski, tra, llvm-commits

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

llvm-svn: 265089

8 years ago[ifcnv] Add brief comment explaining what ifcnv is.
Justin Lebar [Fri, 1 Apr 2016 01:09:03 +0000 (01:09 +0000)]
[ifcnv] Add brief comment explaining what ifcnv is.

llvm-svn: 265088

8 years agoFix Windows build (typo in disk_space() implementation)
Mehdi Amini [Fri, 1 Apr 2016 00:52:05 +0000 (00:52 +0000)]
Fix Windows build (typo in disk_space() implementation)

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

8 years agoFixed an issue that could cause debugserver to return two stop reply packets ($T...
Greg Clayton [Fri, 1 Apr 2016 00:41:29 +0000 (00:41 +0000)]
Fixed an issue that could cause debugserver to return two stop reply packets ($T packets) for one \x03 interrupt. The problem was that when a \x03 byte is sent to debugserver while the process is running, and up calling:

rnb_err_t
RNBRemote::HandlePacket_stop_process (const char *p)
{
    if (!DNBProcessInterrupt(m_ctx.ProcessID()))
        HandlePacket_last_signal (NULL);
    return rnb_success;
}

In the call to DNBProcessInterrupt we did:

nub_bool_t
DNBProcessInterrupt(nub_process_t pid)
{
    MachProcessSP procSP;
    if (GetProcessSP (pid, procSP))
        return procSP->Interrupt();
    return false;
}

This would always return false. It would cause HandlePacket_stop_process to always call "HandlePacket_last_signal (NULL);" which would send an extra stop reply packet _if_ the process is stopped. On a machine with enough cores, it would call DNBProcessInterrupt(...) and then HandlePacket_last_signal(NULL) so quickly that it will never send out an extra stop reply packet. But if the machine is slow enough or doesn't have enough cores, it could cause the call to HandlePacket_last_signal() to actually succeed and send an extra stop reply packet. This would cause problems up in GDBRemoteCommunicationClient::SendContinuePacketAndWaitForResponse() where it would get the first stop reply packet and then possibly return or execute an async packet. If it returned, then the next packet that was sent will get the second stop reply as its response. If it executes an async packet, the async packet will get the wrong response.

To fix this I did the following:
1 - in debugserver, I fixed "bool MachProcess::Interrupt()" to return true if it sends the signal so we avoid sending the stop reply twice on slower machines
2 - Added a log line to RNBRemote::HandlePacket_stop_process() to say if we ever send an extra stop reply so we will see this in the darwin console output if this does happen
3 - Added response validators to StringExtractorGDBRemote so that we can verify some responses to some packets.
4 - Added validators to packets that often follow stop reply packets like the "m" packet for memory reads, JSON packets since "jThreadsInfo" is often sent immediately following a stop reply.
5 - Modified GDBRemoteCommunicationClient::SendPacketAndWaitForResponseNoLock() to validate responses. Any "StringExtractorGDBRemote &response" that contains a valid response verifier will verify the response and keep looking for correct responses up to 3 times. This will help us get back on track if we do get extra stop replies. If a StringExtractorGDBRemote does not have a response validator, it will accept any packet in response.
6 - In GDBRemoteCommunicationClient::SendPacketAndWaitForResponse we copy the response validator from the "response" argument over into m_async_response so that if we send the packet by interrupting the running process, we can validate the response we actually get in GDBRemoteCommunicationClient::SendContinuePacketAndWaitForResponse()
7 - Modified GDBRemoteCommunicationClient::SendContinuePacketAndWaitForResponse() to always check for an extra stop reply packet for 100ms when the process is interrupted. We were already doing this because we might interrupt a process with a \x03 packet, yet the process was in the process of stopping due to another reason. This race condition could cause an extra stop reply packet because the GDB remote protocol says if a \x03 packet is sent while the process is stopped, we should send a stop reply packet back. Now we always check for an extra stop reply packet when we manually interrupt a process.

The issue was showing up when our IDE would attempt to set a breakpoint while the process is running and this would happen:

--> \x03
<-- $T<stop reply 1>
--> z0,AAAAA,BB (set breakpoint)
<-- $T<stop reply 1> (incorrect extra stop reply packet)
--> c
<-- OK (response from z0 packet)

Now all packet traffic was off by one response. Since we now have a validator on the response for "z" packets, we do this:

--> \x03
<-- $T<stop reply 1>
--> z0,AAAAA,BB (set breakpoint)
<-- $T<stop reply 1> (Ignore this because this can't be the response to z0 packets)
<-- OK -- (we are back on track as this is a valid response to z0)
...

As time goes on we should add more packet validators.

<rdar://problem/22859505>

llvm-svn: 265086

8 years ago[LTO] Inherit options from Codegen before initializing TargetMachine.
Davide Italiano [Fri, 1 Apr 2016 00:35:29 +0000 (00:35 +0000)]
[LTO] Inherit options from Codegen before initializing TargetMachine.

This fixes bootstrap of llvm-tblgen (with LTO) and PR27150.
Slightly longer explanation follows.

Emission of .init_array instead of .ctors is supported only on a
subset of the Target LLVM supports. Codegen needs to be conservative
and always emit .ctors unless instructed otherwise (based on target).
If the dynamic linker sees .init_array it completely ignores
what's inside .ctors and therefore some constructors are not called
(and this causes llvm-tblgen to crash on startup).

Teach LLD/LTO about the Codegen options so we end up always emitting
.init_array and avoid this issue.
In future, we might end up supporting mix of .ctors and .init_array
in different input files if this shows up as a real-world use case.
The way gold handles this case is mapping .ctors from input into
.init_array in output. There's also another caveat because
as far as I understand .ctors run in reverse order so when we do
the copy/mapping we need to reverse copy in the output if there's
more than one ctor. That's why I'd rather avoid this complicate logic
unless there's a real need.

An analogous reasoning holds for .dtors/.fini_array.

llvm-svn: 265085

8 years ago[LoopVectorize] Don't unconditionally print vectorization diagnostics
Akira Hatanaka [Fri, 1 Apr 2016 00:34:39 +0000 (00:34 +0000)]
[LoopVectorize] Don't unconditionally print vectorization diagnostics
when compiling with LTO.

r244523 a new class DiagnosticInfoOptimizationRemarkAnalysisAliasing for
optimization analysis remarks related to pointer aliasing without
guarding it in isDiagnosticEnabled in LLVMContext.cpp. This caused the
diagnostic message to be printed unconditionally when compiling with
LTO.

This commit cleans up isDiagnosticEnabled and makes sure all the
vectorization optimization remarks are guarded.

rdar://problem/25382153

llvm-svn: 265084

8 years ago[CUDA] Fix typo in __clang_cuda_runtime_wrapper.h.
Justin Lebar [Fri, 1 Apr 2016 00:25:42 +0000 (00:25 +0000)]
[CUDA] Fix typo in __clang_cuda_runtime_wrapper.h.

We're #including the wrong file!

llvm-svn: 265083

8 years agoAdd disk_space() to llvm::fs
Mehdi Amini [Fri, 1 Apr 2016 00:18:08 +0000 (00:18 +0000)]
Add disk_space() to llvm::fs

Summary: Adapted from Boost::filesystem.
(This is a reapply by reverting commit r265080 and fixing the WinAPI part)

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

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

8 years agotestcase gardening: update the emissionKind enum to the new syntax. (NFC)
Adrian Prantl [Fri, 1 Apr 2016 00:16:49 +0000 (00:16 +0000)]
testcase gardening: update the emissionKind enum to the new syntax. (NFC)

llvm-svn: 265081

8 years agoRevert "Add disk_space() to llvm::fs"
Mehdi Amini [Fri, 1 Apr 2016 00:13:31 +0000 (00:13 +0000)]
Revert "Add disk_space() to llvm::fs"

This reverts commit r265074 and r265068.
Breaks windows build

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

8 years agoFix a captialization error in r265077.
Adrian Prantl [Fri, 1 Apr 2016 00:00:27 +0000 (00:00 +0000)]
Fix a captialization error in r265077.

llvm-svn: 265079

8 years agoAdapt to LLVM API change in r265077.
Adrian Prantl [Thu, 31 Mar 2016 23:57:45 +0000 (23:57 +0000)]
Adapt to LLVM API change in r265077.
EmissionKind moved from DIBuilder to DICompileUnit.

<rdar://problem/25427165>

llvm-svn: 265078

8 years agoMove the DebugEmissionKind enum from DIBuilder into DICompileUnit.
Adrian Prantl [Thu, 31 Mar 2016 23:56:58 +0000 (23:56 +0000)]
Move the DebugEmissionKind enum from DIBuilder into DICompileUnit.

This mostly cosmetic patch moves the DebugEmissionKind enum from DIBuilder
into DICompileUnit. DIBuilder is not the right place for this enum to live
in — a metadata consumer should not have to include DIBuilder.h.
I also added a Verifier check that checks that the emission kind of a
DICompileUnit is actually legal.

http://reviews.llvm.org/D18612
<rdar://problem/25427165>

llvm-svn: 265077

8 years agoFollow-up to r265036: I got these iterators mixed up
Hans Wennborg [Thu, 31 Mar 2016 23:55:16 +0000 (23:55 +0000)]
Follow-up to r265036: I got these iterators mixed up

llvm-svn: 265076

8 years agoclang-format the large enum definitions in LLVMBitCodes.h
Mehdi Amini [Thu, 31 Mar 2016 23:27:37 +0000 (23:27 +0000)]
clang-format the large enum definitions in LLVMBitCodes.h

Suggestion from Duncan in a review thread.

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

8 years agoUse const ref instead of value for Twine in the disk_space() API
Mehdi Amini [Thu, 31 Mar 2016 23:14:45 +0000 (23:14 +0000)]
Use const ref instead of value for Twine in the disk_space() API

Thanks Rui for noticing!

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

8 years agoELF: Correctly handle --whole-archive for thin archives.
Peter Collingbourne [Thu, 31 Mar 2016 23:12:18 +0000 (23:12 +0000)]
ELF: Correctly handle --whole-archive for thin archives.

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

llvm-svn: 265073

8 years agoUpdate release notes with list of checks added since 3.8.
Eugene Zelenko [Thu, 31 Mar 2016 23:09:42 +0000 (23:09 +0000)]
Update release notes with list of checks added since 3.8.

Fix some checks documentation style.

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

llvm-svn: 265072

8 years agolit: python3 compatibility fix
Matthias Braun [Thu, 31 Mar 2016 23:08:55 +0000 (23:08 +0000)]
lit: python3 compatibility fix

llvm-svn: 265070

8 years agoCreate thin archive in GNU format to fix test on OS X.
Peter Collingbourne [Thu, 31 Mar 2016 23:07:50 +0000 (23:07 +0000)]
Create thin archive in GNU format to fix test on OS X.

llvm-svn: 265069

8 years agoAdd disk_space() to llvm::fs
Mehdi Amini [Thu, 31 Mar 2016 23:05:26 +0000 (23:05 +0000)]
Add disk_space() to llvm::fs

Summary: Adapted from Boost::filesystem.
(This is a reapply by reverting commit r265062 and fixing the WinAPI part)

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

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

8 years agoMove asm-printer-topological-order.ll to PowerPC backend
Tim Shen [Thu, 31 Mar 2016 22:32:10 +0000 (22:32 +0000)]
Move asm-printer-topological-order.ll to PowerPC backend

llvm-svn: 265067

8 years agoObject: Add function for moving thin archive object buffer vector out of Archive.
Peter Collingbourne [Thu, 31 Mar 2016 22:08:57 +0000 (22:08 +0000)]
Object: Add function for moving thin archive object buffer vector out of Archive.

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

llvm-svn: 265066

8 years agoObject: Correctly read thin archives containing absolute paths.
Peter Collingbourne [Thu, 31 Mar 2016 22:08:31 +0000 (22:08 +0000)]
Object: Correctly read thin archives containing absolute paths.

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

llvm-svn: 265065

8 years ago[AsmPrinter] Print aliases in topological order
Tim Shen [Thu, 31 Mar 2016 22:08:19 +0000 (22:08 +0000)]
[AsmPrinter] Print aliases in topological order

Print aliases in topological order, that is, for any alias a = b,
b must be printed before a. This is because on some targets (e.g. PowerPC)
linker expects aliases in such an order to generate correct TOC information.

GCC also prints aliases in topological order.

llvm-svn: 265064

8 years agoFix PR26940 where compiles times regressed massively.
Chandler Carruth [Thu, 31 Mar 2016 21:55:58 +0000 (21:55 +0000)]
Fix PR26940 where compiles times regressed massively.

Patch by Jonas Paulsson. Original description:
Bugfix in buildSchedGraph() to make -dag-maps-huge-region work properly

I found that the reduction of the maps did in fact never happen in this
test case. This was because *all* the stores / loads were made with
addresses from arguments and they thus became "unknown" stores / loads.
Fixed by removing continue statements and making sure that the test for
reduction always takes place.

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

llvm-svn: 265063

8 years agoRevert "Add disk_space() to llvm::fs"
Mehdi Amini [Thu, 31 Mar 2016 21:55:35 +0000 (21:55 +0000)]
Revert "Add disk_space() to llvm::fs"

Breaks windows bot.
This reverts commit r265050.
This reverts commit r265055.

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

8 years agoPreserve blockaddress use edges in the module splitter.
Evgeniy Stepanov [Thu, 31 Mar 2016 21:55:11 +0000 (21:55 +0000)]
Preserve blockaddress use edges in the module splitter.

"blockaddress" can not apply to an external function. All
blockaddress constant uses must belong to the same module as the
definition of the target function.

llvm-svn: 265061

8 years ago[NVPTX] Infer __nvvm_reflect as nounwind, readnone
David Majnemer [Thu, 31 Mar 2016 21:29:57 +0000 (21:29 +0000)]
[NVPTX] Infer __nvvm_reflect as nounwind, readnone

This patch simply mirrors the attributes we give to @llvm.nvvm.reflect
to the __nvvm_reflect libdevice call.  This shaves about 30% of the code
in libdevice away because of CSE opportunities.  It's also helps us
figure out that libdevice implementations of transcendental functions
don't have side-effects.

llvm-svn: 265060

8 years ago[ELF] Implement infrastructure for thunk code creation
Simon Atanasyan [Thu, 31 Mar 2016 21:26:23 +0000 (21:26 +0000)]
[ELF] Implement infrastructure for thunk code creation

Some targets might require creation of thunks. For example, MIPS targets
require stubs to call PIC code from non-PIC one. The patch implements
infrastructure for thunk code creation and provides support for MIPS
LA25 stubs. Any MIPS PIC code function is invoked with its address
in register $t9. So if we have a branch instruction from non-PIC code
to the PIC one we cannot make the jump directly and need to create a small
stub to save the target function address.
See page 3-38 ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf

- In relocation scanning phase we ask target about thunk creation necessity
by calling `TagetInfo::needsThunk` method. The `InputSection` class
maintains list of Symbols requires thunk creation.

- Reassigning offsets performed for each input sections after relocation
scanning complete because position of each section might change due
thunk creation.

- The patch introduces new dedicated value for DefinedSynthetic symbols
DefinedSynthetic::SectionEnd. Synthetic symbol with that value always
points to the end of the corresponding output section. That allows to
escape updating synthetic symbols if output sections sizes changes after
relocation scanning due thunk creation.

- In the `InputSection::writeTo` method we write thunks after corresponding
input section. Each thunk is written by calling `TargetInfo::writeThunk` method.

- The patch supports the only type of thunk code for each target. For now,
it is enough.

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

llvm-svn: 265059

8 years agoELF: Add more variants of ignored flags.
Peter Collingbourne [Thu, 31 Mar 2016 21:18:34 +0000 (21:18 +0000)]
ELF: Add more variants of ignored flags.

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

llvm-svn: 265058

8 years ago[CMake] Provide the ability to skip stripping when generating dSYMs
Chris Bieneman [Thu, 31 Mar 2016 21:17:19 +0000 (21:17 +0000)]
[CMake] Provide the ability to skip stripping when generating dSYMs

For debugging it is useful to be able to generate dSYM files but not strip the executables. This change adds the ability to skip stripping by setting COMPILER_RT_EXTERNALIZE_DEBUGINFO_SKIP_STRIP=On.

llvm-svn: 265057

8 years agoDefine a utility function to read -O and lto-O options.
Rui Ueyama [Thu, 31 Mar 2016 21:15:31 +0000 (21:15 +0000)]
Define a utility function to read -O and lto-O options.

llvm-svn: 265056

8 years agoWdocumentation parameter fix
Simon Pilgrim [Thu, 31 Mar 2016 21:13:49 +0000 (21:13 +0000)]
Wdocumentation parameter fix

llvm-svn: 265055

8 years agofix typo; NFC
Sanjay Patel [Thu, 31 Mar 2016 21:00:48 +0000 (21:00 +0000)]
fix typo; NFC

llvm-svn: 265054

8 years agoELF: Add flag for controlling LTO optimization level.
Peter Collingbourne [Thu, 31 Mar 2016 21:00:27 +0000 (21:00 +0000)]
ELF: Add flag for controlling LTO optimization level.

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

llvm-svn: 265053

8 years agoFixed signed/unsigned warning
Simon Pilgrim [Thu, 31 Mar 2016 20:57:36 +0000 (20:57 +0000)]
Fixed signed/unsigned warning

llvm-svn: 265052

8 years ago[AArch64] Allow loads with imp-def to be handled in getMemOpBaseRegImmOfsWidth()
Jun Bum Lim [Thu, 31 Mar 2016 20:53:47 +0000 (20:53 +0000)]
[AArch64] Allow loads with imp-def to be handled in getMemOpBaseRegImmOfsWidth()

Summary:
This change will allow loads with imp-def to be clustered in machine-scheduler pass.
areMemAccessesTriviallyDisjoint() can also handle loads with imp-def.

Reviewers: mcrosier, jmolloy, t.p.northover

Subscribers: aemerson, rengolin, mcrosier, llvm-commits

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

llvm-svn: 265051

8 years agoAdd disk_space() to llvm::fs
Mehdi Amini [Thu, 31 Mar 2016 20:48:27 +0000 (20:48 +0000)]
Add disk_space() to llvm::fs

Summary: Adapted from Boost::filesystem.

Reviewers: bruno, silvas

Subscribers: tberghammer, danalbert, llvm-commits, srhines

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

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

8 years ago[PowerPC] Cleanup test/CodeGen/PowerPC/qpx-load-splat.ll
Hal Finkel [Thu, 31 Mar 2016 20:45:00 +0000 (20:45 +0000)]
[PowerPC] Cleanup test/CodeGen/PowerPC/qpx-load-splat.ll

Removing unnecessary attributes and metadata...

llvm-svn: 265049

8 years ago[x86] add memset tests to show another potential improvement
Sanjay Patel [Thu, 31 Mar 2016 20:40:32 +0000 (20:40 +0000)]
[x86] add memset tests to show another potential improvement

llvm-svn: 265048

8 years ago[PowerPC] Add a late MI-level pass for QPX load/splat simplification
Hal Finkel [Thu, 31 Mar 2016 20:39:41 +0000 (20:39 +0000)]
[PowerPC] Add a late MI-level pass for QPX load/splat simplification

Chapter 3 of the QPX manual states that, "Scalar floating-point load
instructions, defined in the Power ISA, cause a replication of the source data
across all elements of the target register." Thus, if we have a load followed
by a QPX splat (from the first lane), the splat is redundant. This adds a late
MI-level pass to remove the redundant splats in some of these cases
(specifically when both occur in the same basic block).

This optimization is scheduled just prior to post-RA scheduling. It can't happen
before anything that might replace the load with some already-computed quantity
(i.e. store-to-load forwarding).

llvm-svn: 265047

8 years agoRevert r265039 "[X86] Merge adjacent stack adjustments in eliminateCallFramePseudoIns...
Hans Wennborg [Thu, 31 Mar 2016 20:27:30 +0000 (20:27 +0000)]
Revert r265039 "[X86] Merge adjacent stack adjustments in eliminateCallFramePseudoInstr (PR27140)"

I think it might have caused these build breakages:
http://lab.llvm.org:8011/builders/clang-x86-win2008-selfhost/builds/7234/steps/build%20stage%202/logs/stdio
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/19566/steps/run%20tests/logs/stdio

llvm-svn: 265046