oota-llvm.git
10 years ago[docs] Amend confusing title
Sean Silva [Mon, 1 Jul 2013 20:45:12 +0000 (20:45 +0000)]
[docs] Amend confusing title

"Writing an LLVM Compiler Backend" can be misinterpreted as meaning
"backend" in the sense of "using LLVM as a backend for your compiler for
your new language". This new name is less ambiguous.

As a bonus, this brings the title in line with the file name.

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

10 years ago[mips] Reverse the order of source operands of shift and rotate instructions that
Akira Hatanaka [Mon, 1 Jul 2013 20:39:53 +0000 (20:39 +0000)]
[mips] Reverse the order of source operands of shift and rotate instructions that
have three register operands.

No intended functionality changes.

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

10 years ago[PowerPC] Also add "msync" alias
Ulrich Weigand [Mon, 1 Jul 2013 20:39:50 +0000 (20:39 +0000)]
[PowerPC] Also add "msync" alias

This adds an alias for "msync" (which is used on Book E
systems instead of "sync").

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

10 years ago[mips] Increase the number of floating point control registers available to 32.
Akira Hatanaka [Mon, 1 Jul 2013 20:31:44 +0000 (20:31 +0000)]
[mips] Increase the number of floating point control registers available to 32.
Create a dedicated register class for floating point condition code registers and
move FCC0 from register class CCR to the new register class.

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

10 years ago[mips] Fix test case to check that mips64 instructions are generated.
Akira Hatanaka [Mon, 1 Jul 2013 20:18:58 +0000 (20:18 +0000)]
[mips] Fix test case to check that mips64 instructions are generated.

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

10 years agoReally fix the test. Sorry for the breakage...
Anton Korobeynikov [Mon, 1 Jul 2013 19:51:36 +0000 (19:51 +0000)]
Really fix the test. Sorry for the breakage...

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

10 years agoFix the test which relies on uncommitted change
Anton Korobeynikov [Mon, 1 Jul 2013 19:50:31 +0000 (19:50 +0000)]
Fix the test which relies on uncommitted change

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

10 years agoFix the build after r185363. Use llvm::next instead of raw next.
Cameron Zwarich [Mon, 1 Jul 2013 19:49:48 +0000 (19:49 +0000)]
Fix the build after r185363. Use llvm::next instead of raw next.

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

10 years agoAdd jump tables handling for MSP430.
Anton Korobeynikov [Mon, 1 Jul 2013 19:44:44 +0000 (19:44 +0000)]
Add jump tables handling for MSP430.
Patch by Job Noorman!

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

10 years agoFix PR16508.
Cameron Zwarich [Mon, 1 Jul 2013 19:42:46 +0000 (19:42 +0000)]
Fix PR16508.

When phis get lowered, destination copies are inserted using an iterator that is
determined once for all phis in the block, which BuildMI interprets as a request
to insert an instruction directly before the iterator. In the case of a cyclic
phi, source copies may also be inserted directly before this iterator, which can
cause source copies to be inserted before destination copies. The fix is to keep
an iterator to the last phi and then advance it while lowering each phi in order
to insert destination copies directly after the phis.

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

10 years agoDon't form PPC CTR loops for over-sized exit counts
Hal Finkel [Mon, 1 Jul 2013 19:34:59 +0000 (19:34 +0000)]
Don't form PPC CTR loops for over-sized exit counts

Although you can't generate this from C on PPC64, if you have a loop using a
64-bit counter on PPC32 then you can't form a CTR-based loop for it. This had
been cauing the PPCCTRLoops pass to assert.

Thanks to Joerg Sonnenberger for providing a test case!

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

10 years agoAArch64: correct CodeGen of MOVZ/MOVK combinations.
Tim Northover [Mon, 1 Jul 2013 19:23:10 +0000 (19:23 +0000)]
AArch64: correct CodeGen of MOVZ/MOVK combinations.

According to the AArch64 ELF specification (4.6.8), it's the
assembler's responsibility to make sure the shift amount is correct in
relocated MOVZ/MOVK instructions.

This wasn't being obeyed by either the MCJIT CodeGen or RuntimeDyldELF
(which happened to work out well for JIT tests). This commit should
make us compliant in this area.

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

10 years ago(1) Add ".test" to test/Other/lit.local.cfg, so llvm-cov.test is actually run.
Matt Beaumont-Gay [Mon, 1 Jul 2013 18:58:53 +0000 (18:58 +0000)]
(1) Add ".test" to test/Other/lit.local.cfg, so llvm-cov.test is actually run.
(2) Rename llvm-cov test inputs so the string "llvm-cov" doesn't get
substituted by lit within the input filenames on the RUN line.
(3) XFAIL llvm-cov.test because it asserts:
include/llvm/ADT/SmallVector.h:140: reference llvm::SmallVectorTemplateCommon<llvm::GCOVBlock *, void>::operator[](unsigned int) [T = llvm::GCOVBlock *]: Assertion `begin() + idx < end()' failed.

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

10 years agoRevert r185339 (ARM: relax the atomic release barrier to "dmb ishst")
Tim Northover [Mon, 1 Jul 2013 18:37:33 +0000 (18:37 +0000)]
Revert r185339 (ARM: relax the atomic release barrier to "dmb ishst")

Turns out I'd misread the architecture reference manual and thought
that was a load/store-store barrier, when it's not.

Thanks for pointing it out Eli!

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

10 years agoDebug Info: Scope of a DebugLoc should not be null.
Manman Ren [Mon, 1 Jul 2013 18:20:30 +0000 (18:20 +0000)]
Debug Info: Scope of a DebugLoc should not be null.

No functionality change. Remove handling for the null case.

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

10 years ago[PowerPC] Fix @got references to local symbols
Ulrich Weigand [Mon, 1 Jul 2013 18:19:56 +0000 (18:19 +0000)]
[PowerPC] Fix @got references to local symbols

A @got reference must always result in a relocation, so that
the linker has a chance to set up the GOT entry, even if the
symbol happens to be local.

Add a PPCELFObjectWriter::ExplicitRelSym routine that enforces
a relocation to be emitted for GOT references.

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

10 years ago[PowerPC] Add "wait" instruction
Ulrich Weigand [Mon, 1 Jul 2013 17:21:23 +0000 (17:21 +0000)]
[PowerPC] Add "wait" instruction

This adds the "wait" instruction and its extended mnemonics.

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

10 years ago[PowerPC] Support "eieio" instruction
Ulrich Weigand [Mon, 1 Jul 2013 17:06:26 +0000 (17:06 +0000)]
[PowerPC] Support "eieio" instruction

This adds support for the "eieio" instruction to
the asm parser.

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

10 years agoAdded c++ mode selector to head of SelectionDAGBuilder.h so editors open it in c...
Michael Gottesman [Mon, 1 Jul 2013 16:53:41 +0000 (16:53 +0000)]
Added c++ mode selector to head of SelectionDAGBuilder.h so editors open it in c++ mode instead of c mode.

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

10 years ago[PowerPC] Add some existing instructions to ppc64-encoding-bookII.s
Ulrich Weigand [Mon, 1 Jul 2013 16:52:55 +0000 (16:52 +0000)]
[PowerPC] Add some existing instructions to ppc64-encoding-bookII.s

The test case had a couple of FIXMEs where the instruction is in
fact already supported by the back-end.  In some other case, while
the generic form of the instruction is not yet supported, a
specialized form is.  This adds tests for those already supported
instructions / instruction forms.

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

10 years ago[PowerPC] Add variants of "sync" instruction
Ulrich Weigand [Mon, 1 Jul 2013 16:37:52 +0000 (16:37 +0000)]
[PowerPC] Add variants of "sync" instruction

This adds support for the "sync $L" instruction with operand,
and provides aliases for "lwsync" and "ptesync".

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

10 years agoARM: relax the atomic release barrier to "dmb ishst"
Tim Northover [Mon, 1 Jul 2013 14:48:48 +0000 (14:48 +0000)]
ARM: relax the atomic release barrier to "dmb ishst"

I believe the full "dmb ish" barrier is not required to guarantee release
semantics for atomic operations. The weaker "dmb ishst" prevents previous
operations being reordered with a store executed afterwards, which is enough.

A key point to note (fortunately already correct) is that this barrier alone is
*insufficient* for sequential consistency, no matter how liberally placed.

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

10 years ago[NVPTX] Add support for module-scope inline asm
Justin Holewinski [Mon, 1 Jul 2013 13:00:14 +0000 (13:00 +0000)]
[NVPTX] Add support for module-scope inline asm

Since we were explicitly not calling AsmPrinter::doInitialization,
any module-scope inline asm was not being printed.

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

10 years ago[NVPTX] We dont use NVBuiltin anymore
Justin Holewinski [Mon, 1 Jul 2013 12:59:08 +0000 (12:59 +0000)]
[NVPTX] We dont use NVBuiltin anymore

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

10 years ago[NVPTX] Cut down on physical register defs
Justin Holewinski [Mon, 1 Jul 2013 12:59:06 +0000 (12:59 +0000)]
[NVPTX] Cut down on physical register defs

We are using virtual registers throughout now, but we still need
to keep a few physical registers per class around to keep the
infrastructure happy.

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

10 years ago[NVPTX] 64-bit ADDC/ADDE are not legal
Justin Holewinski [Mon, 1 Jul 2013 12:59:04 +0000 (12:59 +0000)]
[NVPTX] 64-bit ADDC/ADDE are not legal

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

10 years ago[NVPTX] Fix vector loads from parameters that span multiple loads, and fix some typos
Justin Holewinski [Mon, 1 Jul 2013 12:59:01 +0000 (12:59 +0000)]
[NVPTX] Fix vector loads from parameters that span multiple loads, and fix some typos

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

10 years ago[NVPTX] Handle signext/zeroext attributes properly
Justin Holewinski [Mon, 1 Jul 2013 12:58:58 +0000 (12:58 +0000)]
[NVPTX] Handle signext/zeroext attributes properly

Fix a case where we were incorrectly sign-extending a value when we should have been zero-extending the value.

Also change some SIGN_EXTEND to ANY_EXTEND because we really dont care and may have more opportunity to fold subexpressions

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

10 years ago[NVPTX] Add support for native SIGN_EXTEND_INREG where available
Justin Holewinski [Mon, 1 Jul 2013 12:58:56 +0000 (12:58 +0000)]
[NVPTX] Add support for native SIGN_EXTEND_INREG where available

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

10 years ago[NVPTX] Add isel patterns for [reg+offset] form of ldg/ldu.
Justin Holewinski [Mon, 1 Jul 2013 12:58:52 +0000 (12:58 +0000)]
[NVPTX] Add isel patterns for [reg+offset] form of ldg/ldu.

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

10 years ago[NVPTX] Make sure we zero out high-order 24 bits for 8-bit load into 32-bit value
Justin Holewinski [Mon, 1 Jul 2013 12:58:48 +0000 (12:58 +0000)]
[NVPTX] Make sure we zero out high-order 24 bits for 8-bit load into 32-bit value

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

10 years agollvm-symbolizer: Recognize a drive letter on win32. Then "REQUIRES: shell" can be...
NAKAMURA Takumi [Mon, 1 Jul 2013 09:51:42 +0000 (09:51 +0000)]
llvm-symbolizer: Recognize a drive letter on win32. Then "REQUIRES: shell" can be removed.

FIXME: Could we use llvm::sys::Path here?

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

10 years agoAdded the test missed from r185080.
Serge Pavlov [Mon, 1 Jul 2013 09:02:33 +0000 (09:02 +0000)]
Added the test missed from r185080.

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

10 years agoThe build system is currently miss-identifying GNU/kFreeBSD as FreeBSD.
Sylvestre Ledru [Mon, 1 Jul 2013 08:07:52 +0000 (08:07 +0000)]
The build system is currently miss-identifying GNU/kFreeBSD as FreeBSD.
This kind of simplification is sometimes useful, but in general it's not correct.

As GNU/kFreeBSD is an hybrid system, for kernel-related issues we want to match the
build definitions used for FreeBSD, whereas for userland-related issues we want to
match the definitions used for other systems with Glibc.

The current modification adjusts the build system so that they can be distinguished,
and explicitly adds GNU/kFreeBSD to the build checks in which it belongs.

Fixes bug #16444.

Patch by Robert Millan in the context of Debian.

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

10 years agoLoopVectorize: Math functions only read rounding mode
Arnold Schwaighofer [Mon, 1 Jul 2013 00:54:44 +0000 (00:54 +0000)]
LoopVectorize: Math functions only read rounding mode

Math functions are mark as readonly because they read the floating point
rounding mode. Because we don't vectorize loops that would contain function
calls that set the rounding mode it is safe to ignore this memory read.

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

10 years agoR600: Fix an unitialized variable in R600InstrInfo.cpp
Vincent Lejeune [Sun, 30 Jun 2013 21:44:06 +0000 (21:44 +0000)]
R600: Fix an unitialized variable in R600InstrInfo.cpp

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

10 years agoX86: POP*rmm: move address operand to (ins) from (outs).
Ahmed Bougacha [Sun, 30 Jun 2013 20:44:50 +0000 (20:44 +0000)]
X86: POP*rmm: move address operand to (ins) from (outs).

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

10 years agoDeadArgumentElimination: keep return value on functions that have a live argument...
Stephen Lin [Sun, 30 Jun 2013 20:26:21 +0000 (20:26 +0000)]
DeadArgumentElimination: keep return value on functions that have a live argument with the 'returned' attribute (rather than generate invalid IR); however, if both can be eliminated, both will be

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

10 years agoConstantFold: Check that truncating the other side is safe under a sext when trying...
Benjamin Kramer [Sun, 30 Jun 2013 13:47:43 +0000 (13:47 +0000)]
ConstantFold: Check that truncating the other side is safe under a sext when trying to remove a sext from a compare.

Fixes PR16462.

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

10 years agoValueTracking: Teach isKnownToBeAPowerOfTwo about (ADD X, (XOR X, Y)) where X is...
David Majnemer [Sat, 29 Jun 2013 23:44:53 +0000 (23:44 +0000)]
ValueTracking: Teach isKnownToBeAPowerOfTwo about (ADD X, (XOR X, Y)) where X is a power of two

This allows us to simplify urem instructions involving the add+xor to
turn into simpler math.

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

10 years agoNVPTX: Fold otherwise unused variable into assert.
Benjamin Kramer [Sat, 29 Jun 2013 22:51:12 +0000 (22:51 +0000)]
NVPTX: Fold otherwise unused variable into assert.

Avoids unused variable warnings in release builds.

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

10 years agoInstCombine: Also turn selects fed by an and into arithmetic when the types don't...
Benjamin Kramer [Sat, 29 Jun 2013 21:17:04 +0000 (21:17 +0000)]
InstCombine: Also turn selects fed by an and into arithmetic when the types don't match.

Inserting a zext or trunc is sufficient. This pattern is somewhat common in
LLVM's pointer mangling code.

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

10 years agoR600: Unbreak GCC build.
Benjamin Kramer [Sat, 29 Jun 2013 20:04:19 +0000 (20:04 +0000)]
R600: Unbreak GCC build.

operator++ on an enum is not legal. clang happens to accept it anyways, I think
that's a known bug.

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

10 years agoR600: Support schedule and packetization of trans-only inst
Vincent Lejeune [Sat, 29 Jun 2013 19:32:43 +0000 (19:32 +0000)]
R600: Support schedule and packetization of trans-only inst

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

10 years agoR600: Bank Swizzle now display SCL equivalent
Vincent Lejeune [Sat, 29 Jun 2013 19:32:29 +0000 (19:32 +0000)]
R600: Bank Swizzle now display SCL equivalent

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

10 years agomisched: Compress pairs returned by getUnderlyingObjectsForInstr.
Benjamin Kramer [Sat, 29 Jun 2013 18:41:17 +0000 (18:41 +0000)]
misched: Compress pairs returned by getUnderlyingObjectsForInstr.

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

10 years agoLoopVectorizer: Pack MemAccessInfo pairs.
Benjamin Kramer [Sat, 29 Jun 2013 17:52:08 +0000 (17:52 +0000)]
LoopVectorizer: Pack MemAccessInfo pairs.

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

10 years agoMove helper classes into anonymous namespaces.
Benjamin Kramer [Sat, 29 Jun 2013 17:02:06 +0000 (17:02 +0000)]
Move helper classes into anonymous namespaces.

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

10 years agoInstCombine: FoldGEPICmp shouldn't change sign of base pointer comparison
David Majnemer [Sat, 29 Jun 2013 10:28:04 +0000 (10:28 +0000)]
InstCombine: FoldGEPICmp shouldn't change sign of base pointer comparison

Changing the sign when comparing the base pointer would introduce all
sorts of unexpected things like:
  %gep.i = getelementptr inbounds [1 x i8]* %a, i32 0, i32 0
  %gep2.i = getelementptr inbounds [1 x i8]* %b, i32 0, i32 0
  %cmp.i = icmp ult i8* %gep.i, %gep2.i
  %cmp.i1 = icmp ult [1 x i8]* %a, %b
  %cmp = icmp ne i1 %cmp.i, %cmp.i1
  ret i1 %cmp

into:
  %cmp.i = icmp slt [1 x i8]* %a, %b
  %cmp.i1 = icmp ult [1 x i8]* %a, %b
  %cmp = xor i1 %cmp.i, %cmp.i1
  ret i1 %cmp

By preserving the original sign, we now get:
  ret i1 false

This fixes PR16483.

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

10 years agoInstCombine: Small whitespace cleanup in FoldGEPICmp
David Majnemer [Sat, 29 Jun 2013 09:45:35 +0000 (09:45 +0000)]
InstCombine: Small whitespace cleanup in FoldGEPICmp

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

10 years agoInstCombine: Be more agressive optimizing 'udiv' instrs with 'select' denoms
David Majnemer [Sat, 29 Jun 2013 08:40:07 +0000 (08:40 +0000)]
InstCombine: Be more agressive optimizing 'udiv' instrs with 'select' denoms

Real world code sometimes has the denominator of a 'udiv' be a
'select'.  LLVM can handle such cases but only when the 'select'
operands are symmetric in structure (both select operands are a constant
power of two or a left shift, etc.).  This falls apart if we are dealt a
'udiv' where the code is not symetric or if the select operands lead us
to more select instructions.

Instead, we should treat the LHS and each select operand as a distinct
divide operation and try to optimize them independently.  If we can
to simplify each operation, then we can replace the 'udiv' with, say, a
'lshr' that has a new select with a bunch of new operands for the
select.

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

10 years agoWe preserve the CFG and some of the analysis passes.
Nadav Rotem [Sat, 29 Jun 2013 05:38:15 +0000 (05:38 +0000)]
We preserve the CFG and some of the analysis passes.

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

10 years agoUpdate docs.
Nadav Rotem [Sat, 29 Jun 2013 05:37:19 +0000 (05:37 +0000)]
Update docs.

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

10 years agoDebug Info: clean up usage of Verify.
Manman Ren [Sat, 29 Jun 2013 05:01:19 +0000 (05:01 +0000)]
Debug Info: clean up usage of Verify.

No functionality change.
It should suffice to check the type of a debug info metadata, instead of
calling Verify. For cases where we know the type of a DI metadata, use
assert.

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

10 years agoChange assert(0 && "text") to llvm_unreachable(0 && "text")
Richard Trieu [Fri, 28 Jun 2013 23:46:19 +0000 (23:46 +0000)]
Change assert(0 && "text") to llvm_unreachable(0 && "text")

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

10 years agoInstCombine: Optimize (1 << X) Pred CstP2 to X Pred Log2(CstP2)
David Majnemer [Fri, 28 Jun 2013 23:42:03 +0000 (23:42 +0000)]
InstCombine: Optimize (1 << X) Pred CstP2 to X Pred Log2(CstP2)

We may, after other optimizations, find ourselves with IR that looks
like:

  %shl = shl i32 1, %y
  %cmp = icmp ult i32 %shl, 32

Instead, we should just compare the shift count:

  %cmp = icmp ult i32 %y, 5

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

10 years agoextending the interface of Dependence slightly to support future work
Preston Briggs [Fri, 28 Jun 2013 23:34:23 +0000 (23:34 +0000)]
extending the interface of Dependence slightly to support future work

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

10 years agoFix copypaste error in test.
Matt Arsenault [Fri, 28 Jun 2013 23:24:10 +0000 (23:24 +0000)]
Fix copypaste error in test.

Thename says it's an i32*, but it was actually creating another i8*

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

10 years agoFix extra whitespace / formatting
Matt Arsenault [Fri, 28 Jun 2013 23:24:05 +0000 (23:24 +0000)]
Fix extra whitespace / formatting

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

10 years agoTry to unbreak Linux buildbots.
Jakob Stoklund Olesen [Fri, 28 Jun 2013 22:54:16 +0000 (22:54 +0000)]
Try to unbreak Linux buildbots.

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

10 years agoMinimize precision loss when computing cyclic probabilities.
Jakob Stoklund Olesen [Fri, 28 Jun 2013 22:40:43 +0000 (22:40 +0000)]
Minimize precision loss when computing cyclic probabilities.

Allow block frequencies to exceed 32 bits by using the new
BlockFrequency division function.

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

10 years agoPPC: Ignore spill/restore requests for VRSAVE (except on Darwin)
Hal Finkel [Fri, 28 Jun 2013 22:29:56 +0000 (22:29 +0000)]
PPC: Ignore spill/restore requests for VRSAVE (except on Darwin)

This fixes PR16418, which reports that a function calling
__builtin_unwind_init() asserts. The cause is that this generates a
spill/restore for VRSAVE, and we support that only on Darwin (because VRSAVE is
only really used on Darwin).

The test case checks only that we don't crash. We can add correctness checks
once someone verifies what behavior the function is supposed to have.

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

10 years agoReplace UNIXy path with os-independent one in DebugIR unit test
Daniel Malea [Fri, 28 Jun 2013 22:17:57 +0000 (22:17 +0000)]
Replace UNIXy path with os-independent one in DebugIR unit test
- should resolve windows buildbot failure

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

10 years agoSLP Vectorizer: Add support for trees with external users.
Nadav Rotem [Fri, 28 Jun 2013 22:07:09 +0000 (22:07 +0000)]
SLP Vectorizer:  Add support for trees with external users.

To support this we have to insert 'extractelement' instructions to pick the right lane.
We had this functionality before but I removed it when we moved to the multi-block design because it was too complicated.

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

10 years agoFix broken asserts that never fire.
Richard Trieu [Fri, 28 Jun 2013 21:54:25 +0000 (21:54 +0000)]
Fix broken asserts that never fire.

Change assert("text") to assert(0 && "text").  The first case is a const char *
to bool conversion, which always evaluates to true, never triggering the
assert.  The second case will always trigger the assert.

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

10 years agoFix a bad overflow check pointed out by Ben.
Jakob Stoklund Olesen [Fri, 28 Jun 2013 21:51:18 +0000 (21:51 +0000)]
Fix a bad overflow check pointed out by Ben.

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

10 years agoFix Windows/Darwin build error in DebugIR unit tests
Daniel Malea [Fri, 28 Jun 2013 21:49:53 +0000 (21:49 +0000)]
Fix Windows/Darwin build error in DebugIR unit tests
- mistakenly used get_current_dir() linux function
- replaced with getcwd/_getcwd as appropriate for current platform

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

10 years agoRevising the MCJIT ObjectCache interface to allow subclasses to avoid retaining refer...
Andrew Kaylor [Fri, 28 Jun 2013 21:40:16 +0000 (21:40 +0000)]
Revising the MCJIT ObjectCache interface to allow subclasses to avoid retaining references to returned objects

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

10 years agoRemove unused member
David Blaikie [Fri, 28 Jun 2013 21:28:01 +0000 (21:28 +0000)]
Remove unused member

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

10 years agoEliminate an assortment of undefined behavior.
Jakob Stoklund Olesen [Fri, 28 Jun 2013 21:10:25 +0000 (21:10 +0000)]
Eliminate an assortment of undefined behavior.

Hopefully, this fixes the PPC64 buildbots.

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

10 years agoLoopVectorizer: Refactor the code that checks if it is safe to predicate blocks.
Nadav Rotem [Fri, 28 Jun 2013 20:46:27 +0000 (20:46 +0000)]
LoopVectorizer:  Refactor the code that checks if it is safe to predicate blocks.
In this code we keep track of pointers that we are allowed to read from, if they are accessed by non-predicated blocks.
We use this list to allow vectorization of conditional loads in predicated blocks because we know that these addresses don't segfault.

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

10 years agoAdding tests for DebugIR pass
Daniel Malea [Fri, 28 Jun 2013 20:37:20 +0000 (20:37 +0000)]
Adding tests for DebugIR pass
- lit tests verify that each line of input LLVM IR gets a !dbg node and a
  corresponding entry of metadata that contains the line number
- unit tests verify that DebugIR works as advertised in the interface
- refactored some useful IR generation functionality from the MCJIT unit tests
  so it can be reused

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

10 years agoR600/SI: Add processor types for each CIK variant
Tom Stellard [Fri, 28 Jun 2013 20:23:29 +0000 (20:23 +0000)]
R600/SI: Add processor types for each CIK variant

Patch By: Alex Deucher

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185209 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFix CodeGen/PowerPC/stack-protector.ll on OpenBSD
Hal Finkel [Fri, 28 Jun 2013 20:18:14 +0000 (20:18 +0000)]
Fix CodeGen/PowerPC/stack-protector.ll on OpenBSD

On OpenBSD, the stack-smash protection transform uses "__guard_local"
and "__stack_smash_handler" instead of "__stack_chk_guard" and
"__stack_chk_fail".  However, CodeGen/PowerPC/stack-protector.ll
doesn't specify a target OS, so on OpenBSD it fails.

Add -mtriple=ppc32-unknown-linux to make the test host-OS agnostic. While
there, convert to FileCheck.

Patch by Matthew Dempsky.

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

10 years agoDebugInfo: PR14728: TLS support
David Blaikie [Fri, 28 Jun 2013 20:05:11 +0000 (20:05 +0000)]
DebugInfo: PR14728: TLS support

Based on GCC's output for TLS variables (OP_constNu, x@dtpoff,
OP_lo_user), this implements debug info support for TLS in ELF. Verified
that this output is correct/sufficient on Linux (using gold - if you're
using binutils-ld, you'll need something with the fix for
http://sourceware.org/bugzilla/show_bug.cgi?id=15685 in it).

Support on non-ELF is sort of "arbitrary" at the moment - if Apple folks
want to discuss (or just go ahead & implement) how this should work in
MachO, etc, I'm open.

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

10 years agoDebugInfo: Pass MCSymbolRefExprs for labels instead of MCSymbols
David Blaikie [Fri, 28 Jun 2013 20:05:04 +0000 (20:05 +0000)]
DebugInfo: Pass MCSymbolRefExprs for labels instead of MCSymbols

This is a precursor to adding debug info support for TLS which requires
non-default relocations applied to TLS symbols.

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

10 years agoFix a PPC rlwimi instruction-selection bug
Hal Finkel [Fri, 28 Jun 2013 20:00:07 +0000 (20:00 +0000)]
Fix a PPC rlwimi instruction-selection bug

Under certain (evidently rare) circumstances, this code used to convert OR(a,
AND(x, y)) into OR(a, x). This was incorrect.

While there, I've added a comment to the code immediately above.

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

10 years agoRemove needless include (unistd.h) in DebugIR pass
Daniel Malea [Fri, 28 Jun 2013 19:19:44 +0000 (19:19 +0000)]
Remove needless include (unistd.h) in DebugIR pass
- should unbreak Windows builds

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

10 years agoAdd flag to lli to enable debugging of IR when used with MCJIT.
Daniel Malea [Fri, 28 Jun 2013 19:11:40 +0000 (19:11 +0000)]
Add flag to lli to enable debugging of IR when used with MCJIT.
- warn users when -debug-ir is used with old JIT engine (only partial debug
  info is available)

For example, to debug an IR file with GDB (that supports JIT registration), do:

$ gdb --args lli -use-mcjit -debug-ir testcase.ll
(gdb) break main
(gdb) run
<Process continues to lli main>
(gdb) continue
<Process continues to testcase.ll main()
(gdb) step
<Now stepping through the LLVM IR in testcase.ll>

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

10 years agoAdd missing header for DebugIR
Daniel Malea [Fri, 28 Jun 2013 19:07:59 +0000 (19:07 +0000)]
Add missing header for DebugIR
- missed svn add...

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

10 years agoRemove limitation on DebugIR that made it require existing debug metadata.
Daniel Malea [Fri, 28 Jun 2013 19:05:23 +0000 (19:05 +0000)]
Remove limitation on DebugIR that made it require existing debug metadata.
- Build debug metadata for 'bare' Modules using DIBuilder
- DebugIR can be constructed to generate an IR file (to be seen by a debugger)
  or not in cases where the user already has an IR file on disk.

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

10 years agoFix an off-by-one error. Also make the code a little more explicit in what it
Chad Rosier [Fri, 28 Jun 2013 18:57:01 +0000 (18:57 +0000)]
Fix an off-by-one error.  Also make the code a little more explicit in what it
is trying to do.

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

10 years agoDebugInfo: Revise r185189 to avoid subtle 'unsigned += bool'
David Blaikie [Fri, 28 Jun 2013 18:55:13 +0000 (18:55 +0000)]
DebugInfo: Revise r185189 to avoid subtle 'unsigned += bool'

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

10 years agoDebugInfo: Simplify the AddressPool representation
David Blaikie [Fri, 28 Jun 2013 18:47:19 +0000 (18:47 +0000)]
DebugInfo: Simplify the AddressPool representation

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

10 years agoDebugInfo: constify the AddressPool MCSymbol pointers
David Blaikie [Fri, 28 Jun 2013 18:47:14 +0000 (18:47 +0000)]
DebugInfo: constify the AddressPool MCSymbol pointers

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

10 years agogit-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185187 91177308-0d34-0410...
Preston Briggs [Fri, 28 Jun 2013 18:44:48 +0000 (18:44 +0000)]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185187 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoAdd missing case to switch statement - DAGTypeLegalizer::ExpandIntegerResult
Lang Hames [Fri, 28 Jun 2013 18:36:42 +0000 (18:36 +0000)]
Add missing case to switch statement - DAGTypeLegalizer::ExpandIntegerResult
should expand ATOMIC_CMP_SWAP nodes the same way that it does for ATOMIC_SWAP.

Since ATOMIC_LOADs on some targets (e.g. older ARM variants) get legalized to
ATOMIC_CMP_SWAPs, the missing case had been causing i64 atomic loads to crash
during isel.

<rdar://problem/14074644>

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

10 years agoStylistic cleanups, no functional change.
Jakob Stoklund Olesen [Fri, 28 Jun 2013 18:33:19 +0000 (18:33 +0000)]
Stylistic cleanups, no functional change.

- Use static functions instead of anonymous namespace.
- Appease the Doxygen lobby.
- Use 0-based induction variable.

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

10 years agoAdd a division operator to BlockFrequency.
Jakob Stoklund Olesen [Fri, 28 Jun 2013 18:23:42 +0000 (18:23 +0000)]
Add a division operator to BlockFrequency.

Allow a BlockFrequency to be divided by a non-zero BranchProbability
with saturating arithmetic. This will be used to compute the frequency
of a loop header given the probability of leaving the loop.

Our long division algorithm already saturates on overflow, so that was a
freebie.

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

10 years agoRemove unused variables.
Eric Christopher [Fri, 28 Jun 2013 18:03:54 +0000 (18:03 +0000)]
Remove unused variables.

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

10 years ago[NVPTX] Select -1 instead of 1 when anyextend'ing i1 types
Justin Holewinski [Fri, 28 Jun 2013 17:58:15 +0000 (17:58 +0000)]
[NVPTX] Select -1 instead of 1 when anyextend'ing i1 types

This makes it more consistent with the ZeroOrNegativeOneBooleanContent flag

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

10 years ago[NVPTX] Add (1.0 / sqrt(x)) => rsqrt(x) generation when allowable by FP flags
Justin Holewinski [Fri, 28 Jun 2013 17:58:13 +0000 (17:58 +0000)]
[NVPTX] Add (1.0 / sqrt(x)) => rsqrt(x) generation when allowable by FP flags

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

10 years ago[NVPTX] Calling conventions fix
Justin Holewinski [Fri, 28 Jun 2013 17:58:10 +0000 (17:58 +0000)]
[NVPTX] Calling conventions fix

Fix ABI handling for function
returning bool -- use st.param.b32 to return the value
and use ld.param.b32 in caller to load the return value.

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

10 years ago[NVPTX] Add support for cttz/ctlz/ctpop
Justin Holewinski [Fri, 28 Jun 2013 17:58:07 +0000 (17:58 +0000)]
[NVPTX] Add support for cttz/ctlz/ctpop

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

10 years ago[NVPTX] Clean up comparison/select/convert patterns and factor out PTX instructions...
Justin Holewinski [Fri, 28 Jun 2013 17:58:04 +0000 (17:58 +0000)]
[NVPTX] Clean up comparison/select/convert patterns and factor out PTX instructions from their patterns

Test case is no breakage

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

10 years ago[NVPTX] Remove i8 register class. PTX support for i8 (.b8, .u8, .s8) is rather poor...
Justin Holewinski [Fri, 28 Jun 2013 17:57:59 +0000 (17:57 +0000)]
[NVPTX] Remove i8 register class.  PTX support for i8 (.b8, .u8, .s8) is rather poor and we're better off just ignoring it and letting LLVM expand all i8 ops out to i16.

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

10 years ago[NVPTX] Add support for vectorized function return values
Justin Holewinski [Fri, 28 Jun 2013 17:57:55 +0000 (17:57 +0000)]
[NVPTX] Add support for vectorized function return values

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

10 years ago[NVPTX] Clean up handling of formal arguments and enable generation of vector paramet...
Justin Holewinski [Fri, 28 Jun 2013 17:57:53 +0000 (17:57 +0000)]
[NVPTX] Clean up handling of formal arguments and enable generation of vector parameter loads

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

10 years ago[NVPTX] Add infrastructure for vector loads/stores of parameters
Justin Holewinski [Fri, 28 Jun 2013 17:57:51 +0000 (17:57 +0000)]
[NVPTX] Add infrastructure for vector loads/stores of parameters

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

10 years agoBug 13662: Enable GPRPair for all i64 operands of inline asm on ARM
Weiming Zhao [Fri, 28 Jun 2013 17:26:02 +0000 (17:26 +0000)]
Bug 13662: Enable GPRPair for all i64 operands of inline asm on ARM

This patch assigns paired GPRs  for inline asm with
64-bit data on ARM. It's enabled for both ARM and Thumb to support modifiers
like %H, %Q, %R.

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