oota-llvm.git
11 years agoAdd support for annotated disassembly output for X86 and arm.
Kevin Enderby [Mon, 22 Oct 2012 22:31:46 +0000 (22:31 +0000)]
Add support for annotated disassembly output for X86 and arm.

Per the October 12, 2012 Proposal for annotated disassembly output sent out by
Jim Grosbach this set of changes implements this for X86 and arm.  The llvm-mc
tool now has a -mdis option to produced the marked up disassembly and a couple
of small example test cases have been added.

rdar://11764962

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

11 years ago[ms-inline asm] Don't rewrite out parts of an inline-asm skipped by .if 0 and friends.
Eli Friedman [Mon, 22 Oct 2012 20:50:25 +0000 (20:50 +0000)]
[ms-inline asm] Don't rewrite out parts of an inline-asm skipped by .if 0 and friends.
It's unnecessary and makes the generated assembly less faithful to the original source.

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

11 years ago[ms-inline asm] Add the isOffsetOf() function.
Chad Rosier [Mon, 22 Oct 2012 19:50:35 +0000 (19:50 +0000)]
[ms-inline asm] Add the isOffsetOf() function.
Part of rdar://12470317

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

11 years agoIterating over a DenseMap<std::pair<BasicBlock*, unsigned>, PHINode*> is not
Julien Lerouge [Mon, 22 Oct 2012 19:43:56 +0000 (19:43 +0000)]
Iterating over a DenseMap<std::pair<BasicBlock*, unsigned>, PHINode*> is not
deterministic, replace it with a DenseMap<std::pair<unsigned, unsigned>,
PHINode*> (we already have a map from BasicBlock to unsigned).

<rdar://problem/12541389>

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

11 years ago[ms-inline asm] Add support for parsing the offset operator. Callback for
Chad Rosier [Mon, 22 Oct 2012 19:42:52 +0000 (19:42 +0000)]
[ms-inline asm] Add support for parsing the offset operator.  Callback for
CodeGen in the front-end not implemented yet.
rdar://12470317

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

11 years agoDon't crash if the load/store pointer is not a GEP.
Nadav Rotem [Mon, 22 Oct 2012 18:27:56 +0000 (18:27 +0000)]
Don't crash if the load/store pointer is not a GEP.

Fix by Shivarama Rao <Shivarama.Rao@amd.com>

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

11 years agoAdd a testcase for the previous commit.
Nadav Rotem [Mon, 22 Oct 2012 18:16:55 +0000 (18:16 +0000)]
Add a testcase for the previous commit.

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

11 years agoRevert r166407 because it caused analyzer tests to crash and broke self-host bots.
Argyrios Kyrtzidis [Mon, 22 Oct 2012 18:16:14 +0000 (18:16 +0000)]
Revert r166407 because it caused analyzer tests to crash and broke self-host bots.

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

11 years agoBBVectorize should ignore unreachable blocks.
Hal Finkel [Mon, 22 Oct 2012 18:00:55 +0000 (18:00 +0000)]
BBVectorize should ignore unreachable blocks.

Unreachable blocks can have invalid instructions. For example,
jump threading can produce self-referential instructions in
unreachable blocks. Also, we should not be spending time
optimizing unreachable code. Fixes PR14133.

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

11 years agoAdd the "ForceSizeOpt" attribute.
Nadav Rotem [Mon, 22 Oct 2012 17:33:31 +0000 (17:33 +0000)]
Add the "ForceSizeOpt" attribute.

Patch by Quentin Colombet <qcolombet@apple.com>

Original description:
"""
The attached patch is the first step to have a better control on Oz related optimizations.
The Oz optimization level focuses on code size, thus I propose to add an attribute called ForceSizeOpt.
"""

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

11 years agoRename a variable.
Nadav Rotem [Mon, 22 Oct 2012 04:53:05 +0000 (04:53 +0000)]
Rename a variable.

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

11 years agoVectorizer: optimize the generation of selects. If the condition is uniform, generate...
Nadav Rotem [Mon, 22 Oct 2012 04:38:00 +0000 (04:38 +0000)]
Vectorizer: optimize the generation of selects. If the condition is uniform, generate a scalar-cond select (i1 as selector).

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

11 years agoUpdate the loop vectorizer docs.
Nadav Rotem [Mon, 22 Oct 2012 03:52:53 +0000 (03:52 +0000)]
Update the loop vectorizer docs.

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

11 years agoReapply r166405, teaching tailcallelim to be smarter about nocapture, with a
Nick Lewycky [Mon, 22 Oct 2012 03:03:52 +0000 (03:03 +0000)]
Reapply r166405, teaching tailcallelim to be smarter about nocapture, with a
very small but very important bugfix:
  bool shouldExplore(Use *U) {
    Value *V = U->get();
    if (isa<CallInst>(V) || isa<InvokeInst>(V))
    [...]
should have read:
  bool shouldExplore(Use *U) {
    Value *V = U->getUser();
    if (isa<CallInst>(V) || isa<InvokeInst>(V))
Fixes PR14143!

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

11 years agoRevert r166405, "Teach TailRecursionElimination to consider 'nocapture' when deciding...
NAKAMURA Takumi [Mon, 22 Oct 2012 00:48:51 +0000 (00:48 +0000)]
Revert r166405, "Teach TailRecursionElimination to consider 'nocapture' when deciding whether"

It broke selfhosting stage2 in several builders.

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

11 years agoTeach TailRecursionElimination to consider 'nocapture' when deciding whether
Nick Lewycky [Sun, 21 Oct 2012 23:51:22 +0000 (23:51 +0000)]
Teach TailRecursionElimination to consider 'nocapture' when deciding whether
calls can be marked tail.

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

11 years agoDataLayout should use itself when calculating the size of a vector.
Hal Finkel [Sun, 21 Oct 2012 20:38:03 +0000 (20:38 +0000)]
DataLayout should use itself when calculating the size of a vector.

This is important for vectors of pointers because only DataLayout,
not the underlying vector type, knows how to calculate the size
of the pointers in the vector. Fixes PR14138.

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

11 years agoRevert r166390 "LoopIdiom: Replace custom dependence analysis with LoopDependenceAnal...
Benjamin Kramer [Sun, 21 Oct 2012 19:31:16 +0000 (19:31 +0000)]
Revert r166390 "LoopIdiom: Replace custom dependence analysis with LoopDependenceAnalysis."

It passes all tests, produces better results than the old code but uses the
wrong pass, LoopDependenceAnalysis, which is old and unmaintained. "Why is it
still in tree?", you might ask. The answer is obviously: "To confuse developers."

Just swapping in the new dependency pass sends the pass manager into an infinte
loop, I'll try to figure out why tomorrow.

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

11 years agoDon't crash when the Assignments vector is empty.
Jakob Stoklund Olesen [Sun, 21 Oct 2012 19:05:03 +0000 (19:05 +0000)]
Don't crash when the Assignments vector is empty.

Reported by Vincent Lejeune using an out-of-tree target.

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

11 years agoAvoid an extra hash lookup when inserting a value into the widen map.
Anders Carlsson [Sun, 21 Oct 2012 16:26:35 +0000 (16:26 +0000)]
Avoid an extra hash lookup when inserting a value into the widen map.

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

11 years agoSimplify code. No functionality change.
Jakub Staszak [Sun, 21 Oct 2012 15:36:03 +0000 (15:36 +0000)]
Simplify code. No functionality change.

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

11 years agoSimplify code. No functionality change.
Jakub Staszak [Sun, 21 Oct 2012 15:29:19 +0000 (15:29 +0000)]
Simplify code. No functionality change.

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

11 years agoLoopIdiom: Replace custom dependence analysis with LoopDependenceAnalysis.
Benjamin Kramer [Sun, 21 Oct 2012 15:03:07 +0000 (15:03 +0000)]
LoopIdiom: Replace custom dependence analysis with LoopDependenceAnalysis.

Requires a lot less code and complexity on loop-idiom's side and the more
precise analysis can catch more cases, like the one I included as a test case.
This also fixes the edge-case miscompilation from PR9481. I'm not entirely
sure that all cases are handled that the old checks handled but LDA will
certainly become smarter in the future.

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

11 years agoFix a bug in the vectorization of wide load/store operations.
Nadav Rotem [Sun, 21 Oct 2012 06:49:10 +0000 (06:49 +0000)]
Fix a bug in the vectorization of wide load/store operations.
We used a SCEV to detect that A[X] is consecutive. We assumed that X was
the induction variable. But X can be any expression that uses the induction
for example: X = i + 2;

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

11 years agoAdd support for reduction variables that do not start at zero.
Nadav Rotem [Sun, 21 Oct 2012 05:52:51 +0000 (05:52 +0000)]
Add support for reduction variables that do not start at zero.
This is important for nested-loop reductions such as :

In the innermost loop, the induction variable does not start with zero:

for (i = 0 .. n)
 for (j = 0 .. m)
  sum += ...

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

11 years agoDocument change. Describe the pass and some papers that inspired the design of the...
Nadav Rotem [Sun, 21 Oct 2012 04:04:25 +0000 (04:04 +0000)]
Document change. Describe the pass and some papers that inspired the design of the pass.

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

11 years agoVectorizer: fix a bug in the classification of induction/reduction phis.
Nadav Rotem [Sun, 21 Oct 2012 02:38:01 +0000 (02:38 +0000)]
Vectorizer: fix a bug in the classification of induction/reduction phis.

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

11 years agoAllow the commuted form of tied-operand constraints in tablegen ("$dst = $src",
Lang Hames [Sat, 20 Oct 2012 22:44:13 +0000 (22:44 +0000)]
Allow the commuted form of tied-operand constraints in tablegen ("$dst = $src",
rather than "$src = $dst").

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

11 years agoFix an infinite loop in the loop-vectorizer.
Nadav Rotem [Sat, 20 Oct 2012 20:45:01 +0000 (20:45 +0000)]
Fix an infinite loop in the loop-vectorizer.

PR14134.

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

11 years agoDocument current Doxygen use practices in Coding Standards. Mostly it is
Dmitri Gribenko [Sat, 20 Oct 2012 13:27:43 +0000 (13:27 +0000)]
Document current Doxygen use practices in Coding Standards.  Mostly it is
obvious stuff and most new code being committed conforms to that.  Some old
code does not; this might cause confusion and this is the motivation to
document the correct guidelines.

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

11 years agoSymbol hygiene: Make sure declarations and definitions match, make helper functions...
Benjamin Kramer [Sat, 20 Oct 2012 12:53:26 +0000 (12:53 +0000)]
Symbol hygiene: Make sure declarations and definitions match, make helper functions static.

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

11 years agoSROA: Simplify code. No functionality change.
Benjamin Kramer [Sat, 20 Oct 2012 12:04:57 +0000 (12:04 +0000)]
SROA: Simplify code. No functionality change.

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

11 years agoInstCombine: Fix an edge case where constant icmps could sneak into ConstantFoldInstO...
Benjamin Kramer [Sat, 20 Oct 2012 08:43:52 +0000 (08:43 +0000)]
InstCombine: Fix an edge case where constant icmps could sneak into ConstantFoldInstOperands and crash.

Have to refactor the ConstantFolder interface one day to define bugs like this away. Fixes PR14131.

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

11 years agoVectorize: teach cavVectorizeMemory to distinguish between A[i]+=x and A[B[i]]+=x.
Nadav Rotem [Sat, 20 Oct 2012 08:26:33 +0000 (08:26 +0000)]
Vectorize: teach cavVectorizeMemory to distinguish between A[i]+=x and A[B[i]]+=x.
If the pointer is consecutive then it is safe to read and write. If the pointer is non-loop-consecutive then
it is unsafe to vectorize it because we may hit an ordering issue.

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

11 years agoFix a typo
Nadav Rotem [Sat, 20 Oct 2012 05:03:27 +0000 (05:03 +0000)]
Fix a typo

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

11 years agoVectorizer: refactor the memory checks to a new function. No functionality change.
Nadav Rotem [Sat, 20 Oct 2012 04:59:06 +0000 (04:59 +0000)]
Vectorizer: refactor the memory checks to a new function. No functionality change.

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

11 years agoVectorization docs.
Nadav Rotem [Sat, 20 Oct 2012 02:34:34 +0000 (02:34 +0000)]
Vectorization docs.

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

11 years ago[ms-inline asm] Rename AsmOpRewrite to just AsmRewrite to be more generic. No functio...
Chad Rosier [Sat, 20 Oct 2012 01:02:45 +0000 (01:02 +0000)]
[ms-inline asm] Rename AsmOpRewrite to just AsmRewrite to be more generic. No functional change intended.

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

11 years ago[ms-inline asm] If the state of the parser is ignore, then don't parse the
Chad Rosier [Sat, 20 Oct 2012 00:47:08 +0000 (00:47 +0000)]
[ms-inline asm] If the state of the parser is ignore, then don't parse the
inline assembly.  Also make sure the remove the ignored statements from the IR.

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

11 years agoLoopVectorize: Keep the IRBuilder on the stack.
Nadav Rotem [Fri, 19 Oct 2012 23:27:19 +0000 (23:27 +0000)]
LoopVectorize: Keep the IRBuilder on the stack.

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

11 years ago[ms-inline asm] Continue parsing even when we're in an ignore block.
Chad Rosier [Fri, 19 Oct 2012 23:15:00 +0000 (23:15 +0000)]
[ms-inline asm] Continue parsing even when we're in an ignore block.

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

11 years agoVectorizer: Add support for loop reductions.
Nadav Rotem [Fri, 19 Oct 2012 23:05:40 +0000 (23:05 +0000)]
Vectorizer: Add support for loop reductions.

For example:

  for (i=0; i<n; i++)
   sum += A[i] +  B[i] + i;

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

11 years ago1. Remove noreturn attribute from __builtin_debugtrap().
Shuxin Yang [Fri, 19 Oct 2012 23:00:20 +0000 (23:00 +0000)]
1. Remove noreturn attribute from __builtin_debugtrap().
  (The change at Clang side was committed in r166345)

2. Cosmetic change in order to conform to coding standards.

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

11 years ago[ms-inline asm] Reset the opcode prior to parsing a statement.
Chad Rosier [Fri, 19 Oct 2012 22:57:33 +0000 (22:57 +0000)]
[ms-inline asm] Reset the opcode prior to parsing a statement.

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

11 years ago[mips] Use 64-bit registers to return an sret pointer if target ABI is N64.
Akira Hatanaka [Fri, 19 Oct 2012 22:11:40 +0000 (22:11 +0000)]
[mips] Use 64-bit registers to return an sret pointer if target ABI is N64.

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

11 years agoGrammar-o.
Eric Christopher [Fri, 19 Oct 2012 22:10:54 +0000 (22:10 +0000)]
Grammar-o.

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

11 years ago[mips] Add code to do tail call optimization.
Akira Hatanaka [Fri, 19 Oct 2012 21:47:33 +0000 (21:47 +0000)]
[mips] Add code to do tail call optimization.

Currently, it is enabled only if option "enable-mips-tail-calls" is given and
all of the callee's arguments are passed in registers.

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

11 years ago[mips] Fix TAILCALL's operand node type.
Akira Hatanaka [Fri, 19 Oct 2012 21:30:15 +0000 (21:30 +0000)]
[mips] Fix TAILCALL's operand node type.

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

11 years agorevert r166264 because the LTO build is still failing
Nadav Rotem [Fri, 19 Oct 2012 21:28:43 +0000 (21:28 +0000)]
revert r166264 because the LTO build is still failing

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

11 years ago[mips] Delete MipsFunctionInfo::MaxCallFrameSize which is no longer used.
Akira Hatanaka [Fri, 19 Oct 2012 21:18:38 +0000 (21:18 +0000)]
[mips] Delete MipsFunctionInfo::MaxCallFrameSize which is no longer used.

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

11 years ago[mips] Add tail call instructions.
Akira Hatanaka [Fri, 19 Oct 2012 21:14:34 +0000 (21:14 +0000)]
[mips] Add tail call instructions.

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

11 years ago[mips] Make the branch nodes used in jump instructions a template parameter.
Akira Hatanaka [Fri, 19 Oct 2012 21:11:03 +0000 (21:11 +0000)]
[mips] Make the branch nodes used in jump instructions a template parameter.

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

11 years agoAdd node and enum for mips tail call.
Akira Hatanaka [Fri, 19 Oct 2012 20:59:39 +0000 (20:59 +0000)]
Add node and enum for mips tail call.

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

11 years ago[ms-inline asm] Have the TargetParser callback to Sema to determine the size of
Chad Rosier [Fri, 19 Oct 2012 20:57:14 +0000 (20:57 +0000)]
[ms-inline asm] Have the TargetParser callback to Sema to determine the size of
a memory operand.  Retain this information and then add the sizing directives
to the IR.  This allows the backend to do proper instruction selection.

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

11 years agoAdd 'IntrNoReturn' for longjmp intrinsics
Michael Liao [Fri, 19 Oct 2012 20:43:54 +0000 (20:43 +0000)]
Add 'IntrNoReturn' for longjmp intrinsics

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

11 years agoSimplifyLibcalls: The return value of ffsll is always i32, even when the input is...
Benjamin Kramer [Fri, 19 Oct 2012 20:43:44 +0000 (20:43 +0000)]
SimplifyLibcalls: The return value of ffsll is always i32, even when the input is zero.

Fixes PR13028.

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

11 years agoFix a build error for ocaml bindings that was introduced with the TargetData -->...
Micah Villmow [Fri, 19 Oct 2012 20:36:22 +0000 (20:36 +0000)]
Fix a build error for ocaml bindings that was introduced with the TargetData --> DataLayout changes.

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

11 years ago[ms-inline asm] Add a MCAsmParserSemaCallback to the TargetAsmParser.
Chad Rosier [Fri, 19 Oct 2012 20:35:42 +0000 (20:35 +0000)]
[ms-inline asm] Add a MCAsmParserSemaCallback to the TargetAsmParser.

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

11 years agolit: Rename the valgrind leaks feature to match what is currently used
Daniel Dunbar [Fri, 19 Oct 2012 20:29:30 +0000 (20:29 +0000)]
lit: Rename the valgrind leaks feature to match what is currently used
(vg_leak).

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

11 years agolit: Remove support for XTARGET.
Daniel Dunbar [Fri, 19 Oct 2012 20:29:27 +0000 (20:29 +0000)]
lit: Remove support for XTARGET.

 - The XTARGET feature (inherited from old DG tests) was just confusing (and
   barely ever used). The same effect can now be achieved with a combination of
   the more useful REQUIRES and XFAIL.

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

11 years agolit: Add 'valgrind' and 'valgrind-leaks' features when valgrind is used.
Daniel Dunbar [Fri, 19 Oct 2012 20:12:00 +0000 (20:12 +0000)]
lit: Add 'valgrind' and 'valgrind-leaks' features when valgrind is used.
 - These can be used with the XFAIL options.

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

11 years agotests: Stop mangling '-vg' into the triple, we don't use this currently.
Daniel Dunbar [Fri, 19 Oct 2012 20:11:56 +0000 (20:11 +0000)]
tests: Stop mangling '-vg' into the triple, we don't use this currently.
 - Also, lit is going to get a valgrind feature, instead.

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

11 years agoThis patch is to fix radar://8426430. It is about llvm support of __builtin_debugtrap()
Shuxin Yang [Fri, 19 Oct 2012 20:11:16 +0000 (20:11 +0000)]
This patch is to fix radar://8426430. It is about llvm support of __builtin_debugtrap()
which is supposed to consistently raise SIGTRAP across all systems. In contrast,
__builtin_trap() behave differently on different systems. e.g. it raises SIGTRAP on ARM, and
SIGILL on X86. The purpose of __builtin_debugtrap() is to consistently provide "trap"
functionality, in the mean time preserve the compatibility with on gcc on __builtin_trap().

  The X86 backend is already able to handle debugtrap(). This patch is to:
  1) make front-end recognize "__builtin_debugtrap()" (emboddied in the one-line change to Clang).
  2) In DAG legalization phase, by default, "debugtrap" will be replaced with "trap", which
     make the __builtin_debugtrap() "available" to all existing ports without the hassle of
     changing their code.
  3) If trap-function is specified (via -trap-func=xyz to llc), both __builtin_debugtrap() and
     __builtin_trap() will be expanded into the function call of the specified trap function.
    This behavior may need change in the future.

  The provided testing-case is to make sure 2) and 3) are working for ARM port, and we
already have a testing case for x86.

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

11 years ago[ms-inline asm] Add the isParsingInlineAsm() function to the MCAsmTargetParser.
Chad Rosier [Fri, 19 Oct 2012 17:57:49 +0000 (17:57 +0000)]
[ms-inline asm] Add the isParsingInlineAsm() function to the MCAsmTargetParser.

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

11 years agoIndvars: Don't recursively delete instruction during BB iteration.
Benjamin Kramer [Fri, 19 Oct 2012 17:53:54 +0000 (17:53 +0000)]
Indvars: Don't recursively delete instruction during BB iteration.

This can invalidate the iterators leading to use after frees and crashes.
Fixes PR12536.

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

11 years agoFix some doc-os.
Daniel Dunbar [Fri, 19 Oct 2012 17:23:39 +0000 (17:23 +0000)]
Fix some doc-os.

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

11 years agolit: Propagate TERM variable in environment, some tools can do really obscure
Daniel Dunbar [Fri, 19 Oct 2012 17:23:34 +0000 (17:23 +0000)]
lit: Propagate TERM variable in environment, some tools can do really obscure
odd things if this is missing.

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

11 years agoLower BUILD_VECTOR to SHUFFLE + INSERT_VECTOR_ELT for X86
Michael Liao [Fri, 19 Oct 2012 17:15:18 +0000 (17:15 +0000)]
Lower BUILD_VECTOR to SHUFFLE + INSERT_VECTOR_ELT for X86

- If INSERT_VECTOR_ELT is supported (above SSE2, either by custom
  sequence of legal insn), transform BUILD_VECTOR into SHUFFLE +
  INSERT_VECTOR_ELT if most of elements could be built from SHUFFLE with few
  (so far 1) elements being inserted.

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

11 years agoSCEVExpander: Don't crash when trying to merge two constant phis.
Benjamin Kramer [Fri, 19 Oct 2012 16:37:30 +0000 (16:37 +0000)]
SCEVExpander: Don't crash when trying to merge two constant phis.

Just constant fold them so they can't cause any trouble. Fixes PR12627.

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

11 years ago[ASan] Support comments in ASan/TSan blacklist file as lines starting with #
Alexey Samsonov [Fri, 19 Oct 2012 15:24:46 +0000 (15:24 +0000)]
[ASan] Support comments in ASan/TSan blacklist file as lines starting with #

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

11 years agoMove SplitBlockAndInsertIfThen to BasicBlockUtils.
Evgeniy Stepanov [Fri, 19 Oct 2012 10:48:31 +0000 (10:48 +0000)]
Move SplitBlockAndInsertIfThen to BasicBlockUtils.

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

11 years agoLoopVectorize: Keep the IRBuilder on the stack.
Benjamin Kramer [Fri, 19 Oct 2012 08:42:02 +0000 (08:42 +0000)]
LoopVectorize: Keep the IRBuilder on the stack.

No functionality change.

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

11 years agoARM:
Stepan Dyatkovskiy [Fri, 19 Oct 2012 08:23:06 +0000 (08:23 +0000)]
ARM:
Removed extra stack frame object for fixed byval arguments,
VarArgsStyleRegisters invocation was reworked due to some improper usage in
past. PR14099 also demonstrates it.

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

11 years agoPacify -Wnon-virtual-dtor.
Nick Lewycky [Fri, 19 Oct 2012 07:00:09 +0000 (07:00 +0000)]
Pacify -Wnon-virtual-dtor.

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

11 years ago[asan] make sure asan erases old unused allocas after it created a new one. This...
Kostya Serebryany [Fri, 19 Oct 2012 06:20:53 +0000 (06:20 +0000)]
[asan] make sure asan erases old unused allocas after it created a new one. This became important after the recent move from ModulePass to FunctionPass because no cleanup is happening after asan pass any more.

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

11 years agorecommit the patch that makes LSR and LowerInvoke use the TargetTransform interface.
Nadav Rotem [Fri, 19 Oct 2012 04:27:49 +0000 (04:27 +0000)]
recommit the patch that makes LSR and LowerInvoke use the TargetTransform interface.

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

11 years agoSimplify condition checking as CONCAT assume all inputs of the same type.
Michael Liao [Fri, 19 Oct 2012 03:17:00 +0000 (03:17 +0000)]
Simplify condition checking as CONCAT assume all inputs of the same type.

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

11 years agovectorizer: Add support for reading and writing from the same memory location.
Nadav Rotem [Fri, 19 Oct 2012 01:24:18 +0000 (01:24 +0000)]
vectorizer: Add support for reading and writing from the same memory location.

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

11 years agoReapply the TargerTransformInfo changes, minus the changes to LSR and Lowerinvoke.
Nadav Rotem [Thu, 18 Oct 2012 23:22:48 +0000 (23:22 +0000)]
Reapply the TargerTransformInfo changes, minus the changes to LSR and Lowerinvoke.

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

11 years agocleanup the comment.
Nadav Rotem [Thu, 18 Oct 2012 23:21:01 +0000 (23:21 +0000)]
cleanup the comment.

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

11 years agoFix case for include of Compiler.h.
Jordan Rose [Thu, 18 Oct 2012 22:36:01 +0000 (22:36 +0000)]
Fix case for include of Compiler.h.

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

11 years agoAdd move constructors for OwningPtr and OwningArrayPtr.
Jordan Rose [Thu, 18 Oct 2012 22:22:58 +0000 (22:22 +0000)]
Add move constructors for OwningPtr and OwningArrayPtr.

While LLVM itself is still C++03, there's no reason why tools built on
top of it can't use C++11 features.

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

11 years agoAdd a T&& constructor to llvm::Optional.
Jordan Rose [Thu, 18 Oct 2012 22:22:55 +0000 (22:22 +0000)]
Add a T&& constructor to llvm::Optional.

This allows llvm::Optional to be used with movable-but-not-copyable types.
While LLVM itself is still C++03, there's no reason why tools built on
top of it can't use C++11 features.

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

11 years agoMark bugpoint tests with XFAIL when building with LTO. <rdar://problem/12473675>
Bob Wilson [Thu, 18 Oct 2012 22:03:31 +0000 (22:03 +0000)]
Mark bugpoint tests with XFAIL when building with LTO. <rdar://problem/12473675>

The LTO Internalize pass is hiding symbols needed by the bugpoint-passes
plug-in.  We need to add a flag to control whether Internalize should be run.
This is a temporary workaround to make these tests pass in the meantime.

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

11 years agoFix a bug where a 32-bit address with the high bit does not get symbolicated
Kevin Enderby [Thu, 18 Oct 2012 21:49:18 +0000 (21:49 +0000)]
Fix a bug where a 32-bit address with the high bit does not get symbolicated
because the value is incorrectly being signed extended when passed to
SymbolLookUp().

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

11 years agofix a naming typo
Nadav Rotem [Thu, 18 Oct 2012 21:45:31 +0000 (21:45 +0000)]
fix a naming typo

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

11 years agotest: Add a lit config variable to check if LTO is enabled.
Daniel Dunbar [Thu, 18 Oct 2012 20:43:11 +0000 (20:43 +0000)]
test: Add a lit config variable to check if LTO is enabled.

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

11 years agolit: Allow XFAIL: lines to also refer to "features".
Daniel Dunbar [Thu, 18 Oct 2012 20:43:04 +0000 (20:43 +0000)]
lit: Allow XFAIL: lines to also refer to "features".

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

11 years ago[ms-inline asm] Add a size argument to the LookupInlineAsmIdentifier() callback,
Chad Rosier [Thu, 18 Oct 2012 20:27:15 +0000 (20:27 +0000)]
[ms-inline asm] Add a size argument to the LookupInlineAsmIdentifier() callback,
which will be used by the asm matcher in the near future.

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

11 years agoUse an export list when building JIT unittests. <rdar://problem/12473675>
Bob Wilson [Thu, 18 Oct 2012 20:25:36 +0000 (20:25 +0000)]
Use an export list when building JIT unittests. <rdar://problem/12473675>

When building with LTO, the internalize pass is hiding some global symbols
that are necessary for the JIT unittests. It seems like that may be a bug in
LTO to do that by default, but until that gets fixed, this change makes sure
that we export the necessary symbols for the tests to pass.

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

11 years agoUse pre-python 2.5 syntax in lit.cfg.
Sebastian Pop [Thu, 18 Oct 2012 19:58:28 +0000 (19:58 +0000)]
Use pre-python 2.5 syntax in lit.cfg.

Author:    Quentin Neill <qneill@codeaurora.org>

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

11 years agoClear unknown mem ops when merging stack slots (pr14090)
Sebastian Pop [Thu, 18 Oct 2012 19:53:48 +0000 (19:53 +0000)]
Clear unknown mem ops when merging stack slots (pr14090)

When merging stack slots, if StackColoring::remapInstructions gets a
value back from GetUnderlyingObject that it does not know about or is
not itself a stack slot, clear the memory operand in case it aliases
the merged slot. This prevents the introduction of incorrect aliasing
information.

Author:    Matthew Curtis <mcurtis@codeaurora.org>

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

11 years agoChange MachineFrameInfo::StackObject::Alloca from Value* to AllocaInst*
Sebastian Pop [Thu, 18 Oct 2012 19:53:45 +0000 (19:53 +0000)]
Change MachineFrameInfo::StackObject::Alloca from Value* to AllocaInst*

This more accurately reflects what is actually being stored in the
field.

No functionality change intended.

Author:    Matthew Curtis <mcurtis@codeaurora.org>

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

11 years ago[ms-inline asm] Have the LookupInlineAsmIdentifier() callback function return a
Chad Rosier [Thu, 18 Oct 2012 19:39:30 +0000 (19:39 +0000)]
[ms-inline asm] Have the LookupInlineAsmIdentifier() callback function return a
*NamedDecl.  In turn, build the expressions after we're finished parsing the
asm.  This avoids a crasher if the lookup fails.

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

11 years agoRevert "We need this symbol after an LTO build."
Bob Wilson [Thu, 18 Oct 2012 18:52:54 +0000 (18:52 +0000)]
Revert "We need this symbol after an LTO build."

This reverts commit 165776.  The plug-in uses this symbol; it does not
define it.  It needs to be exported from bugpoint itself, not from the plug-in.

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

11 years agoAvoid reconstructing the pointer set when searching for duplicated read/write pointers.
Nadav Rotem [Thu, 18 Oct 2012 18:34:50 +0000 (18:34 +0000)]
Avoid reconstructing the pointer set when searching for duplicated read/write pointers.

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

11 years agoUpdate the LangRef documentation for the per pointer address space support.
Micah Villmow [Thu, 18 Oct 2012 18:18:17 +0000 (18:18 +0000)]
Update the LangRef documentation for the per pointer address space support.

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

11 years agoCosmetic change -- move two simplifiers to the right commented statement group.
Meador Inge [Thu, 18 Oct 2012 18:12:43 +0000 (18:12 +0000)]
Cosmetic change -- move two simplifiers to the right commented statement group.

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

11 years agoinstcombine: Migrate strcpy optimizations
Meador Inge [Thu, 18 Oct 2012 18:12:40 +0000 (18:12 +0000)]
instcombine: Migrate strcpy optimizations

This patch migrates the strcpy optimizations from the simplify-libcalls pass
into the instcombine library call simplifier.  Note also that StrCpyChkOpt
has been updated with a few simplifications that were being done in the
simplify-libcalls version of StrCpyOpt, but not in the migrated implementation
of StrCpyOpt.  There is no reason to overload StrCpyOpt with fortified and
regular simplifications in the new model since there is already a dedicated
simplifier for __strcpy_chk.

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

11 years agotest commit: verifying access from new address
Eli Bendersky [Thu, 18 Oct 2012 18:12:05 +0000 (18:12 +0000)]
test commit: verifying access from new address

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