oota-llvm.git
15 years agoremove some done things: we have nocapture and SROA is smarter.
Chris Lattner [Mon, 11 May 2009 17:41:40 +0000 (17:41 +0000)]
remove some done things: we have nocapture and SROA is smarter.

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

15 years agoadd a note
Chris Lattner [Mon, 11 May 2009 17:36:33 +0000 (17:36 +0000)]
add a note

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

15 years agoReverse a loop that is counting up to a maximum to
Dale Johannesen [Mon, 11 May 2009 17:15:42 +0000 (17:15 +0000)]
Reverse a loop that is counting up to a maximum to
count down to 0 instead, under very restricted
circumstances.  Adjust 4 testcases in which this
optimization fires.

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

15 years agoShrink wrapping in PEI:
John Mosby [Mon, 11 May 2009 17:04:19 +0000 (17:04 +0000)]
Shrink wrapping in PEI:
- reduces _static_ callee saved register spills
  and restores similar to Chow's original algorithm.
- iterative implementation with simple heuristic
  limits to mitigate compile time impact.
- handles placing spills/restores for multi-entry,
  multi-exit regions in the Machine CFG without
  splitting edges.
- passes test-suite in LLCBETA mode.

Added contains() method to ADT/SparseBitVector.

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

15 years agoDon't generate redundant casts of constant values when lowering calls to
Jay Foad [Mon, 11 May 2009 11:32:25 +0000 (11:32 +0000)]
Don't generate redundant casts of constant values when lowering calls to
memcpy, memmove and memset.

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

15 years agoChange TargetData::getIntPtrType() to return an IntegerType instead of
Jay Foad [Mon, 11 May 2009 11:13:47 +0000 (11:13 +0000)]
Change TargetData::getIntPtrType() to return an IntegerType instead of
just a Type.

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

15 years agoFix more naming issues.
Sanjiv Gupta [Mon, 11 May 2009 08:52:04 +0000 (08:52 +0000)]
Fix more naming issues.
compiler libcalls start with .lib. now.
fixed section names.

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

15 years agoDetect calls to compiler intrinsics and emit an extern declarations
Sanjiv Gupta [Mon, 11 May 2009 06:01:38 +0000 (06:01 +0000)]
Detect calls to compiler intrinsics and emit an extern declarations
only for those. These extern declarations to intrinsics are currently
being emitted at the bottom of generated .s file, which works fine with
gpasm(not sure about MPSAM though).
PIC16 linker generates errors for few cases (function-args/struct_args_5) if you do not include any
extern declarations (even if no intrinsics are being used), but that
needs to be fixed in the linker itself.

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

15 years agoNeeded #includes. Thanks Fritz van Bommel!
Bill Wendling [Sun, 10 May 2009 23:27:41 +0000 (23:27 +0000)]
Needed #includes. Thanks Fritz van Bommel!

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

15 years agoThis is a large rewrite of how Dwarf info for inlined functions is handled.
Bill Wendling [Sun, 10 May 2009 23:14:38 +0000 (23:14 +0000)]
This is a large rewrite of how Dwarf info for inlined functions is handled.

The DwarfWriter expects DbgScopes and DIEs to behave themselves according to
DwarfWriter's rules. However, inlined functions violate these rules. There are
two different types of DIEs associated with an inlined function: an abstract
instance, which has information about the original source code for the function
being inlined; and concrete instances, which are created for each place the
function was inlined and point back to the abstract instance.

This patch tries to stay true to this schema. It bypasses how regular DbgScopes
and DIEs are created and used when necessary. It provides special handling for
DIEs of abstract and concrete instances.

This doesn't take care of all of the problems with debug info for inlined
functions, but it's a step in the right direction. For one thing, llvm-gcc
generates wrong IR (it's missing some llvm.dbg intrinsics at the point where the
function's inlined) for this example:

#include <stdio.h>
static __inline__ __attribute__((always_inline))  int bar(int x) { return 4; }
void foo() {
  long long b = 1;
  int Y = bar(4);
  printf("%d\n", Y);
}

while clang generates correct IR.

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

15 years agoMake MDNode use CallbackVH. Also change MDNode to store Value* instead of
Nick Lewycky [Sun, 10 May 2009 20:57:05 +0000 (20:57 +0000)]
Make MDNode use CallbackVH. Also change MDNode to store Value* instead of
Constant* in preperation of a future change to support holding non-Constants
in an MDNode.

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

15 years agoModule iterator contains list of filescope functions as well, we don't need to emit...
Sanjiv Gupta [Sun, 10 May 2009 16:18:39 +0000 (16:18 +0000)]
Module iterator contains list of filescope functions as well, we don't need to emit and global declarations for them. This was working earlier and was broken during one of the recent commit for PIC16 naming.

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

15 years agoAdd imm-reg and imm-mem patters for cmp on msp430
Anton Korobeynikov [Sun, 10 May 2009 14:49:00 +0000 (14:49 +0000)]
Add imm-reg and imm-mem patters for cmp on msp430
(imm is allowed to be source operand, not dest...)

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

15 years agoAdd MSP430 test for PR4136
Anton Korobeynikov [Sun, 10 May 2009 14:48:36 +0000 (14:48 +0000)]
Add MSP430 test for PR4136

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

15 years agoChanged lowering and asmprinter to use ABI Names class called PAN.
Sanjiv Gupta [Sun, 10 May 2009 05:23:47 +0000 (05:23 +0000)]
Changed lowering and asmprinter to use ABI Names class called PAN.

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

15 years ago--- Reverse-merging r71370 into '.':
Bill Wendling [Sun, 10 May 2009 00:10:50 +0000 (00:10 +0000)]
--- Reverse-merging r71370 into '.':
U    lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp

Revert r71370.

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

15 years agoA debug function start was not being recorded when the optimization level wasn't
Bill Wendling [Sat, 9 May 2009 23:51:35 +0000 (23:51 +0000)]
A debug function start was not being recorded when the optimization level wasn't
None. However, we were always recording the region end. There's no longer a good
reason for this code to be separated out between the different opt levels, as it
was doing pretty much the same thing anyway.

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

15 years agoOops. Don't forget to align single bb loops.
Evan Cheng [Sat, 9 May 2009 19:18:01 +0000 (19:18 +0000)]
Oops. Don't forget to align single bb loops.

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

15 years agofix typo
Chris Lattner [Sat, 9 May 2009 18:11:50 +0000 (18:11 +0000)]
fix typo

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

15 years agoAllow scalar evolution to compute iteration counts for loops with a
Eli Friedman [Sat, 9 May 2009 12:32:42 +0000 (12:32 +0000)]
Allow scalar evolution to compute iteration counts for loops with a
pointer-based condition.  This fixes PR3171.

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

15 years agoRemove a completed optimization. Add a potential optimization I ran
Eli Friedman [Sat, 9 May 2009 08:40:15 +0000 (08:40 +0000)]
Remove a completed optimization.  Add a potential optimization I ran
into.

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

15 years agoRename PaddedSize to AllocSize, in the hope that this
Duncan Sands [Sat, 9 May 2009 07:06:46 +0000 (07:06 +0000)]
Rename PaddedSize to AllocSize, in the hope that this
will make it more obvious what it represents, and stop
it being confused with the StoreSize.

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

15 years agoUse 16 bit arithmetic while retrieving the address of callee's frame during indirect...
Sanjiv Gupta [Sat, 9 May 2009 05:11:19 +0000 (05:11 +0000)]
Use 16 bit arithmetic while retrieving the address of callee's frame during indirect function calls, and set pclath before every call to retrieve the frame address.

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

15 years agoFactor out code that optimize loop terminating condition.
Evan Cheng [Sat, 9 May 2009 01:08:24 +0000 (01:08 +0000)]
Factor out code that optimize loop terminating condition.

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

15 years agoDon't attempt to handle unsized types in ScalarEvolution's GEP analyzer.
Dan Gohman [Sat, 9 May 2009 00:14:52 +0000 (00:14 +0000)]
Don't attempt to handle unsized types in ScalarEvolution's GEP analyzer.

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

15 years agoEnable loop bb placement optimization.
Evan Cheng [Fri, 8 May 2009 23:35:49 +0000 (23:35 +0000)]
Enable loop bb placement optimization.

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

15 years agoFix bogus overflow checks by replacing them with actual
Dan Gohman [Fri, 8 May 2009 23:11:16 +0000 (23:11 +0000)]
Fix bogus overflow checks by replacing them with actual
overflow checks.

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

15 years agoPPC::B and PPC::BCC's target operand may be an immediate.
Evan Cheng [Fri, 8 May 2009 23:09:25 +0000 (23:09 +0000)]
PPC::B and PPC::BCC's target operand may be an immediate.

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

15 years agoIn non-pic builds, we can use -mdynamic-no-pic for a little more speed.
Mike Stump [Fri, 8 May 2009 23:08:58 +0000 (23:08 +0000)]
In non-pic builds, we can use -mdynamic-no-pic for a little more speed.

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

15 years agoUse .td for tablegen files, not .ll.
Dan Gohman [Fri, 8 May 2009 23:01:28 +0000 (23:01 +0000)]
Use .td for tablegen files, not .ll.

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

15 years agoAvoid warning in release-asserts build.
Mike Stump [Fri, 8 May 2009 22:53:06 +0000 (22:53 +0000)]
Avoid warning in release-asserts build.

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

15 years agoMirror how Fast ISel determines if a region.end intrinsic is the end of an
Bill Wendling [Fri, 8 May 2009 21:14:49 +0000 (21:14 +0000)]
Mirror how Fast ISel determines if a region.end intrinsic is the end of an
inlined function or the end of a function. Before, this was never executing the
"inlined" version of the Record method.

This will become important once the inlined Dwarf writer patch lands.

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

15 years agoFold trunc casts into add-recurrence expressions, allowing the
Dan Gohman [Fri, 8 May 2009 21:03:19 +0000 (21:03 +0000)]
Fold trunc casts into add-recurrence expressions, allowing the
add-recurrence to be exposed. Add a new SCEV folding rule to
help simplify expressions in the presence of these extra truncs.

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

15 years agoCompute the offsets of the compile units. We need this so that when we emit a
Bill Wendling [Fri, 8 May 2009 21:03:15 +0000 (21:03 +0000)]
Compute the offsets of the compile units. We need this so that when we emit a
concrete instance of an inlined function, we can get the actual address of the
abstract instance inside of the compile unit.

This isn't currently used, but will be by a future check-in.

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

15 years agoFix another bug in r71252. This code supports GetElementPtr
Dan Gohman [Fri, 8 May 2009 20:58:38 +0000 (20:58 +0000)]
Fix another bug in r71252. This code supports GetElementPtr
constant exprs as well as instructions.

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

15 years agoFix typo.
Bill Wendling [Fri, 8 May 2009 20:49:29 +0000 (20:49 +0000)]
Fix typo.

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

15 years agoAdd memoization for getSCEVAtScope results for instructions
Dan Gohman [Fri, 8 May 2009 20:47:27 +0000 (20:47 +0000)]
Add memoization for getSCEVAtScope results for instructions
which are not analyzed with SCEV techniques, which can require
brute-forcing through a large number of instructions. This
fixes a massive compile-time issue on 400.perlbench (in
particular, the loop in MD5Transform).

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

15 years agoMake the SCEV* form of getSCEVAtScope public, to allow ScalarEvolution
Dan Gohman [Fri, 8 May 2009 20:38:54 +0000 (20:38 +0000)]
Make the SCEV* form of getSCEVAtScope public, to allow ScalarEvolution
clients to use it.

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

15 years agoMinor clean ups. No functionality change.
Bill Wendling [Fri, 8 May 2009 20:38:02 +0000 (20:38 +0000)]
Minor clean ups. No functionality change.

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

15 years agoFix an error from r71252.
Dan Gohman [Fri, 8 May 2009 20:36:47 +0000 (20:36 +0000)]
Fix an error from r71252.

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

15 years agoPrint out nicer dump info for DIDescriptor.
Bill Wendling [Fri, 8 May 2009 20:28:06 +0000 (20:28 +0000)]
Print out nicer dump info for DIDescriptor.

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

15 years agoFactor out the code for creating SCEVs for GEPs into a
Dan Gohman [Fri, 8 May 2009 20:26:55 +0000 (20:26 +0000)]
Factor out the code for creating SCEVs for GEPs into a
separate function.

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

15 years agoImplement several new SCEV folding rules for UDiv SCEVs.
Dan Gohman [Fri, 8 May 2009 20:18:49 +0000 (20:18 +0000)]
Implement several new SCEV folding rules for UDiv SCEVs.
This fixes an old FIXME, and is needed by some upcoming changes.

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

15 years agoAdd a getExitBlock utility function to LoopInfo which returns the
Dan Gohman [Fri, 8 May 2009 20:07:23 +0000 (20:07 +0000)]
Add a getExitBlock utility function to LoopInfo which returns the
exit block of a loop, if there is exactly one, similar to
getExitingBlock.

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

15 years agoDon't align loop header unless the loop back edge is below the header.
Evan Cheng [Fri, 8 May 2009 19:01:44 +0000 (19:01 +0000)]
Don't align loop header unless the loop back edge is below the header.

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

15 years agoFactor out cycle-finder code and make it generic.
Anton Korobeynikov [Fri, 8 May 2009 18:51:58 +0000 (18:51 +0000)]
Factor out cycle-finder code and make it generic.

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

15 years agoDo not emit bit tests if target does not support natively left shift
Anton Korobeynikov [Fri, 8 May 2009 18:51:34 +0000 (18:51 +0000)]
Do not emit bit tests if target does not support natively left shift

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

15 years agoAllow 8 bit select in custom inserter
Anton Korobeynikov [Fri, 8 May 2009 18:51:21 +0000 (18:51 +0000)]
Allow 8 bit select in custom inserter

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

15 years agoProperly expand libcalls for urem / srem. Also make code more straightforward.
Anton Korobeynikov [Fri, 8 May 2009 18:51:08 +0000 (18:51 +0000)]
Properly expand libcalls for urem / srem. Also make code more straightforward.

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

15 years agoTypo
Anton Korobeynikov [Fri, 8 May 2009 18:50:54 +0000 (18:50 +0000)]
Typo

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

15 years agoExpand UREM / SREM into libcalls
Anton Korobeynikov [Fri, 8 May 2009 18:50:41 +0000 (18:50 +0000)]
Expand UREM / SREM into libcalls

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

15 years agoAdd 8 bit select
Anton Korobeynikov [Fri, 8 May 2009 18:50:26 +0000 (18:50 +0000)]
Add 8 bit select

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

15 years agoFix PR4152: asm constraint validation happens before dag combine, so we
Chris Lattner [Fri, 8 May 2009 18:23:14 +0000 (18:23 +0000)]
Fix PR4152: asm constraint validation happens before dag combine, so we
need to work a bit to combine things like (x+c1+c2) into x+c3.

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

15 years agoAdd some examples to show the difference between
Duncan Sands [Fri, 8 May 2009 17:49:48 +0000 (17:49 +0000)]
Add some examples to show the difference between
the various notions of type size used in LLVM.

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

15 years agoChange 'make install' to install tblgen, for better support of out-of-tree targets,
Chris Lattner [Fri, 8 May 2009 17:32:47 +0000 (17:32 +0000)]
Change 'make install' to install tblgen, for better support of out-of-tree targets,
patch by Mikael Lepistö!

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

15 years agofix RewriteStoreUserOfWholeAlloca to use the correct type size
Chris Lattner [Fri, 8 May 2009 15:54:41 +0000 (15:54 +0000)]
fix RewriteStoreUserOfWholeAlloca to use the correct type size
method, fixing a crash on PR4146.  While the store will
ultimately overwrite the "padded size" number of bits in memory,
the stored value may be a subset of this size.  This function
only wants to handle the case where all bits are stored.

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

15 years agoReverse branch condition only when there is a conditional branch.
Evan Cheng [Fri, 8 May 2009 09:35:53 +0000 (09:35 +0000)]
Reverse branch condition only when there is a conditional branch.

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

15 years agoAdd explicit braces to disambiguate nested if/else. Removes a warning.
Nick Lewycky [Fri, 8 May 2009 06:57:41 +0000 (06:57 +0000)]
Add explicit braces to disambiguate nested if/else. Removes a warning.

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

15 years agoThis transform requires valid TargetData info. Wrap it in 'if (TD)' in
Nick Lewycky [Fri, 8 May 2009 06:47:37 +0000 (06:47 +0000)]
This transform requires valid TargetData info. Wrap it in 'if (TD)' in
preparation for the day we use null TargetData when no target is specified.

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

15 years agoOptimize code placement in loop to eliminate unconditional branches or move unconditi...
Evan Cheng [Fri, 8 May 2009 06:34:09 +0000 (06:34 +0000)]
Optimize code placement in loop to eliminate unconditional branches or move unconditional branch to the outside of the loop. e.g.

///       A:
///       ...
///       <fallthrough to B>
///
///       B:  --> loop header
///       ...
///       jcc <cond> C, [exit]
///
///       C:
///       ...
///       jmp B
///
/// ==>
///
///       A:
///       ...
///       jmp B
///
///       C:  --> new loop header
///       ...
///       <fallthough to B>
///
///       B:
///       ...
///       jcc <cond> C, [exit]

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

15 years agoAdd missing #include for "strlen" which is used inline in this header. Fixes
Nick Lewycky [Fri, 8 May 2009 06:22:25 +0000 (06:22 +0000)]
Add missing #include for "strlen" which is used inline in this header. Fixes
build under gcc 4.3.

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

15 years agoMoved pic16 naming functions to correct place.
Sanjiv Gupta [Fri, 8 May 2009 04:50:14 +0000 (04:50 +0000)]
Moved pic16 naming functions to correct place.
No functionality change.

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

15 years agoPR4123: don't crash when inlining a call which uses its own result.
Eli Friedman [Fri, 8 May 2009 00:22:04 +0000 (00:22 +0000)]
PR4123: don't crash when inlining a call which uses its own result.

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

15 years agoFix pr4100. Do not remove no-op copies when they are dead. The register
Bob Wilson [Thu, 7 May 2009 23:47:03 +0000 (23:47 +0000)]
Fix pr4100.  Do not remove no-op copies when they are dead.  The register
scavenger gets confused about register liveness if it doesn't see them.
I'm not thrilled with this solution, but it only comes up when there are dead
copies in the code, which is something that hopefully doesn't happen much.

Here is what happens in pr4100: As shown in the following excerpt from the
debug output of llc, the source of a move gets reloaded from the stack,
inserting a new load instruction before the move.  Since that source operand
is a kill, the physical register is free to be reused for the destination
of the move.  The move ends up being a no-op, copying R3 to R3, so it is
deleted.  But, it leaves behind the load to reload %reg1028 into R3, and
that load is not updated to show that it's destination operand (R3) is dead.
The scavenger gets confused by that load because it thinks that R3 is live.

Starting RegAlloc of: %reg1025<def,dead> = MOVr %reg1028<kill>, 14, %reg0, %reg0
  Regs have values:
  Reloading %reg1028 into R3
  Last use of R3[%reg1028], removing it from live set
  Assigning R3 to %reg1025
  Register R3 [%reg1025] is never used, removing it from live set

Alternative solutions might be either marking the load as dead, or zapping
the load along with the no-op copy.  I couldn't see an easy way to do
either of those, though.

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

15 years agoFix a comment (again).
Bob Wilson [Thu, 7 May 2009 21:20:42 +0000 (21:20 +0000)]
Fix a comment (again).

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

15 years agoFix a comment.
Bob Wilson [Thu, 7 May 2009 21:19:45 +0000 (21:19 +0000)]
Fix a comment.

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

15 years agoRevert 71165. It did more than just revert 71158 and it introduced
Dan Gohman [Thu, 7 May 2009 19:46:24 +0000 (19:46 +0000)]
Revert 71165. It did more than just revert 71158 and it introduced
several regressions. The problem due to 71158 is now fixed.

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

15 years agoPerform constant folding on operands of instructions with non-void
Dan Gohman [Thu, 7 May 2009 19:43:39 +0000 (19:43 +0000)]
Perform constant folding on operands of instructions with non-void
types, such as loads and calls.

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

15 years agoSCEVComplexityCompare's new code was missing SCEVUDivExpr. Implement
Dan Gohman [Thu, 7 May 2009 19:23:21 +0000 (19:23 +0000)]
SCEVComplexityCompare's new code was missing SCEVUDivExpr. Implement
the SCEVUDivExpr case.

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

15 years agoRevert r70876 and add a testcase (@c7) showing the problem:
Duncan Sands [Thu, 7 May 2009 18:08:34 +0000 (18:08 +0000)]
Revert r70876 and add a testcase (@c7) showing the problem:
bits captured, but the pointer marked nocapture.  In fact
I now recall that this problem is why only readnone functions
returning void were considered before!  However keep a small
fix that was also in r70876: a readnone function returning
void can result in bits being captured if it unwinds, so
test for this.

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

15 years agoTemporarily revert r71158. It was causing a failure during a full bootstrap:
Bill Wendling [Thu, 7 May 2009 17:26:14 +0000 (17:26 +0000)]
Temporarily revert r71158. It was causing a failure during a full bootstrap:

checking for bcopy... no
checking for getc_unlocked... Assertion failed: (0 && "Unknown SCEV kind!"), function operator(), file /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore.roots/llvmCore~obj/src/lib/Analysis/ScalarEvolution.cpp, line 511.
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/libdecnumber/decUtility.c:360: 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.
make[4]: *** [decUtility.o] Error 1
make[4]: *** Waiting for unfinished jobs....
Assertion failed: (0 && "Unknown SCEV kind!"), function operator(), file /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore.roots/llvmCore~obj/src/lib/Analysis/ScalarEvolution.cpp, line 511.
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/libdecnumber/decNumber.c:5591: 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.
make[4]: *** [decNumber.o] Error 1
make[3]: *** [all-stage2-libdecnumber] Error 2
make[3]: *** Waiting for unfinished jobs....

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

15 years agoMake ScalarEvolution's GroupByComplexity more thorough. In addition
Dan Gohman [Thu, 7 May 2009 14:39:04 +0000 (14:39 +0000)]
Make ScalarEvolution's GroupByComplexity more thorough. In addition
to sorting SCEVs by their kind, sort SCEVs of the same kind according
to their operands. This helps avoid things like (a+b) being a distinct
expression from (b+a).

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

15 years agoTrim unnecessary headers. Code in Analysis shouldn't use Transforms
Dan Gohman [Thu, 7 May 2009 14:30:26 +0000 (14:30 +0000)]
Trim unnecessary headers. Code in Analysis shouldn't use Transforms
headers due to library dependencies.

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

15 years agoConstant-fold ptrtoint+add+inttoptr to gep when the pointer is an
Dan Gohman [Thu, 7 May 2009 14:24:56 +0000 (14:24 +0000)]
Constant-fold ptrtoint+add+inttoptr to gep when the pointer is an
array and the add is within range. This helps simplify expressions
expanded by ScalarEvolutionExpander.

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

15 years agoFactor out a common base class between SCEVCommutativeExpr and
Dan Gohman [Thu, 7 May 2009 14:00:19 +0000 (14:00 +0000)]
Factor out a common base class between SCEVCommutativeExpr and
SCEVAddRecExpr. This eliminates redundant code for visiting
all the operands of an expression.

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

15 years agoMove the tablegen-produced DebugLoc handling into a AsmWriter::processDebugLoc function.
Argyrios Kyrtzidis [Thu, 7 May 2009 13:55:51 +0000 (13:55 +0000)]
Move the tablegen-produced DebugLoc handling into a AsmWriter::processDebugLoc function.
No functionality change.

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

15 years agoCode refactoring.
Evan Cheng [Thu, 7 May 2009 05:49:39 +0000 (05:49 +0000)]
Code refactoring.

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

15 years agoRename "loop aligner" pass to "code placement optimization" pass.
Evan Cheng [Thu, 7 May 2009 05:42:24 +0000 (05:42 +0000)]
Rename "loop aligner" pass to "code placement optimization" pass.

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

15 years agoEliminate compiler warnings.
Evan Cheng [Thu, 7 May 2009 05:31:56 +0000 (05:31 +0000)]
Eliminate compiler warnings.

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

15 years agoAdd const modifiers.
Jakob Stoklund Olesen [Thu, 7 May 2009 04:41:26 +0000 (04:41 +0000)]
Add const modifiers.

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

15 years agoTHis doesn't fail.
Bill Wendling [Thu, 7 May 2009 01:41:42 +0000 (01:41 +0000)]
THis doesn't fail.

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

15 years agoJust turn aggressive stack coloring off at -O3.
Bill Wendling [Thu, 7 May 2009 01:33:38 +0000 (01:33 +0000)]
Just turn aggressive stack coloring off at -O3.

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

15 years agoTemporarily revert r71010. It was causing massive failures during self-hosting.
Bill Wendling [Thu, 7 May 2009 01:27:25 +0000 (01:27 +0000)]
Temporarily revert r71010. It was causing massive failures during self-hosting.

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

15 years agoMake DwarfWriter::RecordInlinedFnStart more like the other DwarfWriter's methods:
Argyrios Kyrtzidis [Thu, 7 May 2009 00:16:31 +0000 (00:16 +0000)]
Make DwarfWriter::RecordInlinedFnStart more like the other DwarfWriter's methods:
-Have it return a label ID
-Remove the unused Instruction parameter

No functionality change.

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

15 years agoUse stable_sort instead of plain sort to avoid the risk of generating
Dan Gohman [Wed, 6 May 2009 22:54:33 +0000 (22:54 +0000)]
Use stable_sort instead of plain sort to avoid the risk of generating
trivially different code on different hosts (due to differing
std::sort implementations).

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

15 years ago- Move some debug fields to coincide with how GCC emits them. No functionality
Bill Wendling [Wed, 6 May 2009 21:21:34 +0000 (21:21 +0000)]
- Move some debug fields to coincide with how GCC emits them. No functionality
  change.
- Reformatting.

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

15 years agoCMake: Use pthread library when requested and available.
Oscar Fuentes [Wed, 6 May 2009 20:42:04 +0000 (20:42 +0000)]
CMake: Use pthread library when requested and available.

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

15 years agoCMake: Updated lib/Target/PIC16/CMakeLists.txt.
Oscar Fuentes [Wed, 6 May 2009 20:40:05 +0000 (20:40 +0000)]
CMake: Updated lib/Target/PIC16/CMakeLists.txt.

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

15 years agoUse X86AddrNumOperands instead of magic constant one
Dale Johannesen [Wed, 6 May 2009 19:04:30 +0000 (19:04 +0000)]
Use X86AddrNumOperands instead of magic constant one
more place.  This fixes a bunch of x86-64 JIT regressions.
(Introduced when the value of the magic constant changed
in 68645.  At the time apparently nobody noticed; failures
were hidden in 70343-70439 by an unrelated bug, so showed
up again as "new" failures in 70440.)

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

15 years agoDo not use register as base ptr of pre- and post- inc/dec load / store nodes.
Evan Cheng [Wed, 6 May 2009 18:25:01 +0000 (18:25 +0000)]
Do not use register as base ptr of pre- and post- inc/dec load / store nodes.

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

15 years agoUnbreak the build.
Evan Cheng [Wed, 6 May 2009 18:00:56 +0000 (18:00 +0000)]
Unbreak the build.

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

15 years agoMake sure to use signed arithmetic in APInt to fix a regression.
David Greene [Wed, 6 May 2009 17:39:26 +0000 (17:39 +0000)]
Make sure to use signed arithmetic in APInt to fix a regression.

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

15 years agoSimplify code by using SmallVector's pop_back_val() instead of
Dan Gohman [Wed, 6 May 2009 17:22:41 +0000 (17:22 +0000)]
Simplify code by using SmallVector's pop_back_val() instead of
separate back() and pop_back() calls.

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

15 years agoAdd simplify_type specializations to allow WeakVH, AssertingVH, and
Dan Gohman [Wed, 6 May 2009 17:12:48 +0000 (17:12 +0000)]
Add simplify_type specializations to allow WeakVH, AssertingVH, and
CallbackVH to participate in dyn_cast, isa, etc. without needing
an explicit conversion.

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

15 years agoCMake: Updated lib/CodeGen/CMakeLists.txt.
Oscar Fuentes [Wed, 6 May 2009 14:56:40 +0000 (14:56 +0000)]
CMake: Updated lib/CodeGen/CMakeLists.txt.

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

15 years agoCMake: Detects libpthread and sets HAVE_LIBPTHREAD.
Oscar Fuentes [Wed, 6 May 2009 14:40:37 +0000 (14:40 +0000)]
CMake: Detects libpthread and sets HAVE_LIBPTHREAD.

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

15 years agoCMake: Added cmakedefine for HAVE_PTHREAD_H.
Oscar Fuentes [Wed, 6 May 2009 14:27:59 +0000 (14:27 +0000)]
CMake: Added cmakedefine for HAVE_PTHREAD_H.

Patch by Robert Schuster!

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

15 years agoNounwind is not valid for function return values.
Duncan Sands [Wed, 6 May 2009 13:51:18 +0000 (13:51 +0000)]
Nounwind is not valid for function return values.

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

15 years agoOCaml parameter attribute bindings from PR2752.
Duncan Sands [Wed, 6 May 2009 12:21:17 +0000 (12:21 +0000)]
OCaml parameter attribute bindings from PR2752.
Incomplete, but better than nothing.

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

15 years agoAdd generic expansion of SUB when ADD and XOR
Duncan Sands [Wed, 6 May 2009 11:29:50 +0000 (11:29 +0000)]
Add generic expansion of SUB when ADD and XOR
are legal.  Based on a patch by Micah Villmow.

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