oota-llvm.git
15 years agoTemporarily revert r72514 (and dependent patch r72516). It was causing this
Bill Wendling [Thu, 28 May 2009 18:18:59 +0000 (18:18 +0000)]
Temporarily revert r72514 (and dependent patch r72516). It was causing this
failure during llvm-gcc bootstrap:

Assertion failed: (!Tmp2.getNode() && "Can't legalize BR_CC with legal condition!"), function ExpandNode, file /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore.roots/llvmCore~obj/src/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp, line 2923.
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/gcc/libgcc2.c:1727: internal compiler error: Abort trap
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.

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

15 years agoMark the branch insns correctly.
Sanjiv Gupta [Thu, 28 May 2009 17:32:56 +0000 (17:32 +0000)]
Mark the branch insns correctly.

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

15 years agoFixing problems that got exposed after the refactoring of LegalizeDAG done in 72447.
Sanjiv Gupta [Thu, 28 May 2009 06:59:57 +0000 (06:59 +0000)]
Fixing problems that got exposed after the refactoring of LegalizeDAG done in 72447.

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

15 years agoAdd a testcase which got fixed by recent legalization work.
Eli Friedman [Thu, 28 May 2009 05:10:20 +0000 (05:10 +0000)]
Add a testcase which got fixed by recent legalization work.

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

15 years agoRemove a couple of useless functions.
Eli Friedman [Thu, 28 May 2009 04:49:34 +0000 (04:49 +0000)]
Remove a couple of useless functions.

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

15 years agoRemove special cases for more opcodes.
Eli Friedman [Thu, 28 May 2009 04:39:57 +0000 (04:39 +0000)]
Remove special cases for more opcodes.

This is basically the end of this series of patches for LegalizeDAG; the
remaining special cases can't be removed without more infrastructure
work.  There's a FIXME for each relevant opcode near the beginning of
SelectionDAGLegalize::LegalizeOp.

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

15 years agoReturn the operand rather than a null SDValue when the given SELECT_CC
Eli Friedman [Thu, 28 May 2009 04:31:08 +0000 (04:31 +0000)]
Return the operand rather than a null SDValue when the given SELECT_CC
is actually legal.  Part of LegalizeDAG cleanups.

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

15 years agoUse Operands.data() instead of &Operands[0] where Operands is a potentially
Nick Lewycky [Thu, 28 May 2009 04:08:10 +0000 (04:08 +0000)]
Use Operands.data() instead of &Operands[0] where Operands is a potentially
empty SmallVector.

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

15 years agoRemove special case for SETCC opcode; add some comments explaining why
Eli Friedman [Thu, 28 May 2009 03:56:57 +0000 (03:56 +0000)]
Remove special case for SETCC opcode; add some comments explaining why
some special cases are necessary.

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

15 years agoThis patch brings the list of attributes in CPPBackend.cpp up to date with the
Jeffrey Yasskin [Thu, 28 May 2009 03:16:17 +0000 (03:16 +0000)]
This patch brings the list of attributes in CPPBackend.cpp up to date with the
list in Attributes.h. It also reorders the CPPBackend list to match so that
it's easier to see that it's complete.

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

15 years agoSome minor cleanups.
Eli Friedman [Thu, 28 May 2009 03:06:16 +0000 (03:06 +0000)]
Some minor cleanups.

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

15 years ago"The instructions MMX_PSADBWrm and MMX_PSADBWrr have opcode 0b11100000 (e0), but
Bill Wendling [Thu, 28 May 2009 02:04:00 +0000 (02:04 +0000)]
"The instructions MMX_PSADBWrm and MMX_PSADBWrr have opcode 0b11100000 (e0), but
the Intel manual (screenshot) says it should be 0b11110110 (f6).  The existing
encoding causes a disassembly conflict with MMX_PAVGBrm, which really should be
0f e0."

Patch by Sean Callanan!

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

15 years agoAdded optimization that narrow load / op / store and the 'op' is a bit twiddling...
Evan Cheng [Thu, 28 May 2009 00:35:15 +0000 (00:35 +0000)]
Added optimization that narrow load / op / store and the 'op' is a bit twiddling instruction and its second operand is an immediate. If bits that are touched by 'op' can be done with a narrower instruction, reduce the width of the load and store as well. This happens a lot with bitfield manipulation code.
e.g.
orl     $65536, 8(%rax)
=>
orb     $1, 10(%rax)

Since narrowing is not always a win, e.g. i32 -> i16 is a loss on x86, dag combiner consults with the target before performing the optimization.

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

15 years agoRevert 72493 and replace it with a more conservative fix, for now: don't
Dan Gohman [Wed, 27 May 2009 21:10:47 +0000 (21:10 +0000)]
Revert 72493 and replace it with a more conservative fix, for now: don't
rewrite the comparison if there is any implicit extension or truncation
on the induction variable. I'm planning for IVUsers to eventually take
over some of the work of this code, and for it to be generalized.

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

15 years agoGer rid of some dead code.
Eli Friedman [Wed, 27 May 2009 20:39:00 +0000 (20:39 +0000)]
Ger rid of some dead code.

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

15 years agoIn ChangeCompareStride, when the stride to be reused is truncated to
Dan Gohman [Wed, 27 May 2009 20:00:18 +0000 (20:00 +0000)]
In ChangeCompareStride, when the stride to be reused is truncated to
a smaller type, promoted its offset back up to the type of the new
comparison. This fixes PR4222.

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

15 years agoFix sfence jit encoding. Patch by Sean Callanan.
Evan Cheng [Wed, 27 May 2009 18:38:01 +0000 (18:38 +0000)]
Fix sfence jit encoding. Patch by Sean Callanan.

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

15 years agoThis looks like it passes now.
Bill Wendling [Wed, 27 May 2009 17:43:21 +0000 (17:43 +0000)]
This looks like it passes now.

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

15 years agoAdded support for fround, fextend and FP_TO_SINT
Bruno Cardoso Lopes [Wed, 27 May 2009 17:23:44 +0000 (17:23 +0000)]
Added support for fround, fextend and FP_TO_SINT

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

15 years agoMinor fix for CMake build system
Douglas Gregor [Wed, 27 May 2009 16:52:17 +0000 (16:52 +0000)]
Minor fix for CMake build system

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

15 years agoCMake: Set LIBS on llvm-config so we can query the system libraries
Oscar Fuentes [Wed, 27 May 2009 15:49:33 +0000 (15:49 +0000)]
CMake: Set LIBS on llvm-config so we can query the system libraries
used by CMake with --ldflags.

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

15 years agoMinor cleanups; add a better explanation for the issue with
Eli Friedman [Wed, 27 May 2009 12:42:55 +0000 (12:42 +0000)]
Minor cleanups; add a better explanation for the issue with
BUILD_VECTOR.

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

15 years agoRemove more special cases for opcodes.
Eli Friedman [Wed, 27 May 2009 12:20:41 +0000 (12:20 +0000)]
Remove more special cases for opcodes.

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

15 years agoRemove special cases for more opcodes.
Eli Friedman [Wed, 27 May 2009 07:58:35 +0000 (07:58 +0000)]
Remove special cases for more opcodes.

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

15 years agoRemoving more special cases from LegalizeDAG.
Eli Friedman [Wed, 27 May 2009 07:32:27 +0000 (07:32 +0000)]
Removing more special cases from LegalizeDAG.

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

15 years agoEliminate more special cases for opcodes.
Eli Friedman [Wed, 27 May 2009 07:05:37 +0000 (07:05 +0000)]
Eliminate more special cases for opcodes.

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

15 years agoRemove more special cases from LegalizeDAG.
Eli Friedman [Wed, 27 May 2009 03:33:44 +0000 (03:33 +0000)]
Remove more special cases from LegalizeDAG.

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

15 years agoRemove unused argument.
Eli Friedman [Wed, 27 May 2009 02:21:29 +0000 (02:21 +0000)]
Remove unused argument.

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

15 years agoRemove more opcode special cases.
Eli Friedman [Wed, 27 May 2009 02:16:40 +0000 (02:16 +0000)]
Remove more opcode special cases.

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

15 years agoAdd braces around an array initializer.
Dan Gohman [Wed, 27 May 2009 02:07:15 +0000 (02:07 +0000)]
Add braces around an array initializer.

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

15 years agoTeach SCEVExpander to avoid creating over-indexed GEP indices when
Dan Gohman [Wed, 27 May 2009 02:00:53 +0000 (02:00 +0000)]
Teach SCEVExpander to avoid creating over-indexed GEP indices when
possible. For example, it now emits

  %p.2.ip.1 = getelementptr [3 x [3 x double]]* %p, i64 2, i64 %tmp, i64 1

instead of the equivalent but less obvious

  %p.2.ip.1 = getelementptr [3 x [3 x double]]* %p, i64 0, i64 %tmp, i64 19

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

15 years agoTeach BasicAliasAnalysis to understand constant gep indices that fall
Dan Gohman [Wed, 27 May 2009 01:48:27 +0000 (01:48 +0000)]
Teach BasicAliasAnalysis to understand constant gep indices that fall
beyond their associated static array type.

I believe that this fixes a legitimate bug, because BasicAliasAnalysis
already has code to check for this condition that works for non-constant
indices, however it was missing the case of constant indices. With this
change, it checks for both.

This fixes PR4267, and miscompiles of SPEC 188.ammp and 464.h264.href.

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

15 years agoStart of refactoring LegalizeDAG so that we don't need specialized
Eli Friedman [Wed, 27 May 2009 01:25:56 +0000 (01:25 +0000)]
Start of refactoring LegalizeDAG so that we don't need specialized
handling for every single opcode.

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

15 years agoDon't abuse the quirky behavior of LegalizeDAG for XINT_TO_FP and
Eli Friedman [Wed, 27 May 2009 00:47:34 +0000 (00:47 +0000)]
Don't abuse the quirky behavior of LegalizeDAG for XINT_TO_FP and
FP_TO_XINT.  Necessary for some cleanups I'm working on.  Updated
from the previous version (r72431) to fix a bug and make some things a
bit clearer.

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

15 years agoTestcase for (llvm-gcc-4.2) 72442 (PR 4242).
Dale Johannesen [Tue, 26 May 2009 23:19:19 +0000 (23:19 +0000)]
Testcase for (llvm-gcc-4.2) 72442 (PR 4242).

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

15 years agoBack out r72431, it is causing a number of compilation crashes with clang.
Daniel Dunbar [Tue, 26 May 2009 21:27:02 +0000 (21:27 +0000)]
Back out r72431, it is causing a number of compilation crashes with clang.

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

15 years agoUpdate CPU capabilities for AMD machines
Stefanus Du Toit [Tue, 26 May 2009 21:04:35 +0000 (21:04 +0000)]
Update CPU capabilities for AMD machines

- added processors k8-sse3, opteron-sse3, athlon64-sse3, amdfam10, and
barcelona with appropriate sse3/4a levels
- added FeatureSSE4A for amdfam10 processors
in X86Subtarget:
- added hasSSE4A
- updated AutoDetectSubtargetFeatures to detect SSE4A
- updated GetCurrentX86CPU to detect family 15 with sse3 as k8-sse3 and
family 10h as amdfam10

New processor names match those used by gcc.

Patch by Paul Redmond!

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

15 years agoDon't abuse the quirky behavior of LegalizeDAG for XINT_TO_FP and
Eli Friedman [Tue, 26 May 2009 19:18:56 +0000 (19:18 +0000)]
Don't abuse the quirky behavior of LegalizeDAG for XINT_TO_FP and
FP_TO_XINT.  Necessary for some cleanups I'm working on.

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

15 years agoFor the new ar --plugin libLLVMgold.so to work we need libLTO linked with
Torok Edwin [Tue, 26 May 2009 19:11:47 +0000 (19:11 +0000)]
For the new ar --plugin libLLVMgold.so to work we need libLTO linked with
pthreads, otherwise ar complains of unresolved references to pthread_mutex_*.
LTO doesn't actually use pthreads, but ManagedStatic does.

Fix this by linking in LIBS (that contains pthreads) for LTO and gold.
For now this links in more libs than needed (libffi for example), we can figure
out later how to link in those libs per-tool later.

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

15 years agoLiveVariables::VarInfo contains an AliveBlocks BitVector, which has as many
Jeffrey Yasskin [Tue, 26 May 2009 18:27:15 +0000 (18:27 +0000)]
LiveVariables::VarInfo contains an AliveBlocks BitVector, which has as many
entries as there are basic blocks in the function.  LiveVariables::getVarInfo
creates a VarInfo struct for every register in the function, leading to
quadratic space use.  This patch changes the BitVector to a SparseBitVector,
which doesn't help the worst-case memory use but does reduce the actual use in
very long functions with short-lived variables.

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

15 years agoFor the return type of SCEVUDivExpr, use the RHS' type instead of
Dan Gohman [Tue, 26 May 2009 17:44:05 +0000 (17:44 +0000)]
For the return type of SCEVUDivExpr, use the RHS' type instead of
that of the LHS. It doesn't matter for correctness, but the LHS
is more likely than the RHS to be a pointer type in exotic cases,
and it's more tidy to have it return the integer type.

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

15 years agoGive SCEVNaryExpr a doxygen comment.
Dan Gohman [Tue, 26 May 2009 17:42:32 +0000 (17:42 +0000)]
Give SCEVNaryExpr a doxygen comment.

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

15 years agoIn cases where a pointer value is an operand of a multiplication or
Dan Gohman [Tue, 26 May 2009 17:41:16 +0000 (17:41 +0000)]
In cases where a pointer value is an operand of a multiplication or
division operation, don't attempt to use the operation's value as
the base of a getelementptr. This fixes PR4271.

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

15 years agoDelete a bunch of dead code from LegalizeDAG.
Eli Friedman [Tue, 26 May 2009 08:55:52 +0000 (08:55 +0000)]
Delete a bunch of dead code from LegalizeDAG.

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

15 years agoEliminate VarInfo::UsedBlocks.
Evan Cheng [Tue, 26 May 2009 06:25:46 +0000 (06:25 +0000)]
Eliminate VarInfo::UsedBlocks.

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

15 years agomake memdep use the getModRefInfo method for stores instead of the
Chris Lattner [Mon, 25 May 2009 21:28:56 +0000 (21:28 +0000)]
make memdep use the getModRefInfo method for stores instead of the
low-level alias() method, allowing it to reason more aggressively
about pointers into constant memory.  PR4189

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

15 years agoAudit the type constructors. Previously it was possible to create [0 x void]
Nick Lewycky [Mon, 25 May 2009 21:28:11 +0000 (21:28 +0000)]
Audit the type constructors. Previously it was possible to create [0 x void]
or use labels as members of structures for example. Also included a couple of
whitespace fixes.

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

15 years agoadd some late optimizations that GCC does. It thinks these are a win
Chris Lattner [Mon, 25 May 2009 20:28:19 +0000 (20:28 +0000)]
add some late optimizations that GCC does.  It thinks these are a win
even on Core2, not just AMD processors which was a surprise to me.

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

15 years agofix typo
Chris Lattner [Mon, 25 May 2009 19:51:07 +0000 (19:51 +0000)]
fix typo

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

15 years agowe should eventually add -march=atom and the new atom movbe instruction.
Chris Lattner [Mon, 25 May 2009 16:34:44 +0000 (16:34 +0000)]
we should eventually add -march=atom and the new atom movbe instruction.

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

15 years agoFix the crash debugger to actually bisect globals once it's determined that it
Nick Lewycky [Mon, 25 May 2009 06:29:56 +0000 (06:29 +0000)]
Fix the crash debugger to actually bisect globals once it's determined that it
can't just eliminate all global initializers.

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

15 years agoAdd a bisection step on the list of instructions before doing the linear
Nick Lewycky [Mon, 25 May 2009 05:30:00 +0000 (05:30 +0000)]
Add a bisection step on the list of instructions before doing the linear
simplification. It's not clear to me whether this can replace the first of the
linear instruction simplification stages or not, so I left it in.

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

15 years agoVarious comment fixes.
Dan Gohman [Sun, 24 May 2009 23:45:28 +0000 (23:45 +0000)]
Various comment fixes.

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

15 years agoChange ScalarEvolution::getSCEVAtScope to always return the original value
Dan Gohman [Sun, 24 May 2009 23:25:42 +0000 (23:25 +0000)]
Change ScalarEvolution::getSCEVAtScope to always return the original value
in the case where a loop exit value cannot be computed, instead of only in
some cases while using SCEVCouldNotCompute in others. This simplifies
getSCEVAtScope's callers.

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

15 years agoAdd a comment which should hopefully make the purpose of this method a
Eli Friedman [Sun, 24 May 2009 20:32:10 +0000 (20:32 +0000)]
Add a comment which should hopefully make the purpose of this method a
bit clearer.

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

15 years agoMinor improvement to FCOPYSIGN to use BIT_CONVERT in cases where the
Eli Friedman [Sun, 24 May 2009 20:29:11 +0000 (20:29 +0000)]
Minor improvement to FCOPYSIGN to use BIT_CONVERT in cases where the
corresponding integer type is legal.

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

15 years agoMove Rewriter.clear() earlier, to avoid triggerring the AssertingVH by
Torok Edwin [Sun, 24 May 2009 20:08:21 +0000 (20:08 +0000)]
Move Rewriter.clear() earlier, to avoid triggerring the AssertingVH by
one of the RecursivelyDeleteTriviallyDeadInstructions.
Add a comment explaining why the cache needs to be cleared.

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

15 years agoInstead of clearing the rewriter, don't attempt to rewrite dead phi nodes.
Torok Edwin [Sun, 24 May 2009 19:36:09 +0000 (19:36 +0000)]
Instead of clearing the rewriter, don't attempt to rewrite dead phi nodes.
Also fix 80 column violation.

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

15 years agoWhen rewriting the loop exit test with the canonical induction variable,
Dan Gohman [Sun, 24 May 2009 19:11:38 +0000 (19:11 +0000)]
When rewriting the loop exit test with the canonical induction variable,
leave the original comparison in place if it has other uses, since the
other uses won't be dominated by the new comparison instruction.

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

15 years agoFix this code for hosts where std::vector doesn't have .data().
Dan Gohman [Sun, 24 May 2009 19:02:45 +0000 (19:02 +0000)]
Fix this code for hosts where std::vector doesn't have .data().
Use &Ops[0] instead, which is safe since Ops will never be empty here.

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

15 years agoWhen replacing a floating-point comparison with an integer
Dan Gohman [Sun, 24 May 2009 18:09:01 +0000 (18:09 +0000)]
When replacing a floating-point comparison with an integer
comparison, use takeName to give the integer comparison a name.

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

15 years agoGeneralize SCEVExpander::visitAddRecExpr's GEP persuit, and avoid
Dan Gohman [Sun, 24 May 2009 18:06:31 +0000 (18:06 +0000)]
Generalize SCEVExpander::visitAddRecExpr's GEP persuit, and avoid
sending SCEVUnknowns to expandAddToGEP. This avoids the need for
expandAddToGEP to bend the rules and peek into SCEVUnknown
expressions.

Factor out the code for testing whether a SCEV can be factored by
a constant for use in a GEP index. This allows it to handle
SCEVAddRecExprs, by recursing.

As a result, SCEVExpander can now put more things in GEP indices,
so it emits fewer explicit mul instructions.

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

15 years agoWhen the low bits of one operand of an add are zero, that number
Dan Gohman [Sun, 24 May 2009 18:02:35 +0000 (18:02 +0000)]
When the low bits of one operand of an add are zero, that number
of low bits of the other operand are preserved in the output.

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

15 years agoThe rewriter may hold references to instructions that are deleted because they are...
Torok Edwin [Sun, 24 May 2009 14:23:16 +0000 (14:23 +0000)]
The rewriter may hold references to instructions that are deleted because they are trivially dead.
Fix by clearing the rewriter cache before deleting the trivially dead
instructions.
Also make InsertedExpressions use an AssertingVH to catch these
bugs easier.

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

15 years agoRewrite ISD::FCOPYSIGN lowering to never use i64. Not really ideal, but
Eli Friedman [Sun, 24 May 2009 10:21:20 +0000 (10:21 +0000)]
Rewrite ISD::FCOPYSIGN lowering to never use i64. Not really ideal, but
it's late, and I don't have any better ideas at the moment.  Fixes PR4257.

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

15 years agoMake bugpoint emit a bugpoint-reduced-blocks.bc, because bugpoint itself
Torok Edwin [Sun, 24 May 2009 09:40:47 +0000 (09:40 +0000)]
Make bugpoint emit a bugpoint-reduced-blocks.bc, because bugpoint itself
can crash during instruction simplification (for example if it creates a
broken module).

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

15 years agoAdd -disable-global-remove option to bugpoint.
Torok Edwin [Sun, 24 May 2009 09:31:04 +0000 (09:31 +0000)]
Add -disable-global-remove option to bugpoint.
Sometimes when bugpointing a crash the bugpoint-reduced-simplified.bc reproduces
a totally different bug than the original one ("GV doesn't have initializer").
Although its useful to report that bug too, I need a way to reduce the original
bug, hence I introduced -disable-global-remove.

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

15 years agoUpdate for CMakeLists; untested, so tell me if there are issues.
Eli Friedman [Sun, 24 May 2009 09:13:13 +0000 (09:13 +0000)]
Update for CMakeLists; untested, so tell me if there are issues.

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

15 years agoRemove checks of getTypeAction from LegalizeOp; we already assert that
Eli Friedman [Sun, 24 May 2009 08:42:01 +0000 (08:42 +0000)]
Remove checks of getTypeAction from LegalizeOp; we already assert that
all results and all operands are legal, so this change shouldn't affect
behavior at all.

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

15 years agoDisable type legalization in LegalizeDAG.
Eli Friedman [Sun, 24 May 2009 02:46:31 +0000 (02:46 +0000)]
Disable type legalization in LegalizeDAG.

This leaves around 4000 lines of dead code; I'll clean that up
in subsequent commits.

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

15 years agoRemove border around table used for layout.
Nick Lewycky [Sun, 24 May 2009 02:46:06 +0000 (02:46 +0000)]
Remove border around table used for layout.

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

15 years agoMake the PPC backend use a legal type for the operands to the BUILD_VECTOR
Eli Friedman [Sun, 24 May 2009 02:03:36 +0000 (02:03 +0000)]
Make the PPC backend use a legal type for the operands to the BUILD_VECTOR
nodes it generates.

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

15 years agoFix a bug in the expansion of EXTRACT_SUBVECTOR in
Eli Friedman [Sat, 23 May 2009 23:03:28 +0000 (23:03 +0000)]
Fix a bug in the expansion of EXTRACT_SUBVECTOR in
ExpandExtractFromVectorThroughStack.

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

15 years agoMake the X86 backend mark EXTRACT_SUBVECTOR as Expand, at least for the
Eli Friedman [Sat, 23 May 2009 22:44:52 +0000 (22:44 +0000)]
Make the X86 backend mark EXTRACT_SUBVECTOR as Expand, at least for the
moment.

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

15 years agoAdd a proper implementation of EXTRACT_SUBVECTOR legalization that
Eli Friedman [Sat, 23 May 2009 22:37:25 +0000 (22:37 +0000)]
Add a proper implementation of EXTRACT_SUBVECTOR legalization that
doesn't split legal vector operands.  This is necessary because the
type legalization (and therefore, vector splitting) code will be going
away soon.

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

15 years agoUse latin symbols. I was told not everybody has a UTF-8 capable editor.
Torok Edwin [Sat, 23 May 2009 20:40:47 +0000 (20:40 +0000)]
Use latin symbols. I was told not everybody has a UTF-8 capable editor.

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

15 years agoWrite family name last, as other entries in this file.
Torok Edwin [Sat, 23 May 2009 20:21:09 +0000 (20:21 +0000)]
Write family name last, as other entries in this file.

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

15 years agoAdd myself.
Torok Edwin [Sat, 23 May 2009 20:19:52 +0000 (20:19 +0000)]
Add myself.

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

15 years agoAdd ARMv7 architecture, Cortex processors and different FPU modes handling.
Anton Korobeynikov [Sat, 23 May 2009 19:51:43 +0000 (19:51 +0000)]
Add ARMv7 architecture, Cortex processors and different FPU modes handling.

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

15 years agoEmit ARM Build Attributes
Anton Korobeynikov [Sat, 23 May 2009 19:51:20 +0000 (19:51 +0000)]
Emit ARM Build Attributes

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

15 years agoPropagate CPU string out of SubtargetFeatures
Anton Korobeynikov [Sat, 23 May 2009 19:50:50 +0000 (19:50 +0000)]
Propagate CPU string out of SubtargetFeatures

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

15 years agoWork around a page size issue on Cygwin.
Jay Foad [Sat, 23 May 2009 17:57:59 +0000 (17:57 +0000)]
Work around a page size issue on Cygwin.

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

15 years agoFix PR4254.
Torok Edwin [Sat, 23 May 2009 17:29:48 +0000 (17:29 +0000)]
Fix PR4254.
The DAGCombiner created a negative shiftamount, stored in an
unsigned variable. Later the optimizer eliminated the shift entirely as being
undefined.
Example: (srl (shl X, 56) 48). ShiftAmt is 4294967288.
Fix it by checking that the shiftamount is positive, and storing in a signed
variable.

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

15 years agostat64/open64/lseek64 for the interpreter
Torok Edwin [Sat, 23 May 2009 16:23:59 +0000 (16:23 +0000)]
stat64/open64/lseek64 for the interpreter

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

15 years agoavailable_externall linkage is not local, this was confusing the codegenerator,
Torok Edwin [Sat, 23 May 2009 14:06:57 +0000 (14:06 +0000)]
available_externall linkage is not local, this was confusing the codegenerator,
and it wasn't generating calls through @PLT for these functions.
hasLocalLinkage() is now false for available_externally,
I attempted to fix the inliner and dce to handle available_externally properly.
It passed make check.

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

15 years agoFix test to account for legalization changes; I think this ends up
Eli Friedman [Sat, 23 May 2009 13:15:11 +0000 (13:15 +0000)]
Fix test to account for legalization changes; I think this ends up
running an extra DAGCombine pass which improves the code a bit.

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

15 years agoAdd a new step to legalization to legalize vector math operations. This
Eli Friedman [Sat, 23 May 2009 12:35:30 +0000 (12:35 +0000)]
Add a new step to legalization to legalize vector math operations.  This
will allow simplifying LegalizeDAG to eliminate type legalization.  (I
have a patch to do that, but it's not quite finished; I'll commit it
once it's finished and I've fixed any review comments for this patch.)
See the comment at the beginning of
lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp for more details on the
motivation for this patch.

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

15 years agoMake the x86 backend custom-lower UINT_TO_FP and FP_TO_UINT on 32-bit
Eli Friedman [Sat, 23 May 2009 09:59:16 +0000 (09:59 +0000)]
Make the x86 backend custom-lower UINT_TO_FP and FP_TO_UINT on 32-bit
systems instead of attempting to promote them to a 64-bit SINT_TO_FP or
FP_TO_SINT.  This is in preparation for removing the type legalization
code from LegalizeDAG: once type legalization is gone from LegalizeDAG,
it won't be able to handle the i64 operand/result correctly.

This isn't quite ideal, but I don't think any other operation for any
target ends up in this situation, so treating this case specially seems
reasonable.

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

15 years agoCMake: Use libdl only when available. Fixes build on FreeBSD.
Oscar Fuentes [Sat, 23 May 2009 02:37:24 +0000 (02:37 +0000)]
CMake: Use libdl only when available. Fixes build on FreeBSD.

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

15 years agoFix bug in FoldFCmp_IntToFP_Cst. If inttofp is a uintofp, use unsigned instead of...
Evan Cheng [Fri, 22 May 2009 23:10:53 +0000 (23:10 +0000)]
Fix bug in FoldFCmp_IntToFP_Cst. If inttofp is a uintofp, use unsigned instead of signed integer constant.

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

15 years agoAdd a note mentioning that uses of the return value of an invoke
Dan Gohman [Fri, 22 May 2009 21:47:08 +0000 (21:47 +0000)]
Add a note mentioning that uses of the return value of an invoke
must be dominated by the normal label.

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

15 years agoCMake: Use libpthread in tblgen when needed. Updated list of source
Oscar Fuentes [Fri, 22 May 2009 20:55:15 +0000 (20:55 +0000)]
CMake: Use libpthread in tblgen when needed. Updated list of source
files for PIC16 target.

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

15 years agoAdd a new codegen pass that normalizes dwarf exception handling
Duncan Sands [Fri, 22 May 2009 20:36:31 +0000 (20:36 +0000)]
Add a new codegen pass that normalizes dwarf exception handling
code in preparation for code generation.  The main thing it does
is handle the case when eh.exception calls (and, in a future
patch, eh.selector calls) are far away from landing pads.  Right
now in practice you only find eh.exception calls close to landing
pads: either in a landing pad (the common case) or in a landing
pad successor, due to loop passes shifting them about.  However
future exception handling improvements will result in calls far
from landing pads:
(1) Inlining of rewinds.  Consider the following case:
In function @f:
...
  invoke @g to label %normal unwind label %unwinds
...
unwinds:
  %ex = call i8* @llvm.eh.exception()
...

In function @g:
...
  invoke @something to label %continue unwind label %handler
...
handler:
  %ex = call i8* @llvm.eh.exception()
... perform cleanups ...
  "rethrow exception"

Now inline @g into @f.  Currently this is turned into:
In function @f:
...
  invoke @something to label %continue unwind label %handler
...
handler:
  %ex = call i8* @llvm.eh.exception()
... perform cleanups ...
  invoke "rethrow exception" to label %normal unwind label %unwinds
unwinds:
  %ex = call i8* @llvm.eh.exception()
...

However we would like to simplify invoke of "rethrow exception" into
a branch to the %unwinds label.  Then %unwinds is no longer a landing
pad, and the eh.exception call there is then far away from any landing
pads.

(2) Using the unwind instruction for cleanups.
It would be nice to have codegen handle the following case:
  invoke @something to label %continue unwind label %run_cleanups
...
handler:
... perform cleanups ...
  unwind

This requires turning "unwind" into a library call, which
necessarily takes a pointer to the exception as an argument
(this patch also does this unwind lowering).  But that means
you are using eh.exception again far from a landing pad.

(3) Bugpoint simplifications.  When bugpoint is simplifying
exception handling code it often generates eh.exception calls
far from a landing pad, which then causes codegen to assert.
Bugpoint then latches on to this assertion and loses sight
of the original problem.

Note that it is currently rare for this pass to actually do
anything.  And in fact it normally shouldn't do anything at
all given the code coming out of llvm-gcc!  But it does fire
a few times in the testsuite.  As far as I can see this is
almost always due to the LoopStrengthReduce codegen pass
introducing pointless loop preheader blocks which are landing
pads and only contain a branch to another block.  This other
block contains an eh.exception call.  So probably by tweaking
LoopStrengthReduce a bit this can be avoided.

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

15 years agoOnly 64-bit targets support TImode libcalls. Disable the TImode shift libcalls
Bob Wilson [Fri, 22 May 2009 17:38:41 +0000 (17:38 +0000)]
Only 64-bit targets support TImode libcalls.  Disable the TImode shift libcalls
for ARM.  This fixes rdar://6908807.

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

15 years agoTeach IndVarSimplify's FixUsesBeforeDefs to handle InvokeInsts by
Dan Gohman [Fri, 22 May 2009 16:47:11 +0000 (16:47 +0000)]
Teach IndVarSimplify's FixUsesBeforeDefs to handle InvokeInsts by
assuming that the use of the value is in a block dominated by the
"normal" destination. LangRef.html and other documentation sources
don't explicitly guarantee this, but it seems to be assumed in
other places in LLVM at least.

This fixes an assertion failure on the included testcase, which
is derived from the Ada testsuite.

FixUsesBeforeDefs is a temporary measure which I'm looking to
replace with a more capable solution.

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

15 years agoEmit debug information for globals (which include automatic variables as well because...
Sanjiv Gupta [Fri, 22 May 2009 13:58:45 +0000 (13:58 +0000)]
Emit debug information for globals (which include automatic variables as well because on PIC16 they are emitted as globals by the frontend).

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

15 years agoHopefully fix the build for people with ocaml.
Duncan Sands [Fri, 22 May 2009 09:22:17 +0000 (09:22 +0000)]
Hopefully fix the build for people with ocaml.

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

15 years agoAlways verify dominfo if expensive checking is enabled.
Duncan Sands [Fri, 22 May 2009 08:52:53 +0000 (08:52 +0000)]
Always verify dominfo if expensive checking is enabled.

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

15 years agoFix a thinko in the code that adapted SCEVMulExpr operands for
Dan Gohman [Fri, 22 May 2009 07:14:20 +0000 (07:14 +0000)]
Fix a thinko in the code that adapted SCEVMulExpr operands for
use in expanding SCEVAddExprs with GEPs. The operands of a
SCEVMulExpr need to be multiplied together, not added.

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

15 years agoRevert this. There's no way to verifiy indirect calls, and an optimizer can turn
Torok Edwin [Fri, 22 May 2009 07:12:05 +0000 (07:12 +0000)]
Revert this. There's no way to verifiy indirect calls, and an optimizer can turn
indirect call into direct call, thus the verifier would reject something it
previously accepted.

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