1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00
Commit Graph

2080 Commits

Author SHA1 Message Date
Dan Gohman
820b45049b Handle ands with ~0 correctly too. This fixes PR4052.
llvm-svn: 70176
2009-04-27 01:41:10 +00:00
Dan Gohman
9eb5ba6eb7 Handle ands with 0 and shifts by 0 correctly. These aren't
common, but indvars shouldn't crash on them. This fixes PR4054.

llvm-svn: 70051
2009-04-25 17:05:40 +00:00
Dan Gohman
c0f47d6ec1 Change SCEVExpander's expandCodeFor to provide more flexibility
with the persistent insertion point, and change IndVars to make
use of it. This fixes a bug where IndVars was holding on to a
stale insertion point and forcing the SCEVExpander to continue to
use it.

This fixes PR4038.

llvm-svn: 69892
2009-04-23 15:16:49 +00:00
Nick Lewycky
32cfba44df Simplify trunc(extend(x)) in SCEVs, just for completeness. Also fix some odd
whitespace in the same file.

llvm-svn: 69870
2009-04-23 05:15:08 +00:00
Devang Patel
7daece3796 Fix cut-n-pasto.
llvm-svn: 69816
2009-04-22 18:51:05 +00:00
Dan Gohman
d6edb69103 Simplify trivial cast-of-cast SCEVs.
llvm-svn: 69809
2009-04-22 16:20:48 +00:00
Dan Gohman
0ab6ecf6a1 SCEVExpander's InsertCastOfTo knows how to move existing cast
instructions in order to avoid inserting new ones. However, if
the cast instruction is the SCEVExpander's InsertPt, this
causes subsequently emitted instructions to be inserted near
the cast, and not at the location of the original insert point.
Fix this by adjusting the insert point in such cases.
This fixes PR4009.

llvm-svn: 69808
2009-04-22 16:11:16 +00:00
Dan Gohman
471996598f Use BasicBlock::iterator instead of Instruction* for insert points,
to better handle inserting instructions at the end of a block.

llvm-svn: 69807
2009-04-22 16:05:50 +00:00
Dan Gohman
4cb9d25f4a De-pImpl-ify ScalarEvolution. The pImpl pattern doesn't provide much
practical benefit in the case of ScalarEvolution, and it's otherwise
a nuisance.

llvm-svn: 69749
2009-04-21 23:15:49 +00:00
Dan Gohman
19990f2310 When turning (ashr(shl(x, n), n)) into sext(trunc(x)), the width of the
type to truncate to should be the number of bits of the value that are
preserved, not the number that are clobbered with sign-extension.
This fixes regressions in ldecod.

llvm-svn: 69704
2009-04-21 20:18:36 +00:00
Dan Gohman
5cf1e72db9 Teach ScalarEvolution how to recognize zext-inreg and sext-inreg,
as they appear in LLVM IR. This isn't particularly interesting
on its own; this is just setting up some infrastructure.

llvm-svn: 69655
2009-04-21 02:26:00 +00:00
Dan Gohman
f920d0a020 This FIXME is fixed, now that SCEV understands pointers.
llvm-svn: 69651
2009-04-21 01:41:18 +00:00
Dan Gohman
4e3e945880 Factor out a common base class from SCEVTruncateExpr, SCEVZeroExtendExpr,
and SCEVSignExtendExpr.

llvm-svn: 69649
2009-04-21 01:25:57 +00:00
Dan Gohman
2f8d813b3a Usage getAnalysisToUpdate for TargetData, per PR760.
llvm-svn: 69645
2009-04-21 01:11:19 +00:00
Dan Gohman
55d8490e7b Introduce encapsulation for ScalarEvolution's TargetData object, and refactor
the code to minimize dependencies on TargetData.

llvm-svn: 69644
2009-04-21 01:07:12 +00:00
Dan Gohman
5665fdf2e3 Move some assertion checks so they can do more complete checking.
llvm-svn: 69643
2009-04-21 00:55:22 +00:00
Dan Gohman
dd1bfdc7b1 Convert ScalarEvolution to use raw_ostream instead of OStream.
llvm-svn: 69640
2009-04-21 00:47:46 +00:00
Dan Gohman
f691991a39 Add a ScalarEvolution::getCouldNotCompute() function, and use it
instead of allocating and leaking new SCEVCouldNotCompute objects.

llvm-svn: 69452
2009-04-18 17:58:19 +00:00
Dan Gohman
fa9db353be More const qualifiers.
llvm-svn: 69451
2009-04-18 17:57:20 +00:00
Dan Gohman
e2e949ee98 Use more const qualifiers with SCEV interfaces.
llvm-svn: 69450
2009-04-18 17:56:28 +00:00
Dan Gohman
fa5d93b54c Handle a pointer type correctly in SCEVExpander::visitAddRecExpr.
llvm-svn: 69310
2009-04-16 21:34:54 +00:00
Dan Gohman
99b21e5635 Fix a bug with inttoptr/ptrtoint casts where the pointer has a different
size from the integer, requiring zero extension or truncation. Don't
create ZExtInsts with pointer types. This fixes a regression in
consumer-jpeg.

llvm-svn: 69307
2009-04-16 19:25:55 +00:00
Dan Gohman
f7f9a14400 Fix SCEVExpander::visitSMaxExpr and SCEVExpander::visitUMaxExpr to
not create ICmpInsts with operands of different types. This fixes
a regression in Applications/d/make_dparser.

llvm-svn: 69294
2009-04-16 16:15:25 +00:00
Dan Gohman
1482541677 Teach SCEVExpander::InsertCastOfTo to avoid creating inttoptr-of-ptrtoint
and ptrtoint-of-inttoptr expressions. This fixes a regression in 300.twolf.

llvm-svn: 69293
2009-04-16 15:52:57 +00:00
Dan Gohman
98aa1d9693 Expand GEPs in ScalarEvolution expressions. SCEV expressions can now
have pointer types, though in contrast to C pointer types, SCEV
addition is never implicitly scaled. This not only eliminates the
need for special code like IndVars' EliminatePointerRecurrence
and LSR's own GEP expansion code, it also does a better job because
it lets the normal optimizations handle pointer expressions just
like integer expressions.

Also, since LLVM IR GEPs can't directly index into multi-dimensional
VLAs, moving the GEP analysis out of client code and into the SCEV
framework makes it easier for clients to handle multi-dimensional
VLAs the same way as other arrays.

Some existing regression tests show improved optimization.
test/CodeGen/ARM/2007-03-13-InstrSched.ll in particular improved to
the point where if-conversion started kicking in; I turned it off
for this test to preserve the intent of the test.

llvm-svn: 69258
2009-04-16 03:18:22 +00:00
Devang Patel
ec716faf9e Add a method to check that the subprogram holds debug info for the given Function or not.
llvm-svn: 69113
2009-04-15 00:06:07 +00:00
Chris Lattner
30287478df use higher level APIs.
llvm-svn: 68351
2009-04-03 00:02:39 +00:00
Devang Patel
94dbbb5768 getEntryFor() may invalidate DenseMap iterator.
Walking an invalidated iterator is not a good idea.

llvm-svn: 68047
2009-03-30 18:34:47 +00:00
Chris Lattner
feee87e253 now that you can put a PointerIntPair in a SmallPtrSet, remove some
hackish workarounds from memdep

llvm-svn: 67971
2009-03-29 00:24:04 +00:00
Devang Patel
8c31ea5290 Before deleting a basic block, give other loop passes a chance cleanup analysis values, related to the instructions in the basic block.
llvm-svn: 67719
2009-03-25 23:57:48 +00:00
Devang Patel
65314415af Do not ignore DW_TAG_class_type!
llvm-svn: 67675
2009-03-25 03:52:06 +00:00
Gabor Greif
c988c96b3e simplify logic and get rid of the assumption that operand 0 is the callee
llvm-svn: 67642
2009-03-24 19:28:39 +00:00
Dan Gohman
b10c534b89 LoopVR is not CFGOnly.
llvm-svn: 67524
2009-03-23 15:50:52 +00:00
Dan Gohman
9ef382068e Enhance LiveValues to work on PHI operands.
llvm-svn: 67523
2009-03-23 15:49:37 +00:00
Dan Gohman
0d6f464b57 The last use in a block that doesn't have successors
(return or unreachable) is a kill.

llvm-svn: 67357
2009-03-20 01:28:21 +00:00
Sebastian Redl
e4e5b1c2f2 Fix the Win32 VS2008 build:
- Make type declarations match the struct/class keyword of the definition.
 - Move AddSignalHandler into the namespace where it belongs.
 - Correctly call functions from template base.
 - Some other small changes.
With this patch, LLVM and Clang should build properly and with far less noise under VS2008.

llvm-svn: 67347
2009-03-19 23:26:52 +00:00
Dale Johannesen
672ef54d0f Clear the cached cost when removing a function in
the inliner; prevents nondeterministic behavior
when the same address is reallocated.
Don't build call graph nodes for debug intrinsic calls;
they're useless, and there were typically a lot of them.

llvm-svn: 67311
2009-03-19 18:03:56 +00:00
Dan Gohman
c6899f6200 Add a liveness analysis pass for LLVM IR values. This computes
the set of blocks in which values are used, the set in which
values are live-through, and the set in which values are
killed. For the live-through and killed sets, conservative
approximations are used.

llvm-svn: 67309
2009-03-19 17:29:04 +00:00
Bill Wendling
96e37540a0 Revert r66920. It was causing failures in the self-hosting buildbot (in release
mode).

Running /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/dg.exp ...
FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll
Failed with signal(SIGBUS) at line 1
while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll -bugpoint-crashcalls -silence-passes > /dev/null
0   bugpoint          0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85
1   bugpoint          0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706
2   libSystem.B.dylib 0x92f112bb _sigtramp + 43
3   libSystem.B.dylib 0xffffffff _sigtramp + 1829694831
4   bugpoint          0x00021d1c main + 92
5   bugpoint          0x00002106 start + 54
6   bugpoint          0x00000004 start + 18446744073709543220
Stack dump:
0.    Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll -bugpoint-crashcalls -silence-passes 

FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll
Failed with signal(SIGBUS) at line 1
while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll -dce -bugpoint-deletecalls -simplifycfg -silence-passes
0   bugpoint          0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85
1   bugpoint          0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706
2   libSystem.B.dylib 0x92f112bb _sigtramp + 43
3   libSystem.B.dylib 0xffffffff _sigtramp + 1829694831
4   bugpoint          0x00021d1c main + 92
5   bugpoint          0x00002106 start + 54
6   bugpoint          0x00000006 start + 18446744073709543222
Stack dump:
0.    Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll -dce -bugpoint-deletecalls -simplifycfg -silence-passes 

FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll
Failed with signal(SIGBUS) at line 1
while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll  -bugpoint-crashcalls -silence-passes
0   bugpoint          0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85
1   bugpoint          0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706
2   libSystem.B.dylib 0x92f112bb _sigtramp + 43
3   libSystem.B.dylib 0xffffffff _sigtramp + 1829694831
4   bugpoint          0x00021d1c main + 92
5   bugpoint          0x00002106 start + 54
Stack dump:
0.    Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll -bugpoint-crashcalls -silence-passes 

--- Reverse-merging (from foreign repository) r66920 into '.':
U    include/llvm/Support/CallSite.h
U    include/llvm/Instructions.h
U    lib/Analysis/IPA/GlobalsModRef.cpp
U    lib/Analysis/IPA/Andersens.cpp
U    lib/Bitcode/Writer/BitcodeWriter.cpp
U    lib/VMCore/Instructions.cpp
U    lib/VMCore/Verifier.cpp
U    lib/VMCore/AsmWriter.cpp
U    lib/Transforms/Utils/LowerInvoke.cpp
U    lib/Transforms/Scalar/SimplifyCFGPass.cpp
U    lib/Transforms/IPO/PruneEH.cpp
U    lib/Transforms/IPO/DeadArgumentElimination.cpp

llvm-svn: 66953
2009-03-13 21:15:59 +00:00
Gabor Greif
6a76677e1b Second installment of "BasicBlock operands to the back"
changes.

For InvokeInst now all arguments begin at op_begin().
The Callee, Cont and Fail are now faster to get by
access relative to op_end().

This patch introduces some temporary uglyness in CallSite.
Next I'll bring CallInst up to a similar scheme and then
the uglyness will magically vanish.

This patch also exposes all the reliance of the libraries
on InvokeInst's operand ordering. I am thinking of taking
care of that too.

llvm-svn: 66920
2009-03-13 18:27:29 +00:00
Bill Wendling
5499163a0a Oops...I committed too much.
llvm-svn: 66867
2009-03-13 04:39:26 +00:00
Bill Wendling
02a239b837 Temporarily XFAIL this test.
llvm-svn: 66866
2009-03-13 04:37:11 +00:00
Dale Johannesen
e6adfccf09 Debug intriniscs should be skipped when looking
for a dependency, not terminate the search.

llvm-svn: 66709
2009-03-11 21:13:01 +00:00
Torok Edwin
25781329c4 Make Print callable from a pass's print method: add const qualifier. No
functionality change.

llvm-svn: 66700
2009-03-11 20:50:17 +00:00
Torok Edwin
3324e1f491 Global variables don't have a corresponding llvm.dbg.declare, yet it is possible
to obtain debug info about them.
Introduce helpers to access debug info for global variables. Also introduce a
helper that works for both local and global variables.

llvm-svn: 66541
2009-03-10 13:41:26 +00:00
Owen Anderson
0a24181b95 Ignore debug intrinsics when computing dependences.
llvm-svn: 66399
2009-03-09 05:12:38 +00:00
Chris Lattner
d5dd4590b5 reimplement AliasSetTracker in terms of DenseMap instead of hash_map,
hopefully no functionality change.

llvm-svn: 66398
2009-03-09 05:11:09 +00:00
Bill Wendling
13fcab1ef3 Pass in a std::string when getting the names of debugging things. This cuts down
on the number of times a std::string is created and copied.

llvm-svn: 66396
2009-03-09 05:04:40 +00:00
Duncan Sands
5ab54d488f Introduce new linkage types linkonce_odr, weak_odr, common_odr
and extern_weak_odr.  These are the same as the non-odr versions,
except that they indicate that the global will only be overridden
by an *equivalent* global.  In C, a function with weak linkage can
be overridden by a function which behaves completely differently.
This means that IP passes have to skip weak functions, since any
deductions made from the function definition might be wrong, since
the definition could be replaced by something completely different
at link time.   This is not allowed in C++, thanks to the ODR
(One-Definition-Rule): if a function is replaced by another at
link-time, then the new function must be the same as the original
function.  If a language knows that a function or other global can
only be overridden by an equivalent global, it can give it the
weak_odr linkage type, and the optimizers will understand that it
is alright to make deductions based on the function body.  The
code generators on the other hand map weak and weak_odr linkage
to the same thing.

llvm-svn: 66339
2009-03-07 15:45:40 +00:00
Chris Lattner
33852b4f35 Sprinkle some PrettyStackEntry magic into the passmanager. With this, we now
get nice and happy stack traces when we crash in an optimizer or codegen.  For
example, an abort put in UnswitchLoops now looks like this:

Stack dump:
0.	Program arguments: clang pr3399.c -S -O3 
1.	<eof> parser at end of file
2.	per-module optimization passes
3.	Running pass 'CallGraph Pass Manager' on module 'pr3399.c'.
4.	Running pass 'Loop Pass Manager' on function '@foo'
5.	Running pass 'Unswitch loops' on basic block '%for.inc'
Abort

llvm-svn: 66260
2009-03-06 06:45:05 +00:00