Commit Graph

57044 Commits

Author SHA1 Message Date
Eli Friedman
8ee16c7b66 [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
2012-10-22 20:50:25 +00:00
Chad Rosier
a703fb9e5e [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
2012-10-22 19:50:35 +00:00
Julien Lerouge
6a02bbcdae 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
2012-10-22 19:43:56 +00:00
Chad Rosier
65c88929e7 [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
2012-10-22 19:42:52 +00:00
Nadav Rotem
782090aa02 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
2012-10-22 18:27:56 +00:00
Argyrios Kyrtzidis
0b06e2331e 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
2012-10-22 18:16:14 +00:00
Hal Finkel
e29c19091c 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
2012-10-22 18:00:55 +00:00
Nadav Rotem
e743942bc8 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
2012-10-22 17:33:31 +00:00
Nadav Rotem
5f7d810223 Rename a variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166410 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-22 04:53:05 +00:00
Nadav Rotem
565048e78a 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
2012-10-22 04:38:00 +00:00
Nadav Rotem
e0fa403e23 Update the loop vectorizer docs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166408 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-22 03:52:53 +00:00
Nick Lewycky
18b1f4e769 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
2012-10-22 03:03:52 +00:00
NAKAMURA Takumi
d581b9e61f 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
2012-10-22 00:48:51 +00:00
Nick Lewycky
241d1398e0 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
2012-10-21 23:51:22 +00:00
Hal Finkel
3d39fb8a3f 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
2012-10-21 20:38:03 +00:00
Benjamin Kramer
3740e798bc 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
2012-10-21 19:31:16 +00:00
Jakob Stoklund Olesen
56acf63e35 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
2012-10-21 19:05:03 +00:00
Anders Carlsson
5bb5a75b1e 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
2012-10-21 16:26:35 +00:00
Jakub Staszak
ffe5008fd3 Simplify code. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166393 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-21 15:36:03 +00:00
Jakub Staszak
b75209cb66 Simplify code. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166392 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-21 15:29:19 +00:00
Benjamin Kramer
5c6e9ae14e 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
2012-10-21 15:03:07 +00:00
Nadav Rotem
bb950854ac 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
2012-10-21 06:49:10 +00:00
Nadav Rotem
c847872629 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
2012-10-21 05:52:51 +00:00
Nadav Rotem
f01cad69c1 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
2012-10-21 04:04:25 +00:00
Nadav Rotem
5a418ba5f5 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
2012-10-21 02:38:01 +00:00
Nadav Rotem
ccaccfa8bf 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
2012-10-20 20:45:01 +00:00
Benjamin Kramer
63a4c24616 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
2012-10-20 12:53:26 +00:00
Benjamin Kramer
2a13242b20 SROA: Simplify code. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166375 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-20 12:04:57 +00:00
Benjamin Kramer
82a1833865 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
2012-10-20 08:43:52 +00:00
Nadav Rotem
bf8772ed2c 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
2012-10-20 08:26:33 +00:00
Nadav Rotem
71a1482239 Fix a typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166367 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-20 05:03:27 +00:00
Nadav Rotem
e6748f91ea 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
2012-10-20 04:59:06 +00:00
Chad Rosier
4e472d2277 [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
2012-10-20 01:02:45 +00:00
Chad Rosier
17feeec8d8 [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
2012-10-20 00:47:08 +00:00
Nadav Rotem
4ade92b614 LoopVectorize: Keep the IRBuilder on the stack.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166354 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-19 23:27:19 +00:00
Chad Rosier
13090f70fc [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
2012-10-19 23:15:00 +00:00
Nadav Rotem
5dbe64e2bc 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
2012-10-19 23:05:40 +00:00
Shuxin Yang
cfc6cb0c61 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
2012-10-19 23:00:20 +00:00
Chad Rosier
ab450e42f1 [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
2012-10-19 22:57:33 +00:00
Akira Hatanaka
30580cea43 [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
2012-10-19 22:11:40 +00:00
Akira Hatanaka
2b861be96e [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
2012-10-19 21:47:33 +00:00
Akira Hatanaka
e050902ca7 [mips] Fix TAILCALL's operand node type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166341 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-19 21:30:15 +00:00
Nadav Rotem
a04a4a79ea 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
2012-10-19 21:28:43 +00:00
Akira Hatanaka
e06ce4c2c4 [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
2012-10-19 21:18:38 +00:00
Akira Hatanaka
01a75c46e3 [mips] Add tail call instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166338 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-19 21:14:34 +00:00
Akira Hatanaka
1f027135a8 [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
2012-10-19 21:11:03 +00:00
Akira Hatanaka
58d1e3f72a 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
2012-10-19 20:59:39 +00:00
Chad Rosier
96d58e64cf [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
2012-10-19 20:57:14 +00:00
Benjamin Kramer
0aae4bd0fc 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
2012-10-19 20:43:44 +00:00
Shuxin Yang
970755e519 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
2012-10-19 20:11:16 +00:00
Chad Rosier
9abfbdfc77 [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
2012-10-19 17:57:49 +00:00
Benjamin Kramer
7182126b0f 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
2012-10-19 17:53:54 +00:00
Michael Liao
facace808c 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
2012-10-19 17:15:18 +00:00
Benjamin Kramer
239fd44f7a 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
2012-10-19 16:37:30 +00:00
Alexey Samsonov
34674fea97 [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
2012-10-19 15:24:46 +00:00
Evgeniy Stepanov
4a2dec05ce Move SplitBlockAndInsertIfThen to BasicBlockUtils.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166278 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-19 10:48:31 +00:00
Benjamin Kramer
17f68c52d2 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
2012-10-19 08:42:02 +00:00
Stepan Dyatkovskiy
0d3c8d5d16 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
2012-10-19 08:23:06 +00:00
Nick Lewycky
0d7d11d57f Pacify -Wnon-virtual-dtor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166270 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-19 07:00:09 +00:00
Kostya Serebryany
bd0052a0f2 [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
2012-10-19 06:20:53 +00:00
Nadav Rotem
725f1d1280 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
2012-10-19 04:27:49 +00:00
Michael Liao
9aecdb51c7 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
2012-10-19 03:17:00 +00:00
Nadav Rotem
89e7b356f2 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
2012-10-19 01:24:18 +00:00
Nadav Rotem
cbd9a19b5d 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
2012-10-18 23:22:48 +00:00
Nadav Rotem
ebd3f27c7e cleanup the comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166247 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-18 23:21:01 +00:00
Kevin Enderby
88d12663ab 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
2012-10-18 21:49:18 +00:00
Nadav Rotem
6220fb16c1 fix a naming typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166232 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-18 21:45:31 +00:00
Chad Rosier
3298959540 [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
2012-10-18 20:27:15 +00:00
Sebastian Pop
83ba06afa8 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
2012-10-18 19:53:48 +00:00
Sebastian Pop
bf0683f0f7 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
2012-10-18 19:53:45 +00:00
Chad Rosier
c8dd27e583 [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
2012-10-18 19:39:30 +00:00
Nadav Rotem
b943d9d497 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
2012-10-18 18:34:50 +00:00
Meador Inge
b3394f5641 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
2012-10-18 18:12:43 +00:00
Meador Inge
0c41d57b09 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
2012-10-18 18:12:40 +00:00
Nadav Rotem
1c5bf3f429 In SimplifySelectOps we pulled two loads through a select node despite the fact that one was dependent on the other.
rdar://12513091



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166196 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-18 18:06:48 +00:00
Nadav Rotem
bef36ac2a4 When looking for a vector representation of a scalar, do a single lookup. Also, cache the result of the broadcast instruction.
No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166191 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-18 17:31:49 +00:00
Chad Rosier
b1f8c139c5 [ms-inline asm] Move most of the AsmParsing logic in clang back into the MC
layer.  Add the ParseMSInlineAsm() function, which is the new interface to 
clang.  Also expose the new MCAsmParserSemaCallback interface, which is used
by the back-end to do name lookup in Sema.  Finally, remove the now defunct
APIs introduced in r165946.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166183 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-18 15:49:34 +00:00
Ulrich Weigand
6c28a7eec8 This patch fixes failures in the SingleSource/Regression/C/uint64_to_float
test case on PowerPC caused by rounding errors when converting from a 64-bit
integer to a single-precision floating point. The reason for this are
double-rounding effects, since on PowerPC we have to convert to an
intermediate double-precision value first, which gets rounded to the
final single-precision result.

The patch fixes the problem by preparing the 64-bit integer so that the
first conversion step to double-precision will always be exact, and the
final rounding step will result in the correctly-rounded single-precision
result.  The generated code sequence is equivalent to what GCC would generate.

When -enable-unsafe-fp-math is in effect, that extra effort is omitted
and we accept possible rounding errors (just like GCC does as well).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166178 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-18 13:16:11 +00:00
Chandler Carruth
2360b7ad99 Refactor insert and extract of sub-integers into static helpers that
operate purely on values. Sink the alloca loading and storing logic into
the rewrite routines that are specific to alloca-integer-rewrite
driving. This is just a refactoring here, but the subsequent step will
be to reuse the insertion and extraction logic when rewriting integer
loads and stores that have been split and decomposed into narrower loads
and stores.

No functionality changed other than different names for instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166176 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-18 09:56:08 +00:00
Chandler Carruth
02d5333eea This FIXME was fixed some time ago. =]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166175 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-18 09:56:06 +00:00
Chandler Carruth
63a1eb62e4 Introduce a BarrierNoop pass, a hack designed to allow *some* control
over the implicitly-formed-and-nesting CGSCC pass manager and function
pass managers, especially when using them on the opt commandline or
using extension points in the module builder. The '-barrier' opt flag
(or the pass itself) will create a no-op module pass in the pipeline,
resetting the pass manager stack, and allowing the creation of a new
pipeline of function passes or CGSCC passes to be created that is
independent from any previous pipelines.

For example, this can be used to test running two CGSCC passes in
independent CGSCC pass managers as opposed to in the same CGSCC pass
manager. It also allows us to introduce a further hack into the
PassManagerBuilder to separate the O0 pipeline extension passes from the
always-inliner's CGSCC pass manager, which they likely do not want to
participate in... At the very least none of the Sanitizer passes want
this behavior.

This fixes a bug with ASan at O0 currently, and I'll commit the ASan
test which covers this pass. I'm happy to add a test case that this pass
exists and works, but not sure how much time folks would like me to
spend adding test cases for the details of its behavior of partition
pass managers.... The whole thing is just vile, and mostly intended to
unblock ASan, so I'm hoping to rip this all out in a brave new pass
manager world.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166172 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-18 08:05:46 +00:00
Nadav Rotem
3141d2db03 remove unused variable to fix a warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166170 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-18 06:09:21 +00:00
Bob Wilson
3b9a911efc Temporarily revert the TargetTransform changes.
The TargetTransform changes are breaking LTO bootstraps of clang.  I am
working with Nadav to figure out the problem, but I am reverting it for now
to get our buildbots working.

This reverts svn commits: 165665 165669 165670 165786 165787 165997
and I have also reverted clang svn 165741

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166168 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-18 05:43:52 +00:00
Nadav Rotem
d22d5f9122 Remove the use of dominators and AA.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166167 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-18 05:33:02 +00:00
Nadav Rotem
1953ace81d Vectorizer: Add support for loops with an unknown count. For example:
for (i=0; i<n; i++){
        a[i] = b[i+1] + c[i+3];
     }



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166165 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-18 05:29:12 +00:00
Bill Wendling
6ebddd2d65 Revert r166157 because some tests fail...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166159 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-17 23:56:05 +00:00
Bill Wendling
73f75cf200 Check that the operand of the GEP is not the GEP itself. This occurred during an LTO build of LLVM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166157 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-17 23:54:19 +00:00
Michael Liao
07edaf3801 Revert part of r166049 back and enable test case in r166125.
- Folding (trunc (concat ... X )) to (concat ... (trunc X) ...) is valid
  when '...' are all 'undef's.
- r166125 relies on this transformation.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166155 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-17 23:45:54 +00:00
NAKAMURA Takumi
6dc0050f6d LoopVectorize.cpp: Fix a warning. [-Wunused-variable]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166153 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-17 23:40:15 +00:00
Jakub Staszak
c2358eb361 Remove redundant SetInsertPoint call.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166138 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-17 23:06:37 +00:00
Michael Liao
4031e9018b Revert r166049
- In general, it's unsafe for this transformation.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166135 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-17 22:41:15 +00:00
Reed Kotler
95a2bb4cdf Add conditional branch instructions and their patterns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166134 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-17 22:29:54 +00:00
Roman Divacky
a5401d6730 Fix some typos and wrong indenting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166128 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-17 21:07:35 +00:00
Michael Liao
13429e224c Teach DAG combine to fold (extract_subvec (concat v1, ..) i) to v_i
- If the extracted vector has the same type of all vectored being concatenated
  together, it should be simplified directly into v_i, where i is the index of
  the element being extracted.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166125 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-17 20:48:33 +00:00
Jakob Stoklund Olesen
4b1aa961fd Switch MRI::UsedPhysRegs to a register unit bit vector.
This is a more compact, less redundant representation, and it avoids
scanning long lists of aliases for ARM D-registers, for example.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166124 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-17 20:26:33 +00:00
Evan Cheng
d4f759696d Add a really faster pre-RA scheduler (-pre-RA-sched=linearize). It doesn't use
any scheduling heuristics nor does it build up any scheduling data structure
that other heuristics use. It essentially linearize by doing a DFA walk but
it does handle glues correctly.

IMPORTANT: it probably can't handle all the physical register dependencies so
it's not suitable for x86. It also doesn't deal with dbg_value nodes right now
so it's definitely is still WIP.

rdar://12474515


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166122 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-17 19:39:36 +00:00
Jakob Stoklund Olesen
9aa6e0a134 Merge MRI::isPhysRegOrOverlapUsed() into isPhysRegUsed().
All callers of these functions really want the isPhysRegOrOverlapUsed()
functionality which also checks aliases. For historical reasons, targets
without register aliases were calling isPhysRegUsed() instead.

Change isPhysRegUsed() to also check aliases, and switch all
isPhysRegOrOverlapUsed() callers to isPhysRegUsed().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166117 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-17 18:44:18 +00:00
Nadav Rotem
d15c0c7ac1 Add a loop vectorizer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166112 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-17 18:25:06 +00:00
Jakob Stoklund Olesen
9d57cdfa17 Check for empty YMM use-def lists in X86VZeroUpper.
The previous MRI.isPhysRegUsed(YMM0) would also return true when the
function contains a call to a function that may clobber YMM0. That's
most of them.

Checking the use-def chains allows us to skip functions that don't
explicitly mention YMM registers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166110 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-17 17:52:35 +00:00
Anton Korobeynikov
e4b33a115b Fix fallout from RegInfo => FrameLowering refactoring on MSP430.
Patch by Job Noorman!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166108 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-17 17:37:11 +00:00