platform/upstream/llvm.git
9 years ago[OPENMP] Fix use of unsigned counters in loops with zero trip count.
Alexey Bataev [Wed, 22 Apr 2015 11:59:37 +0000 (11:59 +0000)]
[OPENMP] Fix use of unsigned counters in loops with zero trip count.

Patch fixes bugs in codegen for loops with unsigned counters and zero trip count. Previously preconditions for all loops were built using logic (Upper - Lower) > 0. But if the loop is a loop with zero trip count, then Upper - Lower is < 0 only for signed integer, for unsigned we're running into an underflow situation.
In this patch we're using original Lower<Upper condition to check that loop body can be executed at least once. Also this allows to skip code generation for loops, if it is known that preconditions for the loop are always false.
Differential Revision: http://reviews.llvm.org/D9103

llvm-svn: 235500

9 years ago[ARM] Update R_ARM_TARGET1 command line option names (remove prefix 'arm-')
Leny Kholodov [Wed, 22 Apr 2015 11:58:09 +0000 (11:58 +0000)]
[ARM] Update R_ARM_TARGET1 command line option names (remove prefix 'arm-')

Command line options --arm-target1-rel and --arm-target1-abs have been renamed to be compatible with GNU linkers.
Two tests have been updated:
  test/elf/options/target-specific-args.test
  test/elf/ARM/rel-arm-target1.test

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

llvm-svn: 235499

9 years ago[ARM] Replace branches to undefined weak functions with NOP
Leny Kholodov [Wed, 22 Apr 2015 11:47:53 +0000 (11:47 +0000)]
[ARM] Replace branches to undefined weak functions with NOP

According to the code model (ARM, Thumb, Thumb2) this patch updates the b/bl/blx 0 instructions with NOP.
test/elf/ARM/weak-branch.test has been added with tests for all available NOP (A1, T1, T2 encodings).

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

llvm-svn: 235498

9 years ago[DAGCombine] Disable select(c, load,load) for indexed loads
Hal Finkel [Wed, 22 Apr 2015 11:32:25 +0000 (11:32 +0000)]
[DAGCombine] Disable select(c, load,load) for indexed loads

This turned up after r235333, but was a pre-existing bug. The optimization
which transforms select(c, load, load) into a load of a select of the addresses
does not handle indexed loads (pre/post inc/dec). However, it did not check for
them either, leading to a crash if it tried to transform one of them.

llvm-svn: 235497

9 years ago[OPENMP] Codegen for 'ordered' directive.
Alexey Bataev [Wed, 22 Apr 2015 11:15:40 +0000 (11:15 +0000)]
[OPENMP] Codegen for 'ordered' directive.

Add codegen for 'ordered' directive:

__kmpc_ordered(ident_t *, gtid);
<associated statement>;
__kmpc_end_ordered(ident_t *, gtid);
Also for 'for' directives with the dynamic scheduling and an 'ordered' clause added a call to '__kmpc_dispatch_fini_(4|8)[u]()' function after increment expression for loop control variable:

while(__kmpc_dispatch_next(&LB, &UB)) {
  idx = LB;
  while (idx <= UB) { BODY; ++idx;
    __kmpc_dispatch_fini_(4|8)[u](); // For ordered loops only.
  } // inner loop
}
Differential Revision: http://reviews.llvm.org/D9070

llvm-svn: 235496

9 years agoRevert "[mips][FastISel] Implement shift ops for Mips fast-isel."
Vasileios Kalintiris [Wed, 22 Apr 2015 10:08:46 +0000 (10:08 +0000)]
Revert "[mips][FastISel] Implement shift ops for Mips fast-isel."

This reverts commit r235194. It was causing a failure in FastISel buildbots
due to sign-extension issues.

llvm-svn: 235495

9 years agoFix signle stepping on arm when multiple thread is involved
Tamas Berghammer [Wed, 22 Apr 2015 10:00:23 +0000 (10:00 +0000)]
Fix signle stepping on arm when multiple thread is involved

On linux-arm we use software single stepping where setting the new
breakpoint is only possible while the process is in stopped state.
This CL moves the setup code for single stepping form the SigneStep
operation into the Resum method to avoid an error when the process
already started when we want to step one of the thread.

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

llvm-svn: 235494

9 years ago[DWARF CFI] Add support for DW_CFA_def_cfa_sf when parsing CIE
Pavel Labath [Wed, 22 Apr 2015 09:47:21 +0000 (09:47 +0000)]
[DWARF CFI] Add support for DW_CFA_def_cfa_sf when parsing CIE

Summary: Just what it says on the box.

Reviewers: jasonmolenda

Subscribers: lldb-commits

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

llvm-svn: 235493

9 years agoclang-format: Fix for #pragma option formatting.
Daniel Jasper [Wed, 22 Apr 2015 09:45:42 +0000 (09:45 +0000)]
clang-format: Fix for #pragma option formatting.

Adapted patch from Sergey Razmetov. Thank you.

llvm-svn: 235492

9 years ago[AArch64] Disable complex GEP optimization by default.
James Molloy [Wed, 22 Apr 2015 09:11:38 +0000 (09:11 +0000)]
[AArch64] Disable complex GEP optimization by default.

Enough concerns were raised that this optimization is pessimising some code patterns.

The obvious fix, to add a Reassociate run afterwards, causes even more pessimisation in some cases due to fewer complex addressing modes being matched. As there isn't a trivial fix for this, backing this out by default until someone gets a chance to fix the addressing mode matcher.

llvm-svn: 235491

9 years agoHave more strict type checks when creating BinOp nodes in BitcodeReader
Filipe Cabecinhas [Wed, 22 Apr 2015 09:06:21 +0000 (09:06 +0000)]
Have more strict type checks when creating BinOp nodes in BitcodeReader

Summary: Bug found with AFL.

Reviewers: rafael, bkramer

Subscribers: llvm-commits

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

llvm-svn: 235489

9 years ago[Mips] Assign .MIPS.options section to the PT_LOAD segment
Simon Atanasyan [Wed, 22 Apr 2015 08:09:38 +0000 (08:09 +0000)]
[Mips] Assign .MIPS.options section to the PT_LOAD segment

llvm-svn: 235488

9 years ago[ELF] Allow TargetLayout descendants to control assignment sections to segments
Simon Atanasyan [Wed, 22 Apr 2015 07:57:35 +0000 (07:57 +0000)]
[ELF] Allow TargetLayout descendants to control assignment sections to segments

The TargetLayout class puts two sections into the same segment if they
have equal segment types and the same section flags (SHF_xxx). To be
able to merge some sort of sections into the same segment we drop some
flags before comparison. For example to merge string sections into Data
segment we drop SHF_STRINGS and SHF_MERGE flags.

The patch allows TargetLayout descendants to drop some target specific
section flags. MIPS target needs that to merge .MIPS.options section
which has SHF_MIPS_NOSTRIP flag into the LOAD segment.

http://reviews.llvm.org/D9160

llvm-svn: 235487

9 years ago[ARM] Implement veneers for dynamic executable linking
Denis Protivensky [Wed, 22 Apr 2015 07:51:26 +0000 (07:51 +0000)]
[ARM] Implement veneers for dynamic executable linking

llvm-svn: 235486

9 years ago[ARM] Move veneer generators to base class. NFC
Denis Protivensky [Wed, 22 Apr 2015 07:45:55 +0000 (07:45 +0000)]
[ARM] Move veneer generators to base class. NFC

llvm-svn: 235485

9 years ago[ARM] Rename static veneer atoms to absolute code veneer atoms
Denis Protivensky [Wed, 22 Apr 2015 07:38:47 +0000 (07:38 +0000)]
[ARM] Rename static veneer atoms to absolute code veneer atoms

No functional changes.

llvm-svn: 235484

9 years ago[patchpoint] Add support for symbolic patchpoint targets to SelectionDAG and the
Lang Hames [Wed, 22 Apr 2015 06:02:31 +0000 (06:02 +0000)]
[patchpoint] Add support for symbolic patchpoint targets to SelectionDAG and the
X86 backend.

The code generated for symbolic targets is identical to the code generated for
constant targets, except that a relocation is emitted to fix up the actual
target address at link-time. This allows IR and object files containing
patchpoints to be cached across JIT-invocations where the target address may
change.

llvm-svn: 235483

9 years ago[TableGen] Use range based for loops.
Craig Topper [Wed, 22 Apr 2015 05:27:47 +0000 (05:27 +0000)]
[TableGen] Use range based for loops.

llvm-svn: 235482

9 years ago[TableGen] Remove some deletes that violate ownership semantics. These don't seem...
Craig Topper [Wed, 22 Apr 2015 05:27:11 +0000 (05:27 +0000)]
[TableGen] Remove some deletes that violate ownership semantics. These don't seem to execute in our codebase today and date back to a time when there was an allocation in this function.

llvm-svn: 235481

9 years agoRevert r235219, it's not needed after r235450.
Yaron Keren [Wed, 22 Apr 2015 05:06:57 +0000 (05:06 +0000)]
Revert r235219, it's not needed after r235450.

llvm-svn: 235480

9 years agoReplace std::auto_ptr with std::unique_ptr
David Blaikie [Wed, 22 Apr 2015 04:39:13 +0000 (04:39 +0000)]
Replace std::auto_ptr with std::unique_ptr

std::auto_ptr is deprecated in GCC 5.0, and we are already using
std::unique_ptr all over the place.

Patch by Xan López.

llvm-svn: 235479

9 years agoFix up Exception demo from recent opaque pointer type changes to GEP
David Blaikie [Wed, 22 Apr 2015 04:24:43 +0000 (04:24 +0000)]
Fix up Exception demo from recent opaque pointer type changes to GEP

llvm-svn: 235478

9 years ago[TableGen] Make BitRecTy::baseClassOf return true when RHS is an IntRecTy.
Craig Topper [Wed, 22 Apr 2015 04:18:32 +0000 (04:18 +0000)]
[TableGen] Make BitRecTy::baseClassOf return true when RHS is an IntRecTy.

Previously the code was accidentally checking if 'this' was an IntRecTy which it can't be since 'this' is a BitRecTy. Looking back at the history it appears it was intended to check RHS.

llvm-svn: 235477

9 years agoDon't use 'nullptr' in comment. Just use 'null'.
Craig Topper [Wed, 22 Apr 2015 04:18:27 +0000 (04:18 +0000)]
Don't use 'nullptr' in comment. Just use 'null'.

llvm-svn: 235476

9 years ago[opaque pointer types] Serialize the value type for atomic store instructions
David Blaikie [Wed, 22 Apr 2015 04:14:46 +0000 (04:14 +0000)]
[opaque pointer types] Serialize the value type for atomic store instructions

Without pointee types the space optimization of storing only the pointer
type and not the value type won't be viable - so add the extra type
information that would be missing.

llvm-svn: 235475

9 years ago[opaque pointer types] Serialize the value type for store instructions
David Blaikie [Wed, 22 Apr 2015 04:14:42 +0000 (04:14 +0000)]
[opaque pointer types] Serialize the value type for store instructions

Without pointee types the space optimization of storing only the pointer
type and not the value type won't be viable - so add the extra type
information that would be missing.

Storeatomic coming soon.

llvm-svn: 235474

9 years agoLinker: Add flag to override linkage rules
Duncan P. N. Exon Smith [Wed, 22 Apr 2015 04:11:00 +0000 (04:11 +0000)]
Linker: Add flag to override linkage rules

Add a flag to lib/Linker (and `llvm-link`) to override linkage rules.
When set, the functions in the source module *always* replace those in
the destination module.

The `llvm-link` option is `-override=abc.ll`.  All the "regular" modules
are loaded and linked first, followed by the `-override` modules.  This
is useful for debugging workflows where some subset of the module (e.g.,
a single function) is extracted into a separate file where it's
optimized differently, before being merged back in.

Patch by Luqman Aden!

llvm-svn: 235473

9 years agollvm-link: Factor out loop over input files, NFC
Duncan P. N. Exon Smith [Wed, 22 Apr 2015 04:08:22 +0000 (04:08 +0000)]
llvm-link: Factor out loop over input files, NFC

Factor the loop for linking input files together into a combined module
into a separate function.  This is in preparation for an upcoming patch
that runs the logic twice.

Patch by Luqman Aden!

llvm-svn: 235472

9 years agoDon't dllimport/export class members with internal linkage (PR23308)
Hans Wennborg [Wed, 22 Apr 2015 04:05:17 +0000 (04:05 +0000)]
Don't dllimport/export class members with internal linkage (PR23308)

For example, a function taking a parameter with internal linkage will
itself have internal linkage since it cannot be called outside the
translation unit.

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

llvm-svn: 235471

9 years agoWrap to 80 columns, fix typo in comment. No behavior change.
Nico Weber [Wed, 22 Apr 2015 03:44:51 +0000 (03:44 +0000)]
Wrap to 80 columns, fix typo in comment. No behavior change.

llvm-svn: 235470

9 years agoRevert "[TableGen] Use cast instead of dyn_cast where result isn't checked before...
Craig Topper [Wed, 22 Apr 2015 02:59:06 +0000 (02:59 +0000)]
Revert "[TableGen] Use cast instead of dyn_cast where result isn't checked before being dereferenced."

Turns out I misread the parentheses. Though I'm pretty sure its always a RecordRecTy and non of the callers really seem to expect null. But until I'm completely sure I'm going to revert this.

llvm-svn: 235469

9 years agoFix stale comment that mentioned 0 instead of nullptr. NFC.
Craig Topper [Wed, 22 Apr 2015 02:59:03 +0000 (02:59 +0000)]
Fix stale comment that mentioned 0 instead of nullptr. NFC.

llvm-svn: 235468

9 years ago[TableGen] Remove Pool helper class and just use unique_ptr in the maps.
Craig Topper [Wed, 22 Apr 2015 02:20:44 +0000 (02:20 +0000)]
[TableGen] Remove Pool helper class and just use unique_ptr in the maps.

llvm-svn: 235467

9 years ago[TableGen] Use StringRecTy::get() instead of allocating (and leaking) a StringRecTy...
Craig Topper [Wed, 22 Apr 2015 02:09:47 +0000 (02:09 +0000)]
[TableGen] Use StringRecTy::get() instead of allocating (and leaking) a StringRecTy object.

llvm-svn: 235466

9 years ago[TableGen] Use 'isa' to identify UnsetInits rather than comparing with the singleton...
Craig Topper [Wed, 22 Apr 2015 02:09:45 +0000 (02:09 +0000)]
[TableGen] Use 'isa' to identify UnsetInits rather than comparing with the singleton object created by UnsetInit::get(). Makes it more consistent with the other types.

llvm-svn: 235465

9 years ago[modules] Cope with partial module macro information, fix memory leak found by buildbot.
Richard Smith [Wed, 22 Apr 2015 02:09:43 +0000 (02:09 +0000)]
[modules] Cope with partial module macro information, fix memory leak found by buildbot.

llvm-svn: 235464

9 years ago[TableGen] Use cast instead of dyn_cast where result isn't checked before being deref...
Craig Topper [Wed, 22 Apr 2015 02:09:42 +0000 (02:09 +0000)]
[TableGen] Use cast instead of dyn_cast where result isn't checked before being dereferenced.

llvm-svn: 235463

9 years agoCleanup formatting for consistency with surrounding code.
Craig Topper [Wed, 22 Apr 2015 02:09:39 +0000 (02:09 +0000)]
Cleanup formatting for consistency with surrounding code.

llvm-svn: 235462

9 years ago[modules] Build a DAG of module macros for each identifier.
Richard Smith [Wed, 22 Apr 2015 00:26:11 +0000 (00:26 +0000)]
[modules] Build a DAG of module macros for each identifier.

This graph will be used to determine the current set of active macros. This is
foundation work for getting macro visibility correct across submodules of the
current module. No functionality change for now.

llvm-svn: 235461

9 years ago[x86] allow 64-bit extracted vector element integer stores on a 32-bit system
Sanjay Patel [Wed, 22 Apr 2015 00:24:30 +0000 (00:24 +0000)]
[x86] allow 64-bit extracted vector element integer stores on a 32-bit system

With SSE2, we can generate a 'movq' or other 64-bit store op on a 32-bit system
even though 64-bit integers are not legal types.

So instead of producing this:

  pshufd $229, %xmm0, %xmm1      ## xmm1 = xmm0[1,1,2,3]
  movd %xmm0, (%eax)
  movd %xmm1, 4(%eax)

We can do:

  movq %xmm0, (%eax)

This is a fix for the problem noted in D7296.

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

llvm-svn: 235460

9 years ago[WinEH] Correctly handle inlined __finally blocks with captures
Reid Kleckner [Wed, 22 Apr 2015 00:07:52 +0000 (00:07 +0000)]
[WinEH] Correctly handle inlined __finally blocks with captures

We should also teach the inliner to collapse framerecover of
frameaddress of the current frame down to an alloca, but that can happen
later.

llvm-svn: 235459

9 years ago[opaque pointer type] Avoid using PointerType::getElementType for a few cases of...
David Blaikie [Tue, 21 Apr 2015 23:26:57 +0000 (23:26 +0000)]
[opaque pointer type] Avoid using PointerType::getElementType for a few cases of CallInst

Calls to llvm::Value::mutateType are becoming extra-sensitive now that
instructions have extra type information that will not be derived from
operands or result type (alloca, gep, load, call/invoke, etc... ). The
special-handling for mutateType will get more complicated as this work
continues - it might be worth making mutateType virtual & pushing the
complexity down into the classes that need special handling. But with
only two significant uses of mutateType (vectorization and linking) this
seems OK for now.

Totally open to ideas/suggestions/improvements, of course.

With this, and a bunch of exceptions, we can roundtrip an indirect call
site through bitcode and IR. (a direct call site is actually trickier...
I haven't figured out how to deal with the IR deserializer's lazy
construction of Function/GlobalVariable decl's based on the type of the
entity which means looking through the "pointer to T" type referring to
the global)

llvm-svn: 235458

9 years agoRemove a zero-length file of llvm/test/Transforms/InstCombine/descale-zero.ll.
NAKAMURA Takumi [Tue, 21 Apr 2015 23:14:33 +0000 (23:14 +0000)]
Remove a zero-length file of llvm/test/Transforms/InstCombine/descale-zero.ll.

llvm-svn: 235457

9 years agoExpose -fdiagnostics-parseable-fixits to clang-cl
Hans Wennborg [Tue, 21 Apr 2015 23:12:03 +0000 (23:12 +0000)]
Expose -fdiagnostics-parseable-fixits to clang-cl

Patch by Daniel Cheng!

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

llvm-svn: 235456

9 years agoLimiting gep merging to fix the performance problem described in
Wei Mi [Tue, 21 Apr 2015 23:02:15 +0000 (23:02 +0000)]
Limiting gep merging to fix the performance problem described in
https://llvm.org/bugs/show_bug.cgi?id=23163.

Gep merging sometimes behaves like a reverse CSE/LICM optimization,
which has negative impact on performance. In this patch we restrict
gep merging to happen only when the indexes to be merged are both consts,
which ensures such merge is always beneficial.

The patch makes gep merging only happen in very restrictive cases.
It is possible that some analysis/optimization passes rely on the merged
geps to get better result, and we havn't notice them yet. We will be ready
to further improve it once we see the cases.

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

llvm-svn: 235455

9 years agoSame issue as in D8685 but for i386.
Chaoren Lin [Tue, 21 Apr 2015 23:00:58 +0000 (23:00 +0000)]
Same issue as in D8685 but for i386.

llvm-svn: 235454

9 years agoRevert r235451 since it is attached to a wrong Differential Revision. Sorry.
Wei Mi [Tue, 21 Apr 2015 22:56:09 +0000 (22:56 +0000)]
Revert r235451 since it is attached to a wrong Differential Revision. Sorry.

llvm-svn: 235453

9 years ago[cuda] Allow using integral non-type template parameters as launch_bounds attribute...
Artem Belevich [Tue, 21 Apr 2015 22:55:54 +0000 (22:55 +0000)]
[cuda] Allow using integral non-type template parameters as launch_bounds attribute arguments.

 - Changed CUDALaunchBounds arguments from integers to Expr* so they can
   be saved in AST for instantiation.
 - Added support for template instantiation of launch_bounds attrubute.
 - Moved evaluation of launch_bounds arguments to NVPTXTargetCodeGenInfo::
   SetTargetAttributes() where it can be done after template instantiation.
 - Added a warning on negative launch_bounds arguments.
 - Amended test cases.

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

llvm-svn: 235452

9 years agoLimiting gep merging to fix the performance problem described in
Wei Mi [Tue, 21 Apr 2015 22:37:09 +0000 (22:37 +0000)]
Limiting gep merging to fix the performance problem described in
https://llvm.org/bugs/show_bug.cgi?id=23163.

Gep merging sometimes behaves like a reverse CSE/LICM optimizations,
which has negative impact on performance. In this patch we restrict
gep merging to happen only when the indexes to be merged are both consts,
which ensures such merge is always beneficial.

The patch makes gep merging only happen in very restrictive cases.
It is possible that some analysis/optimization passes rely on the merged
geps to get better result, and we havn't notice them yet. We will be ready
to further improve it once we see the cases.

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

llvm-svn: 235451

9 years agoSilence MSVC build alignment warnings
Andrew Kaylor [Tue, 21 Apr 2015 22:29:38 +0000 (22:29 +0000)]
Silence MSVC build alignment warnings

llvm-svn: 235450

9 years ago[cuda] Added support for CUDA built-in variables.
Artem Belevich [Tue, 21 Apr 2015 22:14:13 +0000 (22:14 +0000)]
[cuda] Added support for CUDA built-in variables.

Added cuda_builtin_vars.h which implements built-in CUDA variables
using __declattr(property).

Fields of built-in variables (except for warpSize) are implemented
using __declattr(property) which replaces read/write of a member field
with a call to a getter/setter member function, in this case with
appropriate NVPTX builtin.

Added a test case to check diagnostics on attempt to construct or
improperly access a built-in variable.

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

llvm-svn: 235448

9 years agoAdd properties to SBExecutionContext to access the several entities it stores in...
Enrico Granata [Tue, 21 Apr 2015 22:09:12 +0000 (22:09 +0000)]
Add properties to SBExecutionContext to access the several entities it stores in a more Pythonic fashion

llvm-svn: 235447

9 years ago[modules] Move list of exported module macros from IdentifierInfo lookup table to...
Richard Smith [Tue, 21 Apr 2015 21:46:32 +0000 (21:46 +0000)]
[modules] Move list of exported module macros from IdentifierInfo lookup table to separate storage, adjacent to the macro directive history.

This is substantially simpler, provides better space usage accounting in bcanalyzer,
and gives a more compact representation. No functionality change intended.

llvm-svn: 235420

9 years ago[MemCpyOpt] Use the raw i8* dest when optimizing memset+memcpy.
Ahmed Bougacha [Tue, 21 Apr 2015 21:28:33 +0000 (21:28 +0000)]
[MemCpyOpt] Use the raw i8* dest when optimizing memset+memcpy.

MemIntrinsic::getDest() looks through pointer casts, and using it
directly when building the new GEP+memset results in stuff like:

  %0 = getelementptr i64* %p, i32 16
  %1 = bitcast i64* %0 to i8*
  call ..memset(i8* %1, ...)

instead of the correct:

  %0 = bitcast i64* %p to i8*
  %1 = getelementptr i8* %0, i32 16
  call ..memset(i8* %1, ...)

Instead, use getRawDest, which just gives you the i8* value.
While there, use the memcpy's dest, as it's live anyway.

In most cases, when the optimization triggers, the memset and memcpy
sizes are the same, so the built memset is 0-sized and eliminated.
The problem occurs when they're different.

Fixes a regression caused by r235232: PR23300.

llvm-svn: 235419

9 years ago[Hexagon] Patterns for frame index with offset for isel
Krzysztof Parzyszek [Tue, 21 Apr 2015 21:28:03 +0000 (21:28 +0000)]
[Hexagon] Patterns for frame index with offset for isel

llvm-svn: 235418

9 years agoUpdate comment. NFC.
Lang Hames [Tue, 21 Apr 2015 21:15:35 +0000 (21:15 +0000)]
Update comment. NFC.

llvm-svn: 235417

9 years agoRevamp PredIteratorCache interface to be cleaner.
Daniel Berlin [Tue, 21 Apr 2015 21:11:50 +0000 (21:11 +0000)]
Revamp PredIteratorCache interface to be cleaner.

Summary:
This lets us use range based for loops.

Reviewers: chandlerc

Subscribers: llvm-commits

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

llvm-svn: 235416

9 years ago[NVPTX] do not run DCE after SLSR and SeparateConstOffsetFromGEP
Jingyue Wu [Tue, 21 Apr 2015 20:47:15 +0000 (20:47 +0000)]
[NVPTX] do not run DCE after SLSR and SeparateConstOffsetFromGEP

Summary:
With D9096 and D9101, there's no need to run DCE after SLSR and
SeparateConstOffsetFromGEP.

Test Plan: no regression

Reviewers: jholewinski, meheff

Subscribers: jholewinski, llvm-commits

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

llvm-svn: 235415

9 years ago[LSR][NFC] Remove a stale comment.
Sanjoy Das [Tue, 21 Apr 2015 20:42:50 +0000 (20:42 +0000)]
[LSR][NFC] Remove a stale comment.

The comment was made stale in r171735.

llvm-svn: 235414

9 years agoDebugInfo: Remove DIArray and DITypeArray typedefs
Duncan P. N. Exon Smith [Tue, 21 Apr 2015 20:07:38 +0000 (20:07 +0000)]
DebugInfo: Remove DIArray and DITypeArray typedefs

Remove the `DIArray` and `DITypeArray` typedefs, preferring the
underlying types (`DebugNodeArray` and `MDTypeRefArray`, respectively).

llvm-svn: 235413

9 years agoDebugInfo: Prepare for removal of DIArray and DITypeArray typedefs
Duncan P. N. Exon Smith [Tue, 21 Apr 2015 20:07:29 +0000 (20:07 +0000)]
DebugInfo: Prepare for removal of DIArray and DITypeArray typedefs

An upcoming LLVM commit will remove the `DIArray` and `DITypeArray`
typedefs that shadow `DebugNodeArray` and `MDTypeRefArray`,
respectively.  Use those types directly.

llvm-svn: 235412

9 years ago[sanitizer] Plug a memory leak in symbolization code.
Sergey Matveev [Tue, 21 Apr 2015 20:05:10 +0000 (20:05 +0000)]
[sanitizer] Plug a memory leak in symbolization code.

llvm-svn: 235411

9 years ago[SLSR] garbage-collect unused instructions
Jingyue Wu [Tue, 21 Apr 2015 19:56:18 +0000 (19:56 +0000)]
[SLSR] garbage-collect unused instructions

Summary:
After we rewrite a candidate, the instructions used by the old form may
become unused. This patch cleans up these unused instructions so that we
needn't run DCE after SLSR.

Test Plan: removed -dce in all the SLSR tests

Reviewers: broune, meheff

Subscribers: llvm-commits

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

llvm-svn: 235410

9 years ago[SeparateConstOffsetFromGEP] garbage-collect intermediate instructions
Jingyue Wu [Tue, 21 Apr 2015 19:53:18 +0000 (19:53 +0000)]
[SeparateConstOffsetFromGEP] garbage-collect intermediate instructions

Summary: so that we needn't run DCE after this pass.

Test Plan: removed -dce from the commandline in split-gep.ll and split-gep-and-gvn.ll

Reviewers: meheff

Subscribers: llvm-commits, HaoLiu, hfinkel, jholewinski

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

llvm-svn: 235409

9 years agoRemove FilesToRemove->push_back(Filename) from sys::DontRemoveFileOnSignal.
Yaron Keren [Tue, 21 Apr 2015 19:25:11 +0000 (19:25 +0000)]
Remove FilesToRemove->push_back(Filename) from sys::DontRemoveFileOnSignal.

llvm-svn: 235408

9 years agoDebugInfo: Use MDType in DITypeIdentifierMap
Duncan P. N. Exon Smith [Tue, 21 Apr 2015 19:17:20 +0000 (19:17 +0000)]
DebugInfo: Use MDType in DITypeIdentifierMap

Use `MDType*` instead of `MDNode*` in `DITypeIdentifierMap`, since all
the members should be types.

llvm-svn: 235407

9 years agoMove IDF Calculation to a separate file, expose an interface to it.
Daniel Berlin [Tue, 21 Apr 2015 19:13:02 +0000 (19:13 +0000)]
Move IDF Calculation to a separate file, expose an interface to it.

Summary:
MemorySSA uses this algorithm as well, and this enables us to reuse the code in both places.

There are no actual algorithm or datastructure changes in here, just code movement.

Reviewers: qcolombet, chandlerc

Subscribers: llvm-commits

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

llvm-svn: 235406

9 years agoDebugInfo: Prune unnecessary forward declarations
Duncan P. N. Exon Smith [Tue, 21 Apr 2015 19:00:26 +0000 (19:00 +0000)]
DebugInfo: Prune unnecessary forward declarations

Probably these forward declarations were once useful, but they certainly
don't belong here now.

llvm-svn: 235405

9 years agoDebugInfo: Drop rest of DIDescriptor subclasses
Duncan P. N. Exon Smith [Tue, 21 Apr 2015 18:44:06 +0000 (18:44 +0000)]
DebugInfo: Drop rest of DIDescriptor subclasses

Delete the remaining subclasses of (the already deleted) `DIDescriptor`.
Part of PR23080.

llvm-svn: 235404

9 years agoDebugInfo: Prepare for deletion of DIDescriptor subclasses
Duncan P. N. Exon Smith [Tue, 21 Apr 2015 18:43:54 +0000 (18:43 +0000)]
DebugInfo: Prepare for deletion of DIDescriptor subclasses

An upcoming LLVM commit will delete all the remaining subclasses of (the
already deleted) `DIDescriptor`.  Stop using them.

llvm-svn: 235403

9 years agoRecommend to use CMake on the Clang Getting Started page.
Alexey Samsonov [Tue, 21 Apr 2015 18:38:31 +0000 (18:38 +0000)]
Recommend to use CMake on the Clang Getting Started page.

llvm-svn: 235402

9 years agoRevert r235398 "[cuda] Added support for CUDA built-in variables."
Artem Belevich [Tue, 21 Apr 2015 18:36:42 +0000 (18:36 +0000)]
Revert r235398 "[cuda] Added support for CUDA built-in variables."

r235398 was causing buildbot break due to missing Makefile changes.

llvm-svn: 235401

9 years agoDebugInfo: Assert dbg.declare/value insts are valid
Duncan P. N. Exon Smith [Tue, 21 Apr 2015 18:24:23 +0000 (18:24 +0000)]
DebugInfo: Assert dbg.declare/value insts are valid

Remove early returns for when `getVariable()` is null, and just assert
that it never happens.  The Verifier already confirms that there's a
valid variable on these intrinsics, so we should assume the debug info
isn't broken.  I also updated a check for a `!dbg` attachment, which the
Verifier similarly guarantees.

llvm-svn: 235400

9 years agoRe-land r235154-r235156 under the existing -sehprepare flag
Reid Kleckner [Tue, 21 Apr 2015 18:23:57 +0000 (18:23 +0000)]
Re-land r235154-r235156 under the existing -sehprepare flag

Keep the old SEH fan-in lowering on by default for now, since projects
rely on it.  This will make it easy to test this change with a simple
flag flip.

llvm-svn: 235399

9 years ago[cuda] Added support for CUDA built-in variables.
Artem Belevich [Tue, 21 Apr 2015 17:39:06 +0000 (17:39 +0000)]
[cuda] Added support for CUDA built-in variables.

Added cuda_builtin_vars.h which implements built-in CUDA variables
using __declattr(property).

Fields of built-in variables (except for warpSize) are implemented
using __declattr(property) which replaces read/write of a member field
with a call to a getter/setter member function, in this case with
appropriate NVPTX builtin.

Added a test case to check diagnostics on attempt to construct or
improperly access a built-in variable.

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

llvm-svn: 235398

9 years agoImplement target-specific __attribute__((aligned)) value
Ulrich Weigand [Tue, 21 Apr 2015 17:29:35 +0000 (17:29 +0000)]
Implement target-specific __attribute__((aligned)) value

The GCC construct __attribute__((aligned)) is defined to set alignment
to "the default alignment for the target architecture" according to
the GCC documentation:

  The default alignment is sufficient for all scalar types, but may not be
  enough for all vector types on a target that supports vector operations.
  The default alignment is fixed for a particular target ABI.

clang currently hard-coded an alignment of 16 bytes for that construct,
which is correct on some platforms (including X86), but wrong on others
(including SystemZ).  Since this value is ABI-relevant, it is important
to get correct for compatibility purposes.

This patch adds a new TargetInfo member "DefaultAlignForAttributeAligned"
that targets can set to the appropriate default __attribute__((aligned))
value.

Note that I'm deliberately *not* using the existing "SuitableAlign"
value, which is used to set the pre-defined macro __BIGGEST_ALIGNMENT__,
since those two values may not be the same on all platforms.  In fact,
on X86, __attribute__((aligned)) always uses 16-byte alignment, while
__BIGGEST_ALIGNMENT__ may be larger if AVX-2 or AVX-512 are supported.
(This is actually not yet correctly implemented in clang either.)

The patch provides a value for DefaultAlignForAttributeAligned only for
SystemZ, and leaves the default for all other targets at 16, which means
no visible change in behavior on all other targets.  (The value is still
wrong for some other targets, but I'd prefer to leave it to the target
maintainers for those platforms to fix.)

llvm-svn: 235397

9 years agoProvide alignment info on LLVM external symbols
Ulrich Weigand [Tue, 21 Apr 2015 17:27:59 +0000 (17:27 +0000)]
Provide alignment info on LLVM external symbols

Code in CodeGenModule::GetOrCreateLLVMGlobal that sets up GlobalValue
object for LLVM external symbols has this comment:

    // FIXME: This code is overly simple and should be merged with other global
    // handling.

One part does seems to be "overly simple" currently is that this code
never sets any alignment info on the GlobalValue, so that the emitted
IR does not have any align attribute on external globals.  This can
lead to unnecessarily inefficient code generation.

This patch adds a GV->setAlignment call to set alignment info.

llvm-svn: 235396

9 years agoFix __alignof__ of global variables on SystemZ
Ulrich Weigand [Tue, 21 Apr 2015 17:26:18 +0000 (17:26 +0000)]
Fix __alignof__ of global variables on SystemZ

SystemZ prefers to align all global variables to two bytes, which is
implemented by setting the TargetInfo member MinGlobalAlign.

However, for compatibility with existing compilers this should *not*
change the ABI alignment value as retrieved via __alignof__, which
it currently does.

This patch fixes the issue by having ASTContext::getDeclAlign ignore
the MinGlobalAlign setting in the ForAlignof case.

Since SystemZ is the only platform setting MinGlobalAlign, this should
cause no change for any other target.

llvm-svn: 235395

9 years agoX86: Match for X86ISD nodes in LowerBUILD_VECTOR instead of BUILD_VECTORCombine
Matthias Braun [Tue, 21 Apr 2015 17:21:36 +0000 (17:21 +0000)]
X86: Match for X86ISD nodes in LowerBUILD_VECTOR instead of BUILD_VECTORCombine

There doesn't seem to be a reason to perform this target ISD node matching
in an DAGCombine, moving it to lowering fixes PR23296.

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

llvm-svn: 235394

9 years ago[ELF] Change return type of the OutputSection::flags() method
Simon Atanasyan [Tue, 21 Apr 2015 17:02:49 +0000 (17:02 +0000)]
[ELF] Change return type of the OutputSection::flags() method

This method returns _flags field which has `uint64_t` type. Now the
field's type and the method's return type are consistent.

llvm-svn: 235393

9 years ago[ELF] Narrow down the type of OutputSection::_sections container
Simon Atanasyan [Tue, 21 Apr 2015 17:02:42 +0000 (17:02 +0000)]
[ELF] Narrow down the type of OutputSection::_sections container

The `OutputSection::appendSection()` method always gets a pointer
to the `Section` class descendants. So it is not necessary to keep them
in the vector of `Chunk` pointers.

No functional changes.

llvm-svn: 235392

9 years ago[Mips] Write .reginfo section into the separate PT_MIPS_REGINFO segment
Simon Atanasyan [Tue, 21 Apr 2015 17:02:35 +0000 (17:02 +0000)]
[Mips] Write .reginfo section into the separate PT_MIPS_REGINFO segment

llvm-svn: 235391

9 years ago[ELF] Simplify class memeber function declaration
Simon Atanasyan [Tue, 21 Apr 2015 17:02:27 +0000 (17:02 +0000)]
[ELF] Simplify class memeber function declaration

No functional changes.

llvm-svn: 235390

9 years agoMinor edits to the llvm-cov documentation.
Bob Wilson [Tue, 21 Apr 2015 16:32:02 +0000 (16:32 +0000)]
Minor edits to the llvm-cov documentation.

This just changes a few places to use a slightly more formal style.

llvm-svn: 235389

9 years agoPlacate clang. lldb can build on FreeBSD with -Werror again.
Davide Italiano [Tue, 21 Apr 2015 16:06:17 +0000 (16:06 +0000)]
Placate clang. lldb can build on FreeBSD with -Werror again.

llvm-svn: 235387

9 years agos/NULL/nullptr/ in OrcTestCommon.h to silence -Wsentinel in clang-cl
Reid Kleckner [Tue, 21 Apr 2015 15:56:21 +0000 (15:56 +0000)]
s/NULL/nullptr/ in OrcTestCommon.h to silence -Wsentinel in clang-cl

llvm-svn: 235386

9 years agoAVX-512: Added VPMOVx2M instructions for SKX,
Elena Demikhovsky [Tue, 21 Apr 2015 14:38:31 +0000 (14:38 +0000)]
AVX-512: Added VPMOVx2M instructions for SKX,
fixed encoding of VPMOVM2x.

llvm-svn: 235385

9 years agoRemove target triples from test cases
Tobias Grosser [Tue, 21 Apr 2015 14:28:02 +0000 (14:28 +0000)]
Remove target triples from test cases

I just learned that target triples prevent test cases to be run on other
architectures. Polly test cases are until now sufficiently target independent
to not require any target triples. Hence, we drop them.

llvm-svn: 235384

9 years agoAVX-512: Added VPTESTM and VPTESTNM instructions for SKX
Elena Demikhovsky [Tue, 21 Apr 2015 13:13:46 +0000 (13:13 +0000)]
AVX-512: Added VPTESTM and VPTESTNM instructions for SKX

llvm-svn: 235383

9 years ago[mips] [IAS] Implement the .asciiz directive.
Toma Tabacu [Tue, 21 Apr 2015 11:50:52 +0000 (11:50 +0000)]
[mips] [IAS] Implement the .asciiz directive.

Summary:
This directive is exactly the same as .asciz, except it's only used by MIPS.
It is used to store null terminated strings in object files.

Reviewers: rafael, dsanders, echristo

Reviewed By: dsanders, echristo

Subscribers: echristo, llvm-commits

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

llvm-svn: 235382

9 years agoFix some formatting issues
Tobias Grosser [Tue, 21 Apr 2015 11:42:01 +0000 (11:42 +0000)]
Fix some formatting issues

llvm-svn: 235381

9 years agoRename 'scattering' to 'schedule'
Tobias Grosser [Tue, 21 Apr 2015 11:37:25 +0000 (11:37 +0000)]
Rename 'scattering' to 'schedule'

In Polly we used both the term 'scattering' and the term 'schedule' to describe
the execution order of a statement without actually distinguishing between them.
We now uniformly use the term 'schedule' for the execution order.  This
corresponds to the terminology of isl.

History: CLooG introduced the term scattering as the generated code can be used
as a sequential execution order (schedule) or as a parallel dimension
enumerating different threads of execution (placement). In Polly and/or isl the
term placement was never used, but we uniformly refer to an execution order as a
schedule and only later introduce parallelism. When doing so we do not talk
about about specific placement dimensions.

llvm-svn: 235380

9 years ago[mips][microMIPSr6] Implement CACHE and PREF instructions
Jozef Kolek [Tue, 21 Apr 2015 11:17:25 +0000 (11:17 +0000)]
[mips][microMIPSr6] Implement CACHE and PREF instructions

Implement CACHE and PREF instructions using mapping.

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

llvm-svn: 235379

9 years agoPass an actual schedule to the isl_union_access [NFC]
Tobias Grosser [Tue, 21 Apr 2015 11:01:34 +0000 (11:01 +0000)]
Pass an actual schedule to the isl_union_access [NFC]

This change is a step towards using a single isl_schedule object throughout
Polly. At the moment the schedule is just constructed from the flat
isl_union_map that defines the schedule. Later we will obtain it directly
from the scop and potentially obtain a schedule with a non-trivial internal
structure that will allow faster dependence analysis.

llvm-svn: 235378

9 years ago[mips] Cleanup old floating-point flag conditions definitions. NFC.
Vasileios Kalintiris [Tue, 21 Apr 2015 10:53:57 +0000 (10:53 +0000)]
[mips] Cleanup old floating-point flag conditions definitions. NFC.

Reviewers: dsanders

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

llvm-svn: 235377

9 years ago[mips] Optimize code generation for 64-bit variable shift instructions.
Vasileios Kalintiris [Tue, 21 Apr 2015 10:49:03 +0000 (10:49 +0000)]
[mips] Optimize code generation for 64-bit variable shift instructions.

Summary:
The 64-bit version of the variable shift instructions uses the
shift_rotate_reg class which uses a GPR32Opnd to specify the variable
shift amount. With this patch we avoid the generation of a redundant
SLL instruction for the variable shift instructions in 64-bit targets.

Reviewers: dsanders

Subscribers: llvm-commits

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

llvm-svn: 235376

9 years agoAVX-512: Added logical and arithmetic instructions for SKX
Elena Demikhovsky [Tue, 21 Apr 2015 10:27:40 +0000 (10:27 +0000)]
AVX-512: Added logical and arithmetic instructions for SKX
by Asaf Badouh (asaf.badouh@intel.com)

llvm-svn: 235375

9 years agoDrop unneccessary -basicaa passes in DependenceInfo test cases
Tobias Grosser [Tue, 21 Apr 2015 09:17:52 +0000 (09:17 +0000)]
Drop unneccessary -basicaa passes in DependenceInfo test cases

llvm-svn: 235374

9 years agoMove to isl's new dependence analysis interface [NFC]
Tobias Grosser [Tue, 21 Apr 2015 08:47:29 +0000 (08:47 +0000)]
Move to isl's new dependence analysis interface [NFC]

isl_union_map_compute_flow() has been replaced by
isl_union_access_info_compute_flow(). This change does not intend to
change funcitonality, yet. However, it will allow us to pass in subsequent
changes schedule trees to the dependence analysis instead of flat schedules.
This should speed up dependence analysis for important cases significantly.

llvm-svn: 235373

9 years ago[X86][SSE] Provide execution domains for scalar floating point operations
Simon Pilgrim [Tue, 21 Apr 2015 08:40:22 +0000 (08:40 +0000)]
[X86][SSE] Provide execution domains for scalar floating point operations

This is an updated version of Chandler's patch D7402 that got accepted but never committed, and has bit-rotted a bit since.

I've updated the execution domain declarations to match the approach of the packed templates and also added some extra scalar unary tests.

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

llvm-svn: 235372