oota-llvm.git
6 years agoDI: Reverse direction of subprogram -> function edge.
Peter Collingbourne [Thu, 5 Nov 2015 22:03:56 +0000 (22:03 +0000)]
DI: Reverse direction of subprogram -> function edge.

Previously, subprograms contained a metadata reference to the function they
described. Because most clients need to get or set a subprogram for a given
function rather than the other way around, this created unneeded inefficiency.

For example, many passes needed to call the function llvm::makeSubprogramMap()
to build a mapping from functions to subprograms, and the IR linker needed to
fix up function references in a way that caused quadratic complexity in the IR
linking phase of LTO.

This change reverses the direction of the edge by storing the subprogram as
function-level metadata and removing DISubprogram's function field.

Since this is an IR change, a bitcode upgrade has been provided.

Fixes PR23367. An upgrade script for textual IR for out-of-tree clients is
attached to the PR.

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

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

6 years agoRemove windows line endings introduced by r252177. NFC.
Tim Northover [Thu, 5 Nov 2015 21:54:58 +0000 (21:54 +0000)]
Remove windows line endings introduced by r252177. NFC.

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

6 years ago[ASan] Disable instrumentation for inalloca variables.
Alexey Samsonov [Thu, 5 Nov 2015 21:18:41 +0000 (21:18 +0000)]
[ASan] Disable instrumentation for inalloca variables.

inalloca variables were not treated as static allocas, therefore didn't
participate in regular stack instrumentation. We don't want them to
participate in dynamic alloca instrumentation as well.

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

6 years agoRefactor: Simplify boolean conditional return statements in lib/llvm/ExecutionEngine/Orc
Alexander Kornienko [Thu, 5 Nov 2015 21:18:09 +0000 (21:18 +0000)]
Refactor: Simplify boolean conditional return statements in lib/llvm/ExecutionEngine/Orc

Patch by Richard Thomson!

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

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

6 years ago[WinEH] Fix funclet prologues with stack realignment
Reid Kleckner [Thu, 5 Nov 2015 21:09:49 +0000 (21:09 +0000)]
[WinEH] Fix funclet prologues with stack realignment

We already had a test for this for 32-bit SEH catchpads, but those don't
actually create funclets. We had a bug that only appeared in funclet
prologues, where we would establish EBP and ESI as our FP and BP, and
then downstream prologue code would overwrite them.

While I was at it, I fixed Win64+funclets+stackrealign. This issue
doesn't come up as often there due to the ABI requring 16 byte stack
alignment, but now we can rest easy that AVX and WinEH will work well
together =P.

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

6 years agoRefactor: Simplify boolean conditional return statements in llvm/lib/Analysis
Alexander Kornienko [Thu, 5 Nov 2015 21:07:12 +0000 (21:07 +0000)]
Refactor: Simplify boolean conditional return statements in llvm/lib/Analysis

Patch by Richard Thomson!

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

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

6 years ago[WebAssembly] Fix copypasta.
Dan Gohman [Thu, 5 Nov 2015 20:59:49 +0000 (20:59 +0000)]
[WebAssembly] Fix copypasta.

Noticed by dschff in http://reviews.llvm.org/rL252203

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

6 years ago[WebAssembly] Rename Immediate instructions to Const.
Dan Gohman [Thu, 5 Nov 2015 20:44:29 +0000 (20:44 +0000)]
[WebAssembly] Rename Immediate instructions to Const.

This more closely reflects the naming convention in the spec.

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

6 years ago[WebAssembly] Add AsmString strings for most instructions.
Dan Gohman [Thu, 5 Nov 2015 20:42:30 +0000 (20:42 +0000)]
[WebAssembly] Add AsmString strings for most instructions.

Mangling type information into MachineInstr opcode names was a temporary
measure, and it's starting to get hairy. At the same time, the MC instruction
printer wants to use AsmString strings for printing. This patch takes the
first step, starting the process of adding AsmStrings for instructions.

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

6 years ago[WebAssembly] Update wasm builtin functions to match spec changes.
Dan Gohman [Thu, 5 Nov 2015 20:16:59 +0000 (20:16 +0000)]
[WebAssembly] Update wasm builtin functions to match spec changes.

The page_size operator has been removed from the spec, and the resize_memory
operator has been changed to grow_memory.

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

6 years agoreplace MachineCombinerPattern namespace and enum with enum class; NFCI
Sanjay Patel [Thu, 5 Nov 2015 19:34:57 +0000 (19:34 +0000)]
replace MachineCombinerPattern namespace and enum with enum class; NFCI

Also, remove an enum hack where enum values were used as indexes into an array.

We may want to make this a real class to allow pattern-based queries/customization (D13417).

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

6 years ago[WebAssembly] Add WebAssemblyMCInstLower.cpp.
Dan Gohman [Thu, 5 Nov 2015 19:28:16 +0000 (19:28 +0000)]
[WebAssembly] Add WebAssemblyMCInstLower.cpp.

This isn't used yet; it's just a start towards eventually using MC to
do instruction printing, and eventually binary encoding.

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

6 years agoReapply r250906 with many suggested updates from Rafael Espindola.
Kevin Enderby [Thu, 5 Nov 2015 19:24:56 +0000 (19:24 +0000)]
Reapply r250906 with many suggested updates from Rafael Espindola.
The needed lld matching changes to be submitted immediately next,
but this revision will cause lld failures with this alone which is expected.

This removes the eating of the error in Archive::Child::getSize() when the characters
in the size field in the archive header for the member is not a number.  To do this we
have all of the needed methods return ErrorOr to push them up until we get out of lib.
Then the tools and can handle the error in whatever way is appropriate for that tool.

So the solution is to plumb all the ErrorOr stuff through everything that touches archives.
This include its iterators as one can create an Archive object but the first or any other
Child object may fail to be created due to a bad size field in its header.

Thanks to Lang Hames on the changes making child_iterator contain an
ErrorOr<Child> instead of a Child and the needed changes to ErrorOr.h to add
operator overloading for * and -> .

We don’t want to use llvm_unreachable() as it calls abort() and is produces a “crash”
and using report_fatal_error() to move the error checking will cause the program to
stop, neither of which are really correct in library code. There are still some uses of
these that should be cleaned up in this library code for other than the size field.

The test cases use archives with text files so one can see the non-digit character,
in this case a ‘%’, in the size field.

These changes will require corresponding changes to the lld project.  That will be
committed immediately after this change.  But this revision will cause lld failures
with this alone which is expected.

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

6 years ago[SimplifyLibCalls] Use hasFloatVersion(). NFCI.
Davide Italiano [Thu, 5 Nov 2015 19:18:23 +0000 (19:18 +0000)]
[SimplifyLibCalls] Use hasFloatVersion(). NFCI.

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

6 years ago[DebugInfo] Fix ARM/AArch64 prologue_end position. Related to D11268.
Oleg Ranevskyy [Thu, 5 Nov 2015 17:50:17 +0000 (17:50 +0000)]
[DebugInfo] Fix ARM/AArch64 prologue_end position. Related to D11268.

Summary:
This review is related to another review request http://reviews.llvm.org/D11268, does the same and merely fixes a couple of issues with it.

D11268 is quite old and has merge conflicts against the current trunk.
This request
 - rebases D11268 onto the new trunk;
 - resolves the merge conflicts;
 - fixes the prologue_end tests, which do not pass due to the subprogram definitions not marked as distinct.

Reviewers: echristo, rengolin, kubabrecka

Subscribers: aemerson, rengolin, jyknight, dsanders, llvm-commits, asl

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

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

6 years agoAdd cfi instr for CFA calculation when movpc is expanded to call and pop
Petar Jovanovic [Thu, 5 Nov 2015 17:19:59 +0000 (17:19 +0000)]
Add cfi instr for CFA calculation when movpc is expanded to call and pop

This fixes the issue of wrong CFA calculation in the following case:

0x08048400 <+0>: push   %ebx
0x08048401 <+1>: sub    $0x8,%esp
0x08048404 <+4>: **call   0x8048409 <test+9>**
0x08048409 <+9>: **pop    %eax**
0x0804840a <+10>: add    $0x1bf7,%eax
0x08048410 <+16>: mov    %eax,%ebx
0x08048412 <+18>: call   0x80483f0 <bar>
0x08048417 <+23>: add    $0x8,%esp
0x0804841a <+26>: pop    %ebx
0x0804841b <+27>: ret

The highlighted instructions are a product of movpc instruction. The call
instruction changes the stack pointer, and pop instruction restores its
value. However, the rule for computing CFA is not updated and is wrong on
the pop instruction. So, e.g. backtrace in gdb does not work when on the pop
instruction. This adds cfi instructions for both call and pop instructions.

cfi_adjust_cfa_offset** instruction is used with the appropriate offset for
setting the rules to calculate CFA correctly.

Patch by Violeta Vukobrat.

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

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

6 years ago[WebAssembly] Rename ior operator to or to match the spec
Derek Schuff [Thu, 5 Nov 2015 17:08:11 +0000 (17:08 +0000)]
[WebAssembly] Rename ior operator to or to match the spec

Summary: The spec uses "or" for inclusive-or and "xor" for exclusive-or

Reviewers: sunfish

Subscribers: jfb, llvm-commits, dschuff

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

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

6 years agoUpdate comment to LoopAccessInfo after r251800. NFC
Silviu Baranga [Thu, 5 Nov 2015 15:55:41 +0000 (15:55 +0000)]
Update comment to LoopAccessInfo after r251800. NFC

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

6 years ago[ARM] Compute known bits for ARMISD::CMOV
James Molloy [Thu, 5 Nov 2015 15:21:58 +0000 (15:21 +0000)]
[ARM] Compute known bits for ARMISD::CMOV

We can conservatively know that CMOV's known bits are the intersection of known bits for each of its operands. This helps PerformCMOVToBFICombine find more opportunities.

I tried hard to create a testcase for this and failed - we have to sufficiently confuse DAG.computeKnownBits which can see through all the cheap tricks I tried to narrow my larger testcase down :(

This code is actually exercised in CodeGen/ARM/bfi.ll, there's just no functional difference because DAG.computeKnownBits gets the right answer in that case.

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

6 years agoFix a signed/unsigned mismatch warning; NFC.
Aaron Ballman [Thu, 5 Nov 2015 14:22:56 +0000 (14:22 +0000)]
Fix a signed/unsigned mismatch warning; NFC.

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

6 years agorevert rev. 252153 due to build failure on ubuntu
Asaf Badouh [Thu, 5 Nov 2015 08:55:54 +0000 (08:55 +0000)]
revert rev. 252153 due to build failure on ubuntu
[X86][AVX512] add comi with Sae

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

6 years ago[X86][AVX512] add comi with Sae
Asaf Badouh [Thu, 5 Nov 2015 08:45:06 +0000 (08:45 +0000)]
[X86][AVX512] add comi with Sae
add builtin_ia32_vcomisd and builtin_ia32_vcomisd

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

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

6 years ago[SimplifyCFG] Tweak heuristic for merging conditional stores
James Molloy [Thu, 5 Nov 2015 08:40:19 +0000 (08:40 +0000)]
[SimplifyCFG] Tweak heuristic for merging conditional stores

We were correctly skipping dbginfo intrinsics and terminators, but the initial bailout wasn't, causing it to bail out on almost any block.

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

6 years ago[X86][AVX512] small bugfix in VPBROADCASTM
Asaf Badouh [Thu, 5 Nov 2015 08:08:21 +0000 (08:08 +0000)]
[X86][AVX512] small bugfix in VPBROADCASTM

VPBROADCASTMW2D and VPBROADCASTMB2Q

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

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

6 years agoRuntimeDyld: fix -Wtype-limits
Saleem Abdulrasool [Thu, 5 Nov 2015 06:24:09 +0000 (06:24 +0000)]
RuntimeDyld: fix -Wtype-limits

Adjust the casted type.  By casting to the same size rather than just the
signed-ness, we were asserting tautological statements.  NFC.

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

6 years agoFix LoopAccessAnalysis when potentially nullptr check are involved
Mehdi Amini [Thu, 5 Nov 2015 05:49:43 +0000 (05:49 +0000)]
Fix LoopAccessAnalysis when potentially nullptr check are involved

Summary:
GetUnderlyingObjects() can return "null" among its list of objects,
we don't want to deduce that two pointers can point to the same
memory in this case, so filter it out.

Reviewers: anemet

Subscribers: dexonsmith, llvm-commits

From: Mehdi Amini <mehdi.amini@apple.com>

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

6 years agoMCStreamer.h: Prune \return, corresponding to r252102. [-Wdocumentation]
NAKAMURA Takumi [Thu, 5 Nov 2015 05:47:46 +0000 (05:47 +0000)]
MCStreamer.h: Prune \return, corresponding to r252102. [-Wdocumentation]

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

6 years agoFix a bug exposed by uses in CFE
Xinliang David Li [Thu, 5 Nov 2015 05:45:06 +0000 (05:45 +0000)]
Fix a bug exposed by uses in CFE

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

6 years agoAMDGPU: Also track whether SGPRs were spilled
Matt Arsenault [Thu, 5 Nov 2015 05:27:10 +0000 (05:27 +0000)]
AMDGPU: Also track whether SGPRs were spilled

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

6 years agoAMDGPU: Print number user SGPRs
Matt Arsenault [Thu, 5 Nov 2015 05:27:07 +0000 (05:27 +0000)]
AMDGPU: Print number user SGPRs

This doesn't quite match how SC prints it, which doesn't put it in a
comment.

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

6 years agoAMDGPU: Disallow s[102:103] on VI in assembler
Matt Arsenault [Thu, 5 Nov 2015 03:11:27 +0000 (03:11 +0000)]
AMDGPU: Disallow s[102:103] on VI in assembler

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

6 years ago[FunctionAttrs] Remove a loop, NFC refactor
Sanjoy Das [Thu, 5 Nov 2015 03:04:40 +0000 (03:04 +0000)]
[FunctionAttrs] Remove a loop, NFC refactor

Summary:
Remove the loop over the uses of the CallSite in ArgumentUsesTracker.
Since we have the `Use *` for actual argument operand, we can just use
pointer subtraction.

The time complexity remains the same though (except for a vararg
argument) -- `std::advance` is O(UseIndex) for the ArgumentList
iterator.

The real motivation is to make a later change adding support for operand
bundles simpler.

Reviewers: reames, chandlerc, nlewycky

Subscribers: llvm-commits

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

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

6 years agoAMDGPU: Fix assert when legalizing atomic operands
Matt Arsenault [Thu, 5 Nov 2015 02:46:56 +0000 (02:46 +0000)]
AMDGPU: Fix assert when legalizing atomic operands

The operand layout is slightly different for the atomic
opcodes from the usual MUBUF loads and stores.

This should only fix it on SI/CI. VI is still broken
because it still emits the addr64 replacement.

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

6 years agoAMDGPU: Make addr64 atomic operand order consistent
Matt Arsenault [Thu, 5 Nov 2015 02:46:53 +0000 (02:46 +0000)]
AMDGPU: Make addr64 atomic operand order consistent

vaddr comes before srsrc in every other MUBUF instruction,
and is the order it is printed.

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

6 years agoFix OSX build after r252118 (missing parameter for findModulesAndOffsets())
Mehdi Amini [Thu, 5 Nov 2015 02:29:57 +0000 (02:29 +0000)]
Fix OSX build after r252118 (missing parameter for findModulesAndOffsets())

From: Mehdi Amini <mehdi.amini@apple.com>

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

6 years agoRemove empty lines
Mehdi Amini [Thu, 5 Nov 2015 02:29:53 +0000 (02:29 +0000)]
Remove empty lines

From: Mehdi Amini <mehdi.amini@apple.com>

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

6 years ago[WinEH] Fix establisher param reg in CLR funclets
Joseph Tremoulet [Thu, 5 Nov 2015 02:20:07 +0000 (02:20 +0000)]
[WinEH] Fix establisher param reg in CLR funclets

Summary:
The CLR's personality routine passes the pointer to the establisher frame
in RCX, not RDX.

Reviewers: pgavlin, majnemer, rnk

Subscribers: llvm-commits

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

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

6 years ago[IR] Add bounds checking to dataOperandHasImpliedAttr
Sanjoy Das [Thu, 5 Nov 2015 01:53:26 +0000 (01:53 +0000)]
[IR] Add bounds checking to dataOperandHasImpliedAttr

This is similar to the bounds check added to paramHasAttr in r252073.

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

6 years ago[libFuzzer] print a bit fewer lines
Kostya Serebryany [Thu, 5 Nov 2015 01:19:42 +0000 (01:19 +0000)]
[libFuzzer] print a bit fewer lines

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

6 years agoGo back to producing relocations for out of range symbols.
Rafael Espindola [Thu, 5 Nov 2015 01:10:15 +0000 (01:10 +0000)]
Go back to producing relocations for out of range symbols.

This brings back the behavior from before r252090 for out of range symbols.

Should bring some arm bots back.

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

6 years ago[Windows] Symbolize with llvm-symbolizer instead of dbghelp in a self-host
Reid Kleckner [Thu, 5 Nov 2015 01:07:54 +0000 (01:07 +0000)]
[Windows] Symbolize with llvm-symbolizer instead of dbghelp in a self-host

Summary:
llvm-symbolizer understands both PDBs and DWARF, so it is more likely to
succeed at symbolization. If llvm-symbolizer is unavailable, we will
fall back to dbghelp. This also makes our crash traces more similar
between Windows and Linux.

Reviewers: Bigcheese, zturner, chapuni

Subscribers: llvm-commits

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

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

6 years agoAMDGPU: Add missing v2f64 fadd tests
Matt Arsenault [Thu, 5 Nov 2015 01:03:11 +0000 (01:03 +0000)]
AMDGPU: Add missing v2f64 fadd tests

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

6 years agoAMDGPU: Fix typo
Matt Arsenault [Thu, 5 Nov 2015 01:03:08 +0000 (01:03 +0000)]
AMDGPU: Fix typo

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

6 years ago[PGO] Use template file to define runtime structures
Xinliang David Li [Thu, 5 Nov 2015 00:47:26 +0000 (00:47 +0000)]
[PGO] Use template file to define runtime structures

With this change, instrumentation code and reader/write
code related to profile data structs are kept strictly
in-sync. THis will be extended to cfe and compile-rt
references as well.

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

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

6 years agoFix Abbrev emission in WriteIdentificationBlock
Mehdi Amini [Thu, 5 Nov 2015 00:25:03 +0000 (00:25 +0000)]
Fix Abbrev emission in WriteIdentificationBlock

This Abbrev was not emitted and basically unused, just leacking there.

From: Mehdi Amini <mehdi.amini@apple.com>

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

6 years agoFix pr24832.
Rafael Espindola [Thu, 5 Nov 2015 00:10:08 +0000 (00:10 +0000)]
Fix pr24832.

It is pretty simple now that the yak is shaved.

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

6 years agoSimplify now that emitValueToOffset always returns false.
Rafael Espindola [Wed, 4 Nov 2015 23:59:18 +0000 (23:59 +0000)]
Simplify now that emitValueToOffset always returns false.

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

6 years agoSimplify .org processing and make it a bit more powerful.
Rafael Espindola [Wed, 4 Nov 2015 23:50:29 +0000 (23:50 +0000)]
Simplify .org processing and make it a bit more powerful.

We now always create the fragment, which lets us handle things like .org after
a .align.

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

6 years agoDefine portable macros for packed struct definitions:
Xinliang David Li [Wed, 4 Nov 2015 23:42:56 +0000 (23:42 +0000)]
Define portable macros for packed struct definitions:

 1. A macro with argument: LLVM_PACKED(StructDefinition)
 2. A pair of macros defining scope of region with packing:
    LLVM_PACKED_START
     struct A { ... };
     struct B { ... };
    LLVM_PACKED_END

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

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

6 years ago[SimplifyLibCalls] New transformation: tan(atan(x)) -> x
Davide Italiano [Wed, 4 Nov 2015 23:36:56 +0000 (23:36 +0000)]
[SimplifyLibCalls] New transformation: tan(atan(x)) -> x

This is enabled only under -ffast-math.
So, instead of emitting:
  4007b0:       50                      push   %rax
  4007b1:       e8 8a fd ff ff          callq  400540 <atanf@plt>
  4007b6:       58                      pop    %rax
  4007b7:       e9 94 fd ff ff          jmpq   400550 <tanf@plt>
  4007bc:       0f 1f 40 00             nopl   0x0(%rax)

for:
float mytan(float x) {
  return tanf(atanf(x));
}
we emit a single retq.

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

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

6 years ago[libFuzzer] when choosing the next unit to mutate, give some preference to the most...
Kostya Serebryany [Wed, 4 Nov 2015 23:22:25 +0000 (23:22 +0000)]
[libFuzzer] when choosing the next unit to mutate, give some preference to the most recent units (they are more likely to be interesting)

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

6 years agofix typo; NFC
Sanjay Patel [Wed, 4 Nov 2015 23:21:13 +0000 (23:21 +0000)]
fix typo; NFC

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

6 years ago[CaptureTracking] Support operand bundles conservatively
Sanjoy Das [Wed, 4 Nov 2015 23:21:06 +0000 (23:21 +0000)]
[CaptureTracking] Support operand bundles conservatively

Summary:
Earlier CaptureTracking would assume all "interesting" operands to a
call or invoke were its arguments.  With operand bundles this is no
longer true.

Note: an earlier change got `doesNotCapture` working correctly with
operand bundles.

This change uses DSE to test the changes to CaptureTracking.  DSE is a
vehicle for testing only, and is not directly involved in this change.

Reviewers: reames, majnemer

Subscribers: llvm-commits

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

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

6 years ago[CMake] Bug 25059 - CMake libllvm.so.$MAJOR.$MINOR shared object name not compatible...
Chris Bieneman [Wed, 4 Nov 2015 23:11:12 +0000 (23:11 +0000)]
[CMake] Bug 25059 - CMake libllvm.so.$MAJOR.$MINOR shared object name not compatible with ldconfig

Summary:
This change makes the CMake build system generate libraries for Linux and Darwin matching the makefile build system.

Linux libraries follow the pattern lib${name}.${MAJOR}.${MINOR}.so so that ldconfig won't pick it up incorrectly.

Darwin libraries are not versioned.

Note: On linux the non-versioned symlink is generated at install-time not build time. I plan to fix that eventually, but I expect that is good enough for the purposes of fixing this bug.

Reviewers: loladiro, tstellarAMD

Subscribers: axw, llvm-commits

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

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

6 years agoSlightly saner handling of thumb branches.
Rafael Espindola [Wed, 4 Nov 2015 23:00:39 +0000 (23:00 +0000)]
Slightly saner handling of thumb branches.

The generic infrastructure already did a lot of work to decide if the
fixup value is know or not. It doesn't make sense to reimplement a very
basic case: same fragment.

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

6 years ago[x86] Teach the shrink-wrapping hooks to do the proper thing with Win64.
Quentin Colombet [Wed, 4 Nov 2015 22:37:28 +0000 (22:37 +0000)]
[x86] Teach the shrink-wrapping hooks to do the proper thing with Win64.

Win64 has some strict requirements for the epilogue. As a result, we disable
shrink-wrapping for Win64 unless the block that gets the epilogue is already an
exit block.

Fixes PR24193.

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

6 years agoFix some Clang-tidy modernize warnings, other minor fixes.
Eugene Zelenko [Wed, 4 Nov 2015 22:32:32 +0000 (22:32 +0000)]
Fix some Clang-tidy modernize warnings, other minor fixes.

Fixed warnings are: modernize-use-override, modernize-use-nullptr and modernize-redundant-void-arg.

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

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

6 years agoPM: Rephrase PrintLoopPass as a wrapper around a new-style pass. NFC
Justin Bogner [Wed, 4 Nov 2015 22:24:08 +0000 (22:24 +0000)]
PM: Rephrase PrintLoopPass as a wrapper around a new-style pass. NFC

Splits PrintLoopPass into a new-style pass and a PrintLoopPassWrapper,
much like we already do for PrintFunctionPass and PrintModulePass.

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

6 years agoAdd new interfaces to MBB for manipulating successors with probabilities instead...
Cong Hou [Wed, 4 Nov 2015 21:37:58 +0000 (21:37 +0000)]
Add new interfaces to MBB for manipulating successors with probabilities instead of weights. NFC.

This is part-1 of the patch that replaces all edge weights in MBB by
probabilities, which only adds new interfaces. No functional changes.

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

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

6 years agoWarning fix.
Simon Pilgrim [Wed, 4 Nov 2015 21:27:22 +0000 (21:27 +0000)]
Warning fix.

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

6 years ago[IR] Add a `data_operand` abstraction
Sanjoy Das [Wed, 4 Nov 2015 21:05:24 +0000 (21:05 +0000)]
[IR] Add a `data_operand` abstraction

Summary:
Data operands of a call or invoke consist of the call arguments, and
the bundle operands associated with the `call` (or `invoke`)
instruction.  The motivation for this change is that we'd like to be
able to query "argument attributes" like `readonly` and `nocapture`
for bundle operands naturally.

This change also provides a conservative "implementation" for these
attributes for any bundle operand, and an extension point for future
work.

Reviewers: chandlerc, majnemer, reames

Subscribers: llvm-commits

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

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

6 years agollvm-config: Add --has-rtti option
Tom Stellard [Wed, 4 Nov 2015 20:57:43 +0000 (20:57 +0000)]
llvm-config: Add --has-rtti option

Summary:
This prints NO if LLVM was built with -fno-rtti or an equivalent flag
and YES otherwise.  The reasons to add -has-rtti rather than adding -fno-rtti
to --cxxflags are:

1. Building LLVM with -fno-rtti does not always mean that client
applications need this flag.

2. Some compilers have a different flag for disabling rtti, and the
compiler being used to build LLVM may not be the compiler being used to
build the application.

Reviewers: echristo, chandlerc, beanz

Subscribers: llvm-commits

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

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

6 years ago[X86][SSE] Add general memory folding for (V)INSERTPS instruction
Simon Pilgrim [Wed, 4 Nov 2015 20:48:09 +0000 (20:48 +0000)]
[X86][SSE] Add general memory folding for (V)INSERTPS instruction

This patch improves the memory folding of the inserted float element for the (V)INSERTPS instruction.

The existing implementation occurs in the DAGCombiner and relies on the narrowing of a whole vector load into a scalar load (and then converted into a vector) to (hopefully) allow folding to occur later on. Not only has this proven problematic for debug builds, it also prevents other memory folds (notably stack reloads) from happening.

This patch removes the old implementation and moves the folding code to the X86 foldMemoryOperand handler. A new private 'special case' function - foldMemoryOperandCustom - has been added to deal with memory folding of instructions that can't just use the lookup tables - (V)INSERTPS is the first of several that could be done.

It also tweaks the memory operand folding code with an additional pointer offset that allows existing memory addresses to be modified, in this case to convert the vector address to the explicit address of the scalar element that will be inserted.

Unlike the previous implementation we now set the insertion source index to zero, although this is ignored for the (V)INSERTPSrm version, anything that relied on shuffle decodes (such as unfolding of insertps loads) was incorrectly calculating the source address - I've added a test for this at insertps-unfold-load-bug.ll

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

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

6 years ago[IR] Add bounds checking to paramHasAttr
Sanjoy Das [Wed, 4 Nov 2015 20:33:45 +0000 (20:33 +0000)]
[IR] Add bounds checking to paramHasAttr

Summary:
This is intended to make a later change simpler.

Note: adding this bounds checking required fixing `X86FastISel`.  As
far I can tell I've preserved original behavior but a careful review
will be appreciated.

Reviewers: reames

Subscribers: llvm-commits

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

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

6 years agoOrc: Streamline some lambda usage in a unit test
David Blaikie [Wed, 4 Nov 2015 19:43:24 +0000 (19:43 +0000)]
Orc: Streamline some lambda usage in a unit test

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

6 years agoRelax the check for ninja.
Rafael Espindola [Wed, 4 Nov 2015 19:18:11 +0000 (19:18 +0000)]
Relax the check for ninja.

On fedora the ninja executable is called ninja-build :-(

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

6 years agoCreated new X86 FMA3 opcodes (FMA*_Int) that are used now for lowering of scalar...
Andrew Kaylor [Wed, 4 Nov 2015 18:10:41 +0000 (18:10 +0000)]
Created new X86 FMA3 opcodes (FMA*_Int) that are used now for lowering of scalar FMA intrinsics.

Patch by Slava Klochkov

The key difference between FMA* and FMA*_Int opcodes is that FMA*_Int opcodes are handled more conservatively. It is illegal to commute the 1st operand of FMA*_Int instructions as the upper bits of scalar FMA intrinsic result must be taken from the 1st operand, but such commute transformation would change those upper bits and invalidate the intrinsic's result.

Reviewers: Quentin Colombet, Elena Demikhovsky

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

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

6 years ago[ARM] Combine CMOV into BFI where possible
James Molloy [Wed, 4 Nov 2015 16:55:07 +0000 (16:55 +0000)]
[ARM] Combine CMOV into BFI where possible

If we have a CMOV, OR and AND combination such as:
  if (x & CN)
    y |= CM;

And:
  * CN is a single bit;
  * All bits covered by CM are known zero in y;

Then we can convert this to a sequence of BFI instructions. This will always be a win if CM is a single bit, will always be no worse than the TST & OR sequence if CM is two bits, and for thumb will be no worse if CM is three bits (due to the extra IT instruction).

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

6 years ago[ThinLTO] Always set linkage type to external when converting alias
Teresa Johnson [Wed, 4 Nov 2015 16:01:16 +0000 (16:01 +0000)]
[ThinLTO] Always set linkage type to external when converting alias

When converting an alias to a non-alias when the aliasee is not
imported, ensure that the linkage type is set to external so that it is
a valid linkage type. Added a test case that exposed this issue.

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

6 years ago[SimplifyCFG] Merge conditional stores
James Molloy [Wed, 4 Nov 2015 15:28:04 +0000 (15:28 +0000)]
[SimplifyCFG] Merge conditional stores

We can often end up with conditional stores that cannot be speculated. They can come from fairly simple, idiomatic code:

  if (c & flag1)
    *a = x;
  if (c & flag2)
    *a = y;
  ...

There is no dominating or post-dominating store to a, so it is not legal to move the store unconditionally to the end of the sequence and cache the intermediate result in a register, as we would like to.

It is, however, legal to merge the stores together and do the store once:

  tmp = undef;
  if (c & flag1)
    tmp = x;
  if (c & flag2)
    tmp = y;
  if (c & flag1 || c & flag2)
    *a = tmp;

The real power in this optimization is that it allows arbitrary length ladders such as these to be completely and trivially if-converted. The typical code I'd expect this to trigger on often uses binary-AND with constants as the condition (as in the above example), which means the ending condition can simply be truncated into a single binary-AND too: 'if (c & (flag1|flag2))'. As in the general case there are bitwise operators here, the ladder can often be optimized further too.

This optimization involves potentially increasing register pressure. Even in the simplest case, the lifetime of the first predicate is extended. This can be elided in some cases such as using binary-AND on constants, but not in the general case. Threading 'tmp' through all branches can also increase register pressure.

The optimization as in this patch is enabled by default but kept in a very conservative mode. It will only optimize if it thinks the resultant code should be if-convertable, and additionally if it can thread 'tmp' through at least one existing PHI, so it will only ever in the worst case create one more PHI and extend the lifetime of a predicate.

This doesn't trigger much in LNT, unfortunately, but it does trigger in a big way in a third party test suite.

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

6 years agoError out when faced with value names containing '\0'
Filipe Cabecinhas [Wed, 4 Nov 2015 14:53:36 +0000 (14:53 +0000)]
Error out when faced with value names containing '\0'

Bug found with afl-fuzz.

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

6 years agoSilence an extra semicolon warning; NFC.
Aaron Ballman [Wed, 4 Nov 2015 14:40:54 +0000 (14:40 +0000)]
Silence an extra semicolon warning; NFC.

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

6 years ago[ELF] elfiamcu triple should imply e_machine == EM_IAMCU
Michael Kuperstein [Wed, 4 Nov 2015 11:21:50 +0000 (11:21 +0000)]
[ELF] elfiamcu triple should imply e_machine == EM_IAMCU

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

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

6 years ago[X86] DAGCombine should not introduce FILD in soft-float mode
Michael Kuperstein [Wed, 4 Nov 2015 11:17:53 +0000 (11:17 +0000)]
[X86] DAGCombine should not introduce FILD in soft-float mode

The x86 "sitofp i64 to double" dag combine, in 32-bit mode, lowers sitofp
directly to X86ISD::FILD (or FILD_FLAG). This should not be done in soft-float mode.

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

6 years agoRevert "[PatternMatch] Switch to use ValueTracking::matchSelectPattern"
James Molloy [Wed, 4 Nov 2015 08:36:53 +0000 (08:36 +0000)]
Revert "[PatternMatch] Switch to use ValueTracking::matchSelectPattern"

This was breaking the modules build and is being reverted while we reach consensus on the right way to solve this layering problem. This reverts commit r251785.

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

6 years agoFix unit tests on Windows: handle env vars with non-ASCII chars.
Pawel Bylica [Wed, 4 Nov 2015 08:25:20 +0000 (08:25 +0000)]
Fix unit tests on Windows: handle env vars with non-ASCII chars.

Summary: On Windows we have to take UTF16 encoded env vars and convert them to UTF8. This patch fixes CopyEnvironment helper function used by process unit tests.

Reviewers: yaron.keren

Subscribers: yaron.keren, llvm-commits

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

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

6 years ago[OperandBundles] Refactor; NFCI.
Sanjoy Das [Wed, 4 Nov 2015 04:31:21 +0000 (04:31 +0000)]
[OperandBundles] Refactor; NFCI.

Extract out a helper function `operandBundleFromBundleOpInfo`.

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

6 years ago[OperandBundles] Refactor; NFCI
Sanjoy Das [Wed, 4 Nov 2015 04:31:06 +0000 (04:31 +0000)]
[OperandBundles] Refactor; NFCI

Intended to make later changes simpler.  Exposes
`getBundleOperandsStartIndex` and `getBundleOperandsEndIndex`, and uses
them for the computation in `getNumTotalBundleOperands`.

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

6 years ago[LVI] Update a comment to clarify what's actually happening and why
Philip Reames [Wed, 4 Nov 2015 01:47:04 +0000 (01:47 +0000)]
[LVI] Update a comment to clarify what's actually happening and why

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

6 years ago[CVP] Fold return values if possible
Philip Reames [Wed, 4 Nov 2015 01:43:54 +0000 (01:43 +0000)]
[CVP] Fold return values if possible

In my previous change to CVP (251606), I made CVP much more aggressive about trying to constant fold comparisons. This patch is a reversal in direction. Rather than being agressive about every compare, we restore the non-block local restriction for most, and then try hard for compares feeding returns.

The motivation for this is two fold:
 * The more I thought about it, the less comfortable I got with the possible compile time impact of the other approach. There have been no reported issues, but after talking to a couple of folks, I've come to the conclusion the time probably isn't justified.
 * It turns out we need to know the context to leverage the full power of LVI. In particular, asking about something at the end of it's block (the use of a compare in a return) will frequently get more precise results than something in the middle of a block. This is an implementation detail, but it's also hard to get around since mid-block queries have to reason about possible throwing instructions and don't get to use most of LVI's block focused infrastructure. This will become particular important when combined with http://reviews.llvm.org/D14263.

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

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

6 years ago[StatepointLowering] Remove distinction between call and invoke safepoints
Igor Laevsky [Wed, 4 Nov 2015 01:16:10 +0000 (01:16 +0000)]
[StatepointLowering] Remove distinction between call and invoke safepoints

There is no point in having invoke safepoints handled differently than the
call safepoints. All relevant decisions could be made by looking at whether
or not gc.result and gc.relocate lay in a same basic block. This change will
 allow to lower call safepoints with relocates and results in a different
basic blocks. See test case for example.

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

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

6 years agoFix the test case for Windows.
Alexey Samsonov [Wed, 4 Nov 2015 01:09:37 +0000 (01:09 +0000)]
Fix the test case for Windows.

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

6 years ago[LLVMSymbolize] Reduce indentation by using helper function. NFC.
Alexey Samsonov [Wed, 4 Nov 2015 00:30:26 +0000 (00:30 +0000)]
[LLVMSymbolize] Reduce indentation by using helper function. NFC.

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

6 years ago[LLVMSymbolize] Properly propagate object parsing errors from the library.
Alexey Samsonov [Wed, 4 Nov 2015 00:30:24 +0000 (00:30 +0000)]
[LLVMSymbolize] Properly propagate object parsing errors from the library.

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

6 years ago[llvm-symbolizer] Improve the test for missing input file.
Alexey Samsonov [Wed, 4 Nov 2015 00:30:19 +0000 (00:30 +0000)]
[llvm-symbolizer] Improve the test for missing input file.

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

6 years agoFix unused variable warning from r252017
Adam Nemet [Wed, 4 Nov 2015 00:10:33 +0000 (00:10 +0000)]
Fix unused variable warning from r252017

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

6 years agoLLE 6/6: Add LoopLoadElimination pass
Adam Nemet [Tue, 3 Nov 2015 23:50:08 +0000 (23:50 +0000)]
LLE 6/6: Add LoopLoadElimination pass

Summary:
The goal of this pass is to perform store-to-load forwarding across the
backedge of a loop.  E.g.:

  for (i)
     A[i + 1] = A[i] + B[i]

  =>

  T = A[0]
  for (i)
     T = T + B[i]
     A[i + 1] = T

The pass relies on loop dependence analysis via LoopAccessAnalisys to
find opportunities of loop-carried dependences with a distance of one
between a store and a load.  Since it's using LoopAccessAnalysis, it was
easy to also add support for versioning away may-aliasing intervening
stores that would otherwise prevent this transformation.

This optimization is also performed by Load-PRE in GVN without the
option of multi-versioning.  As was discussed with Daniel Berlin in
http://reviews.llvm.org/D9548, this is inferior to a more loop-aware
solution applied here.  Hopefully, we will be able to remove some
complexity from GVN/MemorySSA as a consequence.

In the long run, we may want to extend this pass (or create a new one if
there is little overlap) to also eliminate loop-indepedent redundant
loads and store that *require* versioning due to may-aliasing
intervening stores/loads.  I have some motivating cases for store
elimination. My plan right now is to wait for MemorySSA to come online
first rather than using memdep for this.

The main motiviation for this pass is the 456.hmmer loop in SPECint2006
where after distributing the original loop and vectorizing the top part,
we are left with the critical path exposed in the bottom loop.  Being
able to promote the memory dependence into a register depedence (even
though the HW does perform store-to-load fowarding as well) results in a
major gain (~20%).  This gain also transfers over to x86: it's
around 8-10%.

Right now the pass is off by default and can be enabled
with -enable-loop-load-elim.  On the LNT testsuite, there are two
performance changes (negative number -> improvement):

  1. -28% in Polybench/linear-algebra/solvers/dynprog: the length of the
     critical paths is reduced
  2. +2% in Polybench/stencils/adi: Unfortunately, I couldn't reproduce this
     outside of LNT

The pass is scheduled after the loop vectorizer (which is after loop
distribution).  The rational is to try to reuse LAA state, rather than
recomputing it.  The order between LV and LLE is not critical because
normally LV does not touch scalar st->ld forwarding cases where
vectorizing would inhibit the CPU's st->ld forwarding to kick in.

LoopLoadElimination requires LAA to provide the full set of dependences
(including forward dependences).  LAA is known to omit loop-independent
dependences in certain situations.  The big comment before
removeDependencesFromMultipleStores explains why this should not occur
for the cases that we're interested in.

Reviewers: dberlin, hfinkel

Subscribers: junbuml, dberlin, mssimpso, rengolin, sanjoy, llvm-commits

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

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

6 years ago[LAA] LLE 5/6: Add predicate functions Dependence::isForward/isBackward, NFC
Adam Nemet [Tue, 3 Nov 2015 23:50:03 +0000 (23:50 +0000)]
[LAA] LLE 5/6: Add predicate functions Dependence::isForward/isBackward, NFC

Summary: Will be used by the LoopLoadElimination pass.

Reviewers: hfinkel

Subscribers: llvm-commits

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

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

6 years ago[LAA] LLE 4/6: APIs to access the dependent instructions for a dependence, NFC
Adam Nemet [Tue, 3 Nov 2015 23:49:58 +0000 (23:49 +0000)]
[LAA] LLE 4/6: APIs to access the dependent instructions for a dependence, NFC

Summary:
The functions use LAI and MemoryDepChecker classes so they need to be
defined after those definitions outside of the Dependence class.

Will be used by the LoopLoadElimination pass.

Reviewers: hfinkel

Subscribers: rengolin, llvm-commits

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

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

6 years agoCodeGen, Target: Move Mach-O-specific symbol name logic to Mach-O lowering.
Peter Collingbourne [Tue, 3 Nov 2015 23:40:03 +0000 (23:40 +0000)]
CodeGen, Target: Move Mach-O-specific symbol name logic to Mach-O lowering.

A profile of an LTO link of Chrome revealed that we were spending some
~30-50% of execution time in the function Constant::getRelocationInfo(),
which is called from TargetLoweringObjectFile::getKindForGlobal() and in turn
from TargetMachine::getNameWithPrefix().

It turns out that we only need the result of getKindForGlobal() when
targeting Mach-O, so this change moves the relevant part of the logic to
TargetLoweringObjectFileMachO.

NFCI.

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

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

6 years agoAMDGPU: Make flat_scratch name consistent
Matt Arsenault [Tue, 3 Nov 2015 22:50:34 +0000 (22:50 +0000)]
AMDGPU: Make flat_scratch name consistent

The printed name and the parsed assembler names weren't the same.
I'm not sure which name SC prints these as, but I think it's this one.

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

6 years agoAMDGPU: Fix asserts on invalid register ranges
Matt Arsenault [Tue, 3 Nov 2015 22:50:32 +0000 (22:50 +0000)]
AMDGPU: Fix asserts on invalid register ranges

If the requested SGPR was not actually aligned, it was
accepted and rounded down instead of rejected.

Also fix an assert if the range is an invalid size.

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

6 years agoAMDGPU: Fix off by one error in register parsing
Matt Arsenault [Tue, 3 Nov 2015 22:50:27 +0000 (22:50 +0000)]
AMDGPU: Fix off by one error in register parsing

If trying to use one past the end, this would assert.

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

6 years agoAddress nit
Derek Schuff [Tue, 3 Nov 2015 22:40:45 +0000 (22:40 +0000)]
Address nit

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

6 years agoAlign whitespace
Derek Schuff [Tue, 3 Nov 2015 22:40:43 +0000 (22:40 +0000)]
Align whitespace

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

6 years ago[WebAssembly] Support wasm select operator
Derek Schuff [Tue, 3 Nov 2015 22:40:40 +0000 (22:40 +0000)]
[WebAssembly] Support wasm select operator

Summary:
Add support for wasm's select operator, and lower LLVM's select DAG node
to it.

Reviewers: sunfish

Subscribers: dschuff, llvm-commits, jfb

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

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

6 years agoAMDGPU: s[102:103] is unavailable on VI
Matt Arsenault [Tue, 3 Nov 2015 22:39:52 +0000 (22:39 +0000)]
AMDGPU: s[102:103] is unavailable on VI

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

6 years agoAMDGPU: Define correct number of SGPRs
Matt Arsenault [Tue, 3 Nov 2015 22:39:50 +0000 (22:39 +0000)]
AMDGPU: Define correct number of SGPRs

There are actually 104 so 2 were missing.

More assembler tests with high register number tuples
will be included in later patches.

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

6 years agoAMDGPU: Make findUsedSGPR more readable
Matt Arsenault [Tue, 3 Nov 2015 22:30:15 +0000 (22:30 +0000)]
AMDGPU: Make findUsedSGPR more readable

Add more comments etc.

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

6 years agoAMDGPU: Initialize SIFixSGPRCopies so -print-after works
Matt Arsenault [Tue, 3 Nov 2015 22:30:13 +0000 (22:30 +0000)]
AMDGPU: Initialize SIFixSGPRCopies so -print-after works

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