Commit Graph

8367 Commits

Author SHA1 Message Date
Bob Wilson 3ab552ec74 Reimplement BranchFolding change to avoid tail merging for a 1 instruction
common tail, except when the OptimizeForSize function attribute is present.
Radar 7338114.

llvm-svn: 85441
2009-10-28 22:10:20 +00:00
Victor Hernandez 0d025421cd Extend getMallocArraySize() to determine the array size if the malloc argument is:
ArraySize * ElementSize
ElementSize * ArraySize
ArraySize << log2(ElementSize)
ElementSize << log2(ArraySize)

Refactor isArrayMallocHelper and delete isSafeToGetMallocArraySize, so that there is only 1 copy of the malloc array determining logic.
Update users of getMallocArraySize() to not bother calling isArrayMalloc() as well.

llvm-svn: 85421
2009-10-28 20:18:55 +00:00
Owen Anderson 2b2bd28973 Treat lifetime begin/end markers as allocations/frees respectively for the
purposes for GVN/DSE.

llvm-svn: 85383
2009-10-28 07:05:35 +00:00
Owen Anderson fc16e5a98f Be more careful about invariance reasoning on "store" queries. Stores still need
to depend on Ref and ModRef calls within the invariant region.

llvm-svn: 85380
2009-10-28 06:30:52 +00:00
Owen Anderson d0e86d57c1 Add trivial support for the invariance intrinsics to memdep. This logic is
purely local for now.

llvm-svn: 85378
2009-10-28 06:18:42 +00:00
Chris Lattner 5956dc87d3 add bitcode reader support for blockaddress. We can now fully
round trip blockaddress through .ll and .bc files, so add a testcase.

There are still a bunch of places in the optimizer and other places
that need to be updated to work with these constructs, but at least
the basics are in now.

llvm-svn: 85377
2009-10-28 05:53:48 +00:00
Dan Gohman 1b44f10ff4 Teach MachineLICM to unfold loads from constant memory from
otherwise unhoistable instructions in order to allow the loads
to be hoisted.

llvm-svn: 85364
2009-10-28 03:21:57 +00:00
Evan Cheng 4a609f3cef Use fconsts and fconstd to materialize small fp constants.
llvm-svn: 85362
2009-10-28 01:44:26 +00:00
Dan Gohman 4b46cbfc23 Mark dead physregdefs dead immediately. This helps MachineSink and
MachineLICM and other things which run before LiveVariables is run.

llvm-svn: 85360
2009-10-28 01:13:53 +00:00
Dan Gohman 75d6a4afd2 Allow constants of different types to share constant pool entries
if they have compatible encodings.

llvm-svn: 85359
2009-10-28 01:12:16 +00:00
Chris Lattner d04cb6d0fa rename indbr -> indirectbr to appease the residents of #llvm.
llvm-svn: 85351
2009-10-28 00:19:10 +00:00
Dale Johannesen 26bc62c788 Add radar number.
llvm-svn: 85290
2009-10-27 20:12:38 +00:00
Dale Johannesen bda7fee4a8 Testcase for llvm-gcc patch 85284.
llvm-svn: 85287
2009-10-27 20:06:05 +00:00
Chris Lattner 3ed871fe62 add enough support for indirect branch for the feature test to pass
(assembler,asmprinter, bc reader+writer) and document it.  Codegen
currently aborts on it.

llvm-svn: 85274
2009-10-27 19:13:16 +00:00
Rafael Espindola d92a3633e1 Add missing testcase.
llvm-svn: 85266
2009-10-27 17:59:03 +00:00
Chris Lattner 1ed8bb16b8 change of mind :)
llvm-svn: 85258
2009-10-27 17:40:49 +00:00
Chris Lattner 1f8f60e62f rename test.
llvm-svn: 85256
2009-10-27 17:40:19 +00:00
Edward O'Callaghan f96ce30236 Convert Analysis tests to FileCheck in regards to PR5307.
llvm-svn: 85241
2009-10-27 14:54:46 +00:00
Bob Wilson 3d43b38f0f Fix Thumb2 failures by converting them to FileCheck.
llvm-svn: 85210
2009-10-27 06:31:02 +00:00
Bob Wilson d169e6c281 Fix the rest of the ARM failures by converting them to FileCheck.
llvm-svn: 85208
2009-10-27 06:16:45 +00:00
Bob Wilson 04580c8307 Fix some more failures by converting to FileCheck.
llvm-svn: 85207
2009-10-27 05:50:28 +00:00
Chris Lattner c6b3b25f94 Fix a pretty serious misfeature of the inliner: if it inlines a function
with multiple return values it inserts a PHI to merge them all together.
However, if the return values are all the same, it ends up with a pointless
PHI and this pointless PHI happens to really block SRoA from happening in 
at least a silly C++ example written by Doug, but probably others.  This 
fixes rdar://7339069.

llvm-svn: 85206
2009-10-27 05:39:41 +00:00
Chris Lattner 58ee24c8bf convert to filecheck.
llvm-svn: 85205
2009-10-27 05:35:35 +00:00
Bob Wilson e8d20795a3 Convert to FileCheck, fixing failure due to tab change in the process.
llvm-svn: 85204
2009-10-27 05:30:47 +00:00
Edward O'Callaghan e45ac76ee4 Convert a few tests to FileCheck for PR5307.
llvm-svn: 85171
2009-10-26 22:52:03 +00:00
Dan Gohman 672927f393 Code that checks WillNotOverflowSignedAdd before creating an Add
can safely use the NSW bit on the Add.

llvm-svn: 85164
2009-10-26 22:14:22 +00:00
Dan Gohman 3b7ba5f35b Teach BasicAA how to analyze Select instructions, and make it more
aggressive on PHI instructions.

llvm-svn: 85158
2009-10-26 21:55:43 +00:00
David Goodwin 8370485db9 Break anti-dependence breaking out into its own class.
llvm-svn: 85127
2009-10-26 16:59:04 +00:00
Chris Lattner 683eed3286 reapply r85085 with a bugfix to avoid infinite looping.
All of the 'demorgan' related xforms need to use 
dyn_castNotVal, not m_Not.

llvm-svn: 85119
2009-10-26 15:40:07 +00:00
Dan Gohman d632f89596 Make LSR's OptimizeShadowIV ignore induction variables with negative
strides for now, because it doesn't handle them correctly. This fixes a
miscompile of SingleSource/Benchmarks/Misc-C++/ray.

This problem was usually hidden because indvars transforms such induction
variables into negations of canonical induction variables.

llvm-svn: 85118
2009-10-26 15:32:57 +00:00
Evan Cheng b81cb2a9a8 - Revert some changes from 85044, 85045, and 85047 that broke x86_64 tests and
bootstrapping. It's not safe to leave identity subreg_to_reg and insert_subreg
  around.
- Relax register scavenging to allow use of partially "not-live" registers. It's
  common for targets to operate on registers where the top bits are undef. e.g.
  s0 =
  d0 = insert_subreg d0<undef>, s0, 1
  ...
     = d0
  When the insert_subreg is eliminated by the coalescer, the scavenger used to
  complain. The previous fix was to keep to insert_subreg around. But that's
  brittle and it's overly conservative when we want to use the scavenger to 
  allocate registers. It's actually legal and desirable for other instructions
  to use the "undef" part of d0. e.g.
  s0 =
  d0 = insert_subreg d0<undef>, s0, 1
  ...
  s1 =
     = s1
     = d0
  We probably need add a "partial-undef" marker on machine operand so the
  machine verifier would not complain.

llvm-svn: 85091
2009-10-26 04:56:07 +00:00
Evan Cheng 8014a728b9 Revert 85085. It causes infinite looping during llvm-gcc build.
llvm-svn: 85090
2009-10-26 03:51:32 +00:00
Edward O'Callaghan 8a8e520937 Fix gmake check for AuroraUX triple.
llvm-svn: 85088
2009-10-26 02:37:56 +00:00
Chris Lattner 2e6564d6ff Implement PR3266 & PR5276, folding:
not (or (icmp, icmp)) -> and(icmp, icmp)

llvm-svn: 85085
2009-10-26 01:06:31 +00:00
Chris Lattner 52880b29d2 convert or.ll to filecheck and merge or2 into it.
llvm-svn: 85083
2009-10-25 23:47:55 +00:00
Chris Lattner e38317f432 fix PR5295 where the .ll parser didn't reject a function after a global
or global after a function with conflicting names.  Update some testcases
that were accidentally depending on this behavior.

llvm-svn: 85081
2009-10-25 23:22:50 +00:00
Evan Cheng 69140ec4fa Add a couple of ARM cross-rc coalescing tests.
llvm-svn: 85051
2009-10-25 08:01:41 +00:00
Evan Cheng b9f3520660 Update tests.
llvm-svn: 85050
2009-10-25 07:53:48 +00:00
Mikhail Glushenkov 9b291a0862 Add a test for OptionPreprocessor.
llvm-svn: 85029
2009-10-25 01:43:50 +00:00
Dan Gohman 7f2413f18b Update these tests to match what Loop::print now prints.
llvm-svn: 85021
2009-10-24 23:52:07 +00:00
Dan Gohman a484d17ec5 Make these tests more interesting by using
-verify-dom-info and -verify-loop-info, which enable additional
(expensive) consistency checks.

llvm-svn: 85017
2009-10-24 23:23:04 +00:00
Daniel Dunbar c9c49bde3b Teach macho-dump to dump UUIDs.
llvm-svn: 85012
2009-10-24 20:32:36 +00:00
Chris Lattner 9e2d5b3b8e fix PR5287, a serious regression from my previous patches. Thanks to
Duncan for the nice tiny testcase.

llvm-svn: 84992
2009-10-24 05:22:15 +00:00
Victor Hernandez e297149e26 Auto-upgrade free instructions to calls to the builtin free function.
Update all analysis passes and transforms to treat free calls just like FreeInst.
Remove RaiseAllocations and all its tests since FreeInst no longer needs to be raised.

llvm-svn: 84987
2009-10-24 04:23:03 +00:00
Dan Gohman 4ef112be62 APInt-ify the gep scaling code, so that it correctly handles the case where
the scale overflows pointer-sized arithmetic. This fixes PR5281.

llvm-svn: 84954
2009-10-23 17:57:43 +00:00
Dan Gohman 41d00ac45b Make LoopDeletion check the maximum backedge taken count, rather than the
exact backedge taken count, when checking for infinite loops. This allows
it to delete loops with multiple exit conditions.

llvm-svn: 84952
2009-10-23 17:10:01 +00:00
Chris Lattner ccf1e84779 teach libanalysis to simplify vector loads with bitcast sources. This
implements something out of Target/README.txt producing:

_foo:                                                       ## @foo
	movl	4(%esp), %eax
	movapd	LCPI1_0, %xmm0
	movapd	%xmm0, (%eax)
	ret	$4

instead of:

_foo:                                                       ## @foo
	movl	4(%esp), %eax
	movapd	_b, %xmm0
	mulpd	LCPI1_0, %xmm0
	addpd	_a, %xmm0
	movapd	%xmm0, (%eax)
	ret	$4

llvm-svn: 84942
2009-10-23 06:57:37 +00:00
Chris Lattner 59f94c01dd enhance FoldReinterpretLoadFromConstPtr to handle loads of up to 32
bytes (i256).

llvm-svn: 84941
2009-10-23 06:50:36 +00:00
Chris Lattner ed00b80bf8 teach libanalysis to fold int and fp loads from almost arbitrary
non-type-safe constant initializers.  This sort of thing happens
quite a bit for 4-byte loads out of string constants, unions, 
bitfields, and an interesting endianness check from sqlite, which
is something like this:

const int sqlite3one = 1;
# define SQLITE_BIGENDIAN    (*(char *)(&sqlite3one)==0)
# define SQLITE_LITTLEENDIAN (*(char *)(&sqlite3one)==1)
# define SQLITE_UTF16NATIVE (SQLITE_BIGENDIAN?SQLITE_UTF16BE:SQLITE_UTF16LE)

all of these macros now constant fold away.

This implements PR3152 and is based on a patch started by Eli, but heavily
modified and extended.

llvm-svn: 84936
2009-10-23 06:23:49 +00:00
Evan Cheng 36f4bd0b62 Update tests for 84931.
llvm-svn: 84932
2009-10-23 05:58:34 +00:00