platform/upstream/llvm.git
9 years agoAnother test to exercise APInt divide step D6.
Yaron Keren [Wed, 22 Apr 2015 18:49:59 +0000 (18:49 +0000)]
Another test to exercise APInt divide step D6.

This is divrem_big7 since divrem_big6 is used in Pawel upcoming patch.

llvm-svn: 235536

9 years ago[Hexagon] Use A2_tfrsi for constant pool and jump table addresses
Krzysztof Parzyszek [Wed, 22 Apr 2015 18:25:53 +0000 (18:25 +0000)]
[Hexagon] Use A2_tfrsi for constant pool and jump table addresses

llvm-svn: 235535

9 years agoRevert "[opaque pointer type] Avoid using PointerType::getElementType for a few cases...
David Blaikie [Wed, 22 Apr 2015 18:16:49 +0000 (18:16 +0000)]
Revert "[opaque pointer type] Avoid using PointerType::getElementType for a few cases of CallInst"

This reverts commit r235458.

It looks like this might be breaking something LTO-ish. Looking into it
& will recommit with a fix/test case/etc once I've got more to go on.

llvm-svn: 235533

9 years ago[AArch64] Use MachineRegisterInfo instead of LiveIntervals to calculate liveness...
Pete Cooper [Wed, 22 Apr 2015 18:05:13 +0000 (18:05 +0000)]
[AArch64] Use MachineRegisterInfo instead of LiveIntervals to calculate liveness.  NFC.

The CondOpt pass currently uses LiveIntervals to set the dead flag on a def.  This patch uses MachineRegisterInfo::use_empty instead as that is equivalent to the def being dead.

This removes an instance of LiveIntervals in the pass manager pipeline and saves 3.8% of compile time on llc conpiled for AArch64.

Reviewed by Chad Rosier and Zhaoshi.

llvm-svn: 235532

9 years agodon't repeat function names in comments; NFC
Sanjay Patel [Wed, 22 Apr 2015 18:04:46 +0000 (18:04 +0000)]
don't repeat function names in comments; NFC

llvm-svn: 235531

9 years agoFix correctness check for test_vec_fpextend_double
Pirama Arumuga Nainar [Wed, 22 Apr 2015 18:04:12 +0000 (18:04 +0000)]
Fix correctness check for test_vec_fpextend_double

Summary:
Remove the CHECK-DAG calls introduced in r235341, and add a comment that
this test may break due to scheduling variations.

This patch completes the fix discussed in http://reviews.llvm.org/D8804

Reviewers: dsanders, srhines

Subscribers: llvm-commits

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

llvm-svn: 235530

9 years ago[Hexagon] Consider constant-extended offsets to be valid
Krzysztof Parzyszek [Wed, 22 Apr 2015 17:51:26 +0000 (17:51 +0000)]
[Hexagon] Consider constant-extended offsets to be valid

llvm-svn: 235529

9 years agoChange MachineOperand::OpKind from unsigned char to a bitfield. NFC.
Pete Cooper [Wed, 22 Apr 2015 17:48:26 +0000 (17:48 +0000)]
Change MachineOperand::OpKind from unsigned char to a bitfield.  NFC.

This causes OpKind and all the bitfields after it to use 32-bit load/stores instead of i24's for the existing bitfields.

Bugs will be filed to track whether clang and llvm could have generated the 32-bit operations in the front-end or optimizer.

Reviewed by Rafael.

llvm-svn: 235528

9 years agoFormatting fix.
Jim Ingham [Wed, 22 Apr 2015 17:48:24 +0000 (17:48 +0000)]
Formatting fix.

llvm-svn: 235527

9 years agoTest commit: fix typo in comment.
Luqman Aden [Wed, 22 Apr 2015 17:42:37 +0000 (17:42 +0000)]
Test commit: fix typo in comment.

llvm-svn: 235526

9 years agoFix Windows build break: use LLVM_FUNCTION_NAME instead of __func__.
Krzysztof Parzyszek [Wed, 22 Apr 2015 17:19:44 +0000 (17:19 +0000)]
Fix Windows build break: use LLVM_FUNCTION_NAME instead of __func__.

llvm-svn: 235525

9 years agoR600: Fix always inline pass breaking noinline functions
Matt Arsenault [Wed, 22 Apr 2015 17:10:44 +0000 (17:10 +0000)]
R600: Fix always inline pass breaking noinline functions

No test since calls are not actually supported yet.

llvm-svn: 235524

9 years agoAdd decorator for signal test failing on FreeBSD
Ed Maste [Wed, 22 Apr 2015 17:06:48 +0000 (17:06 +0000)]
Add decorator for signal test failing on FreeBSD

llvm.org/pr23318

llvm-svn: 235523

9 years agoRecommit r235219, it's need for out-of-tree users of AlignOf.h.
Yaron Keren [Wed, 22 Apr 2015 16:43:56 +0000 (16:43 +0000)]
Recommit r235219, it's need for out-of-tree users of AlignOf.h.

llvm-svn: 235522

9 years ago[Hexagon] Overhaul of stack object allocation
Krzysztof Parzyszek [Wed, 22 Apr 2015 16:43:53 +0000 (16:43 +0000)]
[Hexagon] Overhaul of stack object allocation

- Use static allocation for aligned stack objects.
- Simplify dynamic stack object allocation.
- Simplify elimination of frame-indices.

llvm-svn: 235521

9 years ago[opaque pointer type] Use pointee type retrieved from asm, rather than accessing...
David Blaikie [Wed, 22 Apr 2015 16:37:35 +0000 (16:37 +0000)]
[opaque pointer type] Use pointee type retrieved from asm, rather than accessing it via the pointer type

llvm-svn: 235520

9 years ago[cmake] Quote the path to the target exports file, fixes PR23313
Reid Kleckner [Wed, 22 Apr 2015 16:23:00 +0000 (16:23 +0000)]
[cmake] Quote the path to the target exports file, fixes PR23313

llvm-svn: 235519

9 years ago[ubsan] Stop cast-overflow.cpp test leaking undefined behaviour into the exit code.
Daniel Sanders [Wed, 22 Apr 2015 16:14:01 +0000 (16:14 +0000)]
[ubsan] Stop cast-overflow.cpp test leaking undefined behaviour into the exit code.

Summary:
ubsan was correctly catching the undefined behaviour but lit's shell was
failing the test anyway because the exit code was non-zero as a result of the
undefined behaviour.

This fixes the test on a mips-linux-gnu target.

Reviewers: samsonov

Reviewed By: samsonov

Subscribers: samsonov, llvm-commits, rsmith, sagar

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

llvm-svn: 235518

9 years ago[x86] Add store-folded memop patterns for vcvtps2ph
Sanjay Patel [Wed, 22 Apr 2015 16:11:19 +0000 (16:11 +0000)]
[x86] Add store-folded memop patterns for vcvtps2ph

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

llvm-svn: 235517

9 years ago[Hexagon] Treat CFI as solo instructions
Krzysztof Parzyszek [Wed, 22 Apr 2015 15:47:35 +0000 (15:47 +0000)]
[Hexagon] Treat CFI as solo instructions

llvm-svn: 235516

9 years agoMI Refactor CMIUtilSystemWindows::GetExecutablesPath()
Ilia K [Wed, 22 Apr 2015 15:43:43 +0000 (15:43 +0000)]
MI Refactor CMIUtilSystemWindows::GetExecutablesPath()

Summary:
My understanding of the Windows API call GetLastError() is that it should only be checked when ::GetModuleFileName()  returns 0 on error.
Otherwise GetExecutablesPath() could return an error despite nLen being valid if GetLastError() was inconsistent.
Patch updates function to only call GetOSLastError() when nLen == 0

Patch from ewan@codeplay.com

Reviewers: EwanCrawford

Subscribers: lldb-commits, deepak2427

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

llvm-svn: 235515

9 years ago[Hexagon] Implement HexagonInstPrinter::printRegName
Krzysztof Parzyszek [Wed, 22 Apr 2015 15:38:17 +0000 (15:38 +0000)]
[Hexagon] Implement HexagonInstPrinter::printRegName

llvm-svn: 235514

9 years agoSupport arm32 R_ARM_V4BX relocation format
Adhemerval Zanella [Wed, 22 Apr 2015 15:26:43 +0000 (15:26 +0000)]
Support arm32 R_ARM_V4BX relocation format

ARM32 ELF R_ARM_V4BX relocation format is a special relocation type
that records the location of an ARMv4t BX instruction to enable a
static linker to generate ARMv4 compatible instructions.  This
relocation does not contain a reference symbol.

This patch enabled its creation by removing the requeriment of a
relocation symbol target in ELFState<ELFT>::writeSectionContent.

llvm-svn: 235513

9 years agoSilencing a -Wunused-variable warning; NFC.
Aaron Ballman [Wed, 22 Apr 2015 15:25:05 +0000 (15:25 +0000)]
Silencing a -Wunused-variable warning; NFC.

llvm-svn: 235512

9 years agoFix a type mismatch assert in SCEV division
Brendon Cahoon [Wed, 22 Apr 2015 15:06:40 +0000 (15:06 +0000)]
Fix a type mismatch assert in SCEV division

An assert was triggered when attempting to create a new SCEV
with operands of different types in the visitAddRecExpr. In this
test case, the operand types of the numerator and denominator
are different. The SCEV division code should generate a
conservative answer when this happens.

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

llvm-svn: 235511

9 years agoSkip additional lldb-mi tests that failed on FreeBSD
Ed Maste [Wed, 22 Apr 2015 14:55:34 +0000 (14:55 +0000)]
Skip additional lldb-mi tests that failed on FreeBSD

llvm-svn: 235510

9 years ago[X86][AVX] Fix failure due to a missing ISel pattern to select VBROADCAST nodes ...
Andrea Di Biagio [Wed, 22 Apr 2015 14:53:39 +0000 (14:53 +0000)]
[X86][AVX] Fix failure due to a missing ISel pattern to select VBROADCAST nodes (PR23259).

This fixes a regression introduced at revision 218263.

On AVX, if we optimize for size, a splat build_vector of a load
is lowered into a VBROADCAST node. This is done even if the value type of the
splat build_vector node is v2i64.

Since AVX doesn't support v2f64/v2i64 broadcasts, revision 218263 added two
extra tablegen patterns to allow selecting a VMOVDDUPrm from an X86VBroadcast
where the scalar element comes from a loadi64/loadf64.

However, revision 218263 forgot to add an extra fallback pattern for the case
where we have a X86VBroadcast of a loadi64 with multiple uses.

This patch adds the missing tablegen pattern in X86InstrSSE.td.
This patch also adds an extra test to 'splat-for-size.ll' to verify that ISel
doesn't crash with a 'fatal error in the backend' due to a missing AVX pattern
to select v2i64 X86ISD::BROADCAST nodes.

llvm-svn: 235509

9 years agoFixed logic to enable complex FMA formation.
Olivier Sallenave [Wed, 22 Apr 2015 14:07:26 +0000 (14:07 +0000)]
Fixed logic to enable complex FMA formation.

llvm-svn: 235508

9 years ago[OPENMP] Codegen for 'if' clause in 'task' directive.
Alexey Bataev [Wed, 22 Apr 2015 13:57:31 +0000 (13:57 +0000)]
[OPENMP] Codegen for 'if' clause in 'task' directive.

If condition evaluates to true, the code executes task by calling @__kmpc_omp_task() runtime function.
If condition evaluates to false, the code executes serial version of the code by executing the following code:

call void @__kmpc_omp_task_begin_if0(<loc>, <threadid>, <task_t_ptr, returned by @__kmpc_omp_task_alloc()>);
proxy_task_entry(<gtid>, <task_t_ptr, returned by @__kmpc_omp_task_alloc()>);
call void @__kmpc_omp_task_complete_if0(<loc>, <threadid>, <task_t_ptr, returned by @__kmpc_omp_task_alloc()>);
Also it checks if the condition is constant and if it is constant it evaluates its value and then generates either parallel version of the code (if the condition evaluates to true), or the serial version of the code (if the condition evaluates to false).
Differential Revision: http://reviews.llvm.org/D9143

llvm-svn: 235507

9 years ago[OPENMP] Codegen for 'reduction' clause in 'for' directive.
Alexey Bataev [Wed, 22 Apr 2015 13:43:03 +0000 (13:43 +0000)]
[OPENMP] Codegen for 'reduction' clause in 'for' directive.

Emit a code for reduction clause. Next code should be emitted for reductions:

static kmp_critical_name lock = { 0 };

void reduce_func(void *lhs[<n>], void *rhs[<n>]) {
    *(Type0*)lhs[0] = ReductionOperation0(*(Type0*)lhs[0], *(Type0*)rhs[0]);
      ...
        *(Type<n>-1*)lhs[<n>-1] =
          ReductionOperation<n>-1(*(Type<n>-1*)lhs[<n>-1],
            *(Type<n>-1*)rhs[<n>-1]);
}

 ...
  void *RedList[<n>] = {&<RHSExprs>[0], ..., &<RHSExprs>[<n>-1]};
   switch (__kmpc_reduce{_nowait}(<loc>, <gtid>, <n>, sizeof(RedList), RedList, reduce_func, &<lock>)) {
      case 1:
        <LHSExprs>[0] = ReductionOperation0(*<LHSExprs>[0], *<RHSExprs>[0]);
          ...
            <LHSExprs>[<n>-1] = ReductionOperation<n>-1(*<LHSExprs>[<n>-1], *<RHSExprs>[<n>-1]);
             __kmpc_end_reduce{_nowait}(<loc>, <gtid>, &<lock>);
              break;
               case 2:
                 Atomic(<LHSExprs>[0] = ReductionOperation0(*<LHSExprs>[0], *<RHSExprs>[0]));
                   ...
                     Atomic(<LHSExprs>[<n>-1] = ReductionOperation<n>-1(*<LHSExprs>[<n>-1], *<RHSExprs>[<n>-1]));
                      break;
                       default:;
                        }
                        Reduction variables are a kind of a private variables, they have private copies, but initial values are chosen in accordance with the reduction operation.
Differential Revision: http://reviews.llvm.org/D9139

llvm-svn: 235506

9 years ago[mips][microMIPSr6] Implement mips32 to microMIPSr6 mapping support
Zoran Jovanovic [Wed, 22 Apr 2015 13:27:34 +0000 (13:27 +0000)]
[mips][microMIPSr6] Implement mips32 to microMIPSr6 mapping support
Differential Revision: http://reviews.llvm.org/D8661

llvm-svn: 235505

9 years agoXFAILing a single test in TestConcurrentEvents
Pavel Labath [Wed, 22 Apr 2015 13:20:03 +0000 (13:20 +0000)]
XFAILing a single test in TestConcurrentEvents

apparently, TestConcurrentEvents is still not fixed. One test has failed on Linux i386 build.
Will disable the failing test on i386 for now, and see how it goes..

llvm-svn: 235504

9 years ago[OPENMP] Codegen for 'private' clause in 'for' directive.
Alexey Bataev [Wed, 22 Apr 2015 12:24:45 +0000 (12:24 +0000)]
[OPENMP] Codegen for 'private' clause in 'for' directive.

This patch generates helper variables which used as a private copies of the corresponding original variables inside an OpenMP 'for' directive. These generated variables are initialized by default (with the default constructor, if any). In OpenMP region references to original variables are replaced by the references to these private helper variables.
Differential Revision: http://reviews.llvm.org/D9106

llvm-svn: 235503

9 years agoEnable TestConcurrentEvents on Linux
Pavel Labath [Wed, 22 Apr 2015 12:21:06 +0000 (12:21 +0000)]
Enable TestConcurrentEvents on Linux

After the latest changes in NativeProcessLinux, these tests should be stable now. Please revert
(and let me know) if any issue crops up.

llvm-svn: 235502

9 years ago[OPENMP] Fixed test incompatibility for simd codegen.
Alexey Bataev [Wed, 22 Apr 2015 12:20:41 +0000 (12:20 +0000)]
[OPENMP] Fixed test incompatibility for simd codegen.

llvm-svn: 235501

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