Commit Graph

356 Commits

Author SHA1 Message Date
Victor Hernandez
9d0b704e3e Re-commit r86077 now that r86290 fixes the 179.art and 175.vpr ARM regressions.
Here is the original commit message:

This commit updates malloc optimizations to operate on malloc calls that have constant int size arguments.

Update CreateMalloc so that its callers specify the size to allocate:
MallocInst-autoupgrade users use non-TargetData-computed allocation sizes.
Optimization uses use TargetData to compute the allocation size.

Now that malloc calls can have constant sizes, update isArrayMallocHelper() to use TargetData to determine the size of the malloced type and the size of malloced arrays.
Extend getMallocType() to support malloc calls that have non-bitcast uses.

Update OptimizeGlobalAddressOfMalloc() to optimize malloc calls that have non-bitcast uses.  The bitcast use of a malloc call has to be treated specially here because the uses of the bitcast need to be replaced and the bitcast needs to be erased (just like the malloc call) for OptimizeGlobalAddressOfMalloc() to work correctly.

Update PerformHeapAllocSRoA() to optimize malloc calls that have non-bitcast uses.  The bitcast use of the malloc is not handled specially here because ReplaceUsesOfMallocWithGlobal replaces through the bitcast use.

Update OptimizeOnceStoredGlobal() to not care about the malloc calls' bitcast use.

Update all globalopt malloc tests to not rely on autoupgraded-MallocInsts, but instead use explicit malloc calls with correct allocation sizes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86311 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 00:16:28 +00:00
Victor Hernandez
df98761d08 Revert r86077 because it caused crashes in 179.art and 175.vpr on ARM
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86213 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 01:33:24 +00:00
Victor Hernandez
24f934d055 Update CreateMalloc so that its callers specify the size to allocate:
MallocInst-autoupgrade users use non-TargetData-computed allocation sizes.
Optimization uses use TargetData to compute the allocation size.

Now that malloc calls can have constant sizes, update isArrayMallocHelper() to use TargetData to determine the size of the malloced type and the size of malloced arrays.
Extend getMallocType() to support malloc calls that have non-bitcast uses.

Update OptimizeGlobalAddressOfMalloc() to optimize malloc calls that have non-bitcast uses.  The bitcast use of a malloc call has to be treated specially here because the uses of the bitcast need to be replaced and the bitcast needs to be erased (just like the malloc call) for OptimizeGlobalAddressOfMalloc() to work correctly.

Update PerformHeapAllocSRoA() to optimize malloc calls that have non-bitcast uses.  The bitcast use of the malloc is not handled specially here because ReplaceUsesOfMallocWithGlobal replaces through the bitcast use.

Update OptimizeOnceStoredGlobal() to not care about the malloc calls' bitcast use.

Update all globalopt malloc tests to not rely on autoupgraded-MallocInsts, but instead use explicit malloc calls with correct allocation sizes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86077 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 00:03:03 +00:00
Kenneth Uildriks
b908f8ad6a Make opt default to not adding a target data string and update tests that depend on target data to supply it within the test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85900 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03 15:29:06 +00:00
Edward O'Callaghan
4ea7d4c3eb Convert Analysis tests to FileCheck in regards to PR5307.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85241 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-27 14:54:46 +00:00
Dan Gohman
6665b0ea68 Teach BasicAA how to analyze Select instructions, and make it more
aggressive on PHI instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85158 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 21:55:43 +00:00
Dan Gohman
5639cb6b9e Update these tests to match what Loop::print now prints.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85021 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-24 23:52:07 +00:00
Chris Lattner
ec63ad6c1f fix test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84405 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 05:03:00 +00:00
Chris Lattner
e62b2633e8 tighten up test3, add test3a for the converse
transform, which isn't happening yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84402 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 04:55:26 +00:00
Chris Lattner
6e85d91144 tighten test2, add a test that it doesn't get transformed in the invalid edge case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84401 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 04:50:18 +00:00
Nick Lewycky
15d3c05adf Merge tests into modref.ll. Also add a test for r84174 at Chris' behest!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84400 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 04:41:36 +00:00
Nick Lewycky
c1a38f59b5 Add a couple new testcases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84385 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 00:42:07 +00:00
Chris Lattner
a22922d19a replace a useless test with a useful one
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84383 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 23:59:51 +00:00
Nick Lewycky
ca55ee03b0 Make use of the result of the loads even though that means adding -instcombine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84125 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 19:02:13 +00:00
Evan Cheng
681a33e26d Another BasicAA fix. If a value does not alias a GEP's base pointer, then it
cannot alias the GEP. GEP pointer alias rule states this clearly:
A pointer value formed from a getelementptr instruction is associated with the
addresses associated with the first operand of the getelementptr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84079 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 06:41:49 +00:00
Evan Cheng
2c4f28255b Replace test with a simpler hand crafted one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84069 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 01:45:10 +00:00
Evan Cheng
50a5914e12 Teach basic AA about PHI nodes. If all operands of a phi NoAlias another value than it's safe to declare the PHI NoAlias the value. Ditto for MustAlias.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84038 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 22:02:20 +00:00
Chris Lattner
2d175064ab don't use dead loads as tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83985 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 17:39:29 +00:00
Nick Lewycky
5c9be67cff Teach BasicAA a little something about the atomic intrinsics: they can only
modify through the pointer they're given.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83959 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 07:48:38 +00:00
Victor Hernandez
3e0c99a26f Revert 82694 "Auto-upgrade malloc instructions to malloc calls." because it causes regressions in the nightly tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82784 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 18:11:52 +00:00
Victor Hernandez
96b930ddc7 Auto-upgrade malloc instructions to malloc calls.
Reviewed by Devang Patel.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82694 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 17:47:49 +00:00
Dan Gohman
1f96e67f78 Teach ScalarEvolution how to reason about no-wrap flags on loops
where the induction variable has a non-unit stride, such as {0,+,2}, and
there are expressions such as {1,+,2} inside the loop formed with
or or add nsw operators.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82151 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 18:05:20 +00:00
Dan Gohman
cabfea2a58 Eliminate more redundant llvm-as calls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81540 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-11 18:17:12 +00:00
Dan Gohman
f2f6ce65b7 Change tests from "opt %s" to "opt < %s" so that opt doesn't see the
input filename so that opt doesn't print the input filename in the
output so that grep lines in the tests don't unintentionally match
strings in the input filename.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81537 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-11 18:01:28 +00:00
Dan Gohman
fce288fc91 Eliminate more uses of llvm-as and llvm-dis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81293 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 00:09:15 +00:00
Dan Gohman
7c1a96c7a7 Convert a few more opt | llvm-dis to opt -S.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81261 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-08 22:41:33 +00:00
Dan Gohman
3e054fe9ef Use opt -S instead of piping bitcode output through llvm-dis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81257 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-08 22:34:10 +00:00
Dan Gohman
b1e1e82c54 Change these tests to feed the assembly files to opt directly, instead
of using llvm-as, now that opt supports this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81226 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-08 16:50:01 +00:00
Andreas Neustifter
365b18eba6 Updated tests to use ProfileVerifer to test ProfileLoader and ProfileEstimator.
(Keep disabled test disabled until selfhosted build issue is resolved.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81008 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-04 17:21:59 +00:00
Daniel Dunbar
b5f25967d0 Revert "--- Reverse-merging r80908 into '.':", I already "fixed" this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80970 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 23:40:10 +00:00
Bill Wendling
1c5ffdf987 --- Reverse-merging r80908 into '.':
D    test/Analysis/Profiling

--- Reverse-merging r80907 into '.':
U    lib/Analysis/ProfileInfoLoaderPass.cpp

Attempt to remove failure in the self-hosting build bot.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80966 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 23:13:46 +00:00
Daniel Dunbar
57ed2224b3 Disable some parts of the profiling-tool-chain test, which is currently failing
on a self-hosted build (although it seems to work on non-self hosted). I'll work
with Andreas to figure this out.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80947 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 21:09:53 +00:00
Daniel Dunbar
3a22ff3eac Reapply profiling tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80908 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 07:38:00 +00:00
Andreas Neustifter
ca172ae477 Removed temporarily because of breaking Darwin builds.
(See http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090831/086214.html)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80799 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 16:47:24 +00:00
Andreas Neustifter
793d4a8467 Changed profiling-tool-chain.ll test to use optimal-edge-profiling instead of
edge-profiling, this is more useful since the loading of the
optimal-edge-profiling is more complicated.
The edge-profiling is tested in edge-profiling.ll where only the
instrumentation is tested.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80791 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 14:24:08 +00:00
Daniel Dunbar
545898183e Don't force the triple or data layout in this test. We just have to get them
from the host and hope that works.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80751 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 02:43:11 +00:00
Chris Lattner
b2e673c563 rename test so that name reflects what it is testing for.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80519 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 21:36:39 +00:00
Chris Lattner
aaf615951c convert to filecheck format.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80518 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 21:36:06 +00:00
Torok Edwin
1cb2de3188 rm needs -f
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80363 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 14:05:07 +00:00
Torok Edwin
0debb15baf Remove the llvmprof.out from the test output, otherwise running
make check in a non-clean directory causes it to fail (for example when running
make check twice), since execution counts will differ.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80362 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 13:35:44 +00:00
Andreas Neustifter
1896727eae Remove profiling output file because two consecutive runs of make check give
error.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80357 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 10:38:26 +00:00
Andreas Neustifter
cf4f7199c9 Removed unnecessary file creation during test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80356 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 10:07:41 +00:00
Andreas Neustifter
82fdcede12 Pulled all tests into one test. Removed some redundant tests. Rename.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80355 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 10:00:28 +00:00
Andreas Neustifter
798261ccf5 Readded test from r79615, this tests the complete profiling tool chain. Furhter
tests can test only parts of this system.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80348 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 06:41:00 +00:00
Dan Gohman
2385e0e22c Create a ScalarEvolution-based AliasAnalysis implementation.
This is a simple AliasAnalysis implementation which works by making
ScalarEvolution queries. ScalarEvolution has a more complete understanding
of arithmetic than BasicAA's collection of ad-hoc checks, so it handles
some cases that BasicAA misses, for example p[i] and p[i+1] within the
same iteration of a loop.

This is currently experimental. It may be that the main use for this pass
will be to help find cases where BasicAA can be profitably extended, or
to help in the development of the overall AliasAnalysis infrastructure,
however it's also possible that it could grow up to become a directly
useful pass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80098 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26 14:53:06 +00:00
Andreas Neustifter
4678c2d438 Removed profiling test, lli not available on all platforms.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79633 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-21 15:27:35 +00:00
Andreas Neustifter
e879bdad49 Added tests for Profiling Infrastructure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79615 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-21 09:36:28 +00:00
Dan Gohman
7a7be366a7 Loosen up the regex for this test so that it doesn't implicitly
depend on TargetData information.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79491 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-19 23:19:36 +00:00
Dan Gohman
683e922d29 Make LLVM Assembly dramatically easier to read by aligning the comments,
using formatted_raw_ostream's PadToColumn.

Before:

bb1:            ; preds = %bb
  %2 = sext i32 %i.01 to i64            ; <i64> [#uses=1]
  %3 = getelementptr double* %p, i64 %2         ; <double*> [#uses=1]
  %4 = load double* %3, align 8         ; <double> [#uses=1]
  %5 = fmul double %4, 1.100000e+00             ; <double> [#uses=1]
  %6 = sext i32 %i.01 to i64            ; <i64> [#uses=1]
  %7 = getelementptr double* %p, i64 %6         ; <double*> [#uses=1]

After:

bb1:                                        ; preds = %bb
  %2 = sext i32 %i.01 to i64                ; <i64> [#uses=1]
  %3 = getelementptr double* %p, i64 %2     ; <double*> [#uses=1]
  %4 = load double* %3, align 8             ; <double> [#uses=1]
  %5 = fmul double %4, 1.100000e+00         ; <double> [#uses=1]
  %6 = sext i32 %i.01 to i64                ; <i64> [#uses=1]
  %7 = getelementptr double* %p, i64 %6     ; <double*> [#uses=1]

Several tests required whitespace adjustments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78816 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-12 17:23:50 +00:00
Andreas Bolka
e2652f2cd3 Add another Strong-SIV testcase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78446 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-08 00:21:49 +00:00