Zhou Sheng
670d50e102
Ignore dbg info intrinsics when folding conditional branch to
...
conditional branch predecessors.
llvm-svn: 65509
2009-02-26 06:56:37 +00:00
Chris Lattner
1443cb8f77
Fix PR3667
...
llvm-svn: 65464
2009-02-25 18:20:01 +00:00
Zhou Sheng
241d74737b
Don't block basic block with only SwitchInst to fold into predecessors.
...
llvm-svn: 65456
2009-02-25 15:34:27 +00:00
Dan Gohman
486728ef53
Add a testcase for the problem fixed in r65289.
...
llvm-svn: 65365
2009-02-24 02:17:42 +00:00
Dan Gohman
1197d46ccf
Fix a ValueTracking rule: RHS means operand 1, not 0. Add a simple
...
ashr instcombine to help expose this code. And apply the fix to
SelectionDAG's copy of this code too.
llvm-svn: 65364
2009-02-24 02:00:40 +00:00
Devang Patel
702836b2dd
While folding unconditional return move DbgRegionEndInst into the predecessor, instead of removing it. This fixes following tests from llvmgcc42 testsuite.
...
gcc.c-torture/execute/20000605-3.c
gcc.c-torture/execute/20020619-1.c
gcc.c-torture/execute/20030920-1.c
gcc.c-torture/execute/loop-ivopts-1.c
llvm-svn: 65353
2009-02-24 00:05:16 +00:00
Dan Gohman
1d93a1d2cb
Back out the change in 64918 that used sign-extensions when promoting
...
trip counts that use signed comparisons. It's not obviously the best
approach for preserving trip count information, and at any rate there
isn't anything in the tree right now that makes use of that, so for
now always using zero-extensions is preferable.
llvm-svn: 65347
2009-02-23 23:20:35 +00:00
Nick Lewycky
2c8f0fd57f
Don't sign extend the char when expanding char -> int during
...
load(bitcast(char[4] to i32*)) evaluation.
llvm-svn: 65246
2009-02-21 20:50:42 +00:00
Chris Lattner
3adae91c70
rename a function to indicate that it checks for profitability as well
...
as legality. Make load sinking and gep sinking more careful: we only
do it when it won't pessimize loads from the stack. This has the added
benefit of not producing code that is unanalyzable to SROA.
llvm-svn: 65209
2009-02-21 00:46:50 +00:00
Dan Gohman
4e8fc41d48
Implement "superhero" strength reduction, or full strength
...
reduction of address calculations down to basic pointer arithmetic.
This is currently off by default, as it needs a few other features
before it becomes generally useful. And even when enabled, full
strength reduction is only performed when it doesn't increase
register pressure, and when several other conditions are true.
This also factors out a bunch of exisiting LSR code out of
StrengthReduceStridedIVUsers into separate functions, and tidies
up IV insertion. This actually decreases register pressure even
in non-superhero mode. The change in iv-users-in-other-loops.ll
is an example of this; there are two more adds because there are
two fewer leas, and there is less spilling.
llvm-svn: 65108
2009-02-20 04:17:46 +00:00
Dan Gohman
451474da4a
Use a sign-extend instead of a zero-extend when promoting a
...
trip count value when the original loop iteration condition is
signed and the canonical induction variable won't undergo signed
overflow. This isn't required for correctness; it just preserves
more information about original loop iteration values.
Add a getTruncateOrSignExtend method to ScalarEvolution,
following getTruncateOrZeroExtend.
llvm-svn: 64918
2009-02-18 17:22:41 +00:00
Owen Anderson
9d3e18ed39
Add a test for r61358, which I forgot to add way back when.
...
llvm-svn: 64904
2009-02-18 07:50:22 +00:00
Dan Gohman
4ed0aa2409
Change the argument type in this test to something less convoluted,
...
since it isn't actually used.
llvm-svn: 64883
2009-02-18 04:25:04 +00:00
Dan Gohman
3fc2e67140
Fix a corner case in the new indvars promotion logic: if there
...
are multiple IV's in a loop, some of them may under go signed
or unsigned wrapping even if the IV that's used in the loop
exit condition doesn't. Restrict sign-extension-elimination
and zero-extension-elimination to only those that operate on
the original loop-controlling IV.
llvm-svn: 64866
2009-02-18 00:52:00 +00:00
Duncan Sands
e605b83258
If an alias is dead and so is its aliasee, then globaldce would
...
crash because the alias would still be using the aliasee when the
aliasee was deleted.
llvm-svn: 64844
2009-02-17 23:05:26 +00:00
Chris Lattner
0837686a2a
commit a tweaked version of Daniel's patch for PR3599. We now
...
eliminate all the extensions and all but the one required truncate
from the testcase, but the or/and/shift stuff still isn't zapped.
llvm-svn: 64809
2009-02-17 20:47:23 +00:00
Evan Cheng
9a8e419015
Strengthen the "non-constant stride must dominate loop preheader" check.
...
llvm-svn: 64703
2009-02-17 00:13:06 +00:00
Dan Gohman
e06ea828a2
Fix EnforceKnownAlignment so that it doesn't ever reduce the alignment
...
of an alloca or global variable.
llvm-svn: 64693
2009-02-16 23:02:21 +00:00
Dan Gohman
b36bd824fe
Rename IndVarsSimplify to IndVarSimplify, to be consistent with
...
the name used in the code that these tests are for.
llvm-svn: 64624
2009-02-16 00:56:15 +00:00
Dan Gohman
3d93bc5654
Change these tests to use regular loads instead of llvm.x86.sse2.loadu.dq.
...
Enhance instcombine to use the preferred field of
GetOrEnforceKnownAlignment in more cases, so that regular IR operations are
optimized in the same way that the intrinsics currently are.
llvm-svn: 64623
2009-02-16 00:44:23 +00:00
Duncan Sands
0e6fcb078c
If the target of an alias has internal linkage, then the
...
alias can be morphed into the target. Implement this
transform, and fix a crash in the existing transform at
the same time.
llvm-svn: 64583
2009-02-15 09:56:08 +00:00
Evan Cheng
02d9156a8d
Fix pr3571: If stride is a value defined by an instruction, make sure it dominates the loop preheader. When IV users are strength reduced, the stride is inserted into the preheader. It could create a use before def situation.
...
llvm-svn: 64579
2009-02-15 06:06:15 +00:00
Dan Gohman
3695fd42a9
Extend the IndVarSimplify support for promoting induction variables:
...
- Test for signed and unsigned wrapping conditions, instead of just
testing for non-negative induction ranges.
- Handle loops with GT comparisons, in addition to LT comparisons.
- Support more cases of induction variables that don't start at 0.
llvm-svn: 64532
2009-02-14 02:31:09 +00:00
Nick Lewycky
0a8e13fd8b
Mark strto* as readonly when the endptr is null.
...
llvm-svn: 64460
2009-02-13 17:08:33 +00:00
Nick Lewycky
7ec551cfad
On strtod and friends, mark 'endptr' nocapture in the function prototype, and
...
mark the first argument nocapture if endptr=NULL for each particular call.
llvm-svn: 64453
2009-02-13 15:31:46 +00:00
Nick Lewycky
260e80bd90
Reapply r64300:
...
Make sure the SCC pass manager initializes any contained
function pass managers. Without this, simplify-libcalls
would add nocapture attributes when run on its own, but
not when run as part of -std-compile-opts or similar.
llvm-svn: 64443
2009-02-13 07:15:53 +00:00
Dan Gohman
02d4601fcf
Teach IndVarSimplify to optimize code using the C "int" type for
...
loop induction on LP64 targets. When the induction variable is
used in addressing, IndVars now is usually able to inserst a
64-bit induction variable and eliminates the sign-extending cast.
This is also useful for code using C "short" types for
induction variables on targets with 32-bit addressing.
Inserting a wider induction variable is easy; the tricky part is
determining when trunc(sext(i)) expressions are no-ops. This
requires range analysis of the loop trip count. A common case is
when the original loop iteration starts at 0 and exits when the
induction variable is signed-less-than a fixed value; this case
is now handled.
This replaces IndVarSimplify's OptimizeCanonicalIVType. It was
doing the same optimization, but it was limited to loops with
constant trip counts, because it was running after the loop
rewrite, and the information about the original induction
variable is lost by that point.
Rename ScalarEvolution's executesAtLeastOnce to
isLoopGuardedByCond, generalize it to be able to test for
ICMP_NE conditions, and move it to be a public function so that
IndVars can use it.
llvm-svn: 64407
2009-02-12 22:19:27 +00:00
Nate Begeman
8b548c0a9e
Add suppport for ConstantExprs of shufflevectors whose result type is not equal to the
...
type of the vectors being shuffled.
llvm-svn: 64401
2009-02-12 21:28:33 +00:00
Chris Lattner
5babade39e
Fix a nasty bug (PR3550) where the inline pass could incorrectly mark
...
calls with the tail marker when inlining them through an invoke. Patch,
testcase, and perfect analysis by Jay Foad!
llvm-svn: 64364
2009-02-12 07:06:42 +00:00
Bill Wendling
dfb5880317
Revert r64300 and r64301. These were causing the following errors respectively:
...
During llvm-gcc bootstrap:
Undefined symbols:
"llvm::FPPassManager::doFinalization(llvm::Module&)", referenced from:
(anonymous namespace)::CGPassManager::doFinalization(llvm::CallGraph&, llvm::Module&)
in libLLVMipa.a(CallGraphSCCPass.o)
"llvm::FPPassManager::doInitialization(llvm::Module&)", referenced from:
(anonymous namespace)::CGPassManager::doInitialization(llvm::CallGraph&, llvm::Module&)
in libLLVMipa.a(CallGraphSCCPass.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[3]: *** [/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore.roots/llvmCore~obj/obj-llvm/Release/bin/opt] Error 1
During an LLVM release build:
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/Release/bin/tblgen -I /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target/X86 -I /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target -gen-register-desc -o /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Target/X86/Release/X86GenRegisterInfo.inc.tmp /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target/X86/X86.td
llvm[3]: Building X86.td instruction names with tblgen
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/Release/bin/tblgen -I /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target/X86 -I /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target -gen-instr-enums -o /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Target/X86/Release/X86GenInstrNames.inc.tmp /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target/X86/X86.td
llvm[3]: Building X86.td instruction information with tblgen
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/Release/bin/tblgen -I /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target/X86 -I /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target -gen-instr-desc -o /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Target/X86/Release/X86GenInstrInfo.inc.tmp /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target/X86/X86.td
llvm[3]: Building X86.td assembly writer with tblgen
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/Release/bin/tblgen -I /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target/X86 -I /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target -gen-asm-writer -o /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Target/X86/Release/X86GenAsmWriter.inc.tmp /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target/X86/X86.td
llvm[3]: Compiling InstructionCombining.cpp for Release build
if /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~dst/Developer/usr/bin/llvm-g++-4.2 -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/include -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Transforms/Scalar -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Transforms/Scalar -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -O3 -fno-exceptions -Woverloaded-virtual -pedantic -Wall -W -Wwrite-strings -Wno-long-long -Wunused -Wno-unused-parameter -fstrict-aliasing -Wstrict-aliasing -c -MMD -MP -MF "/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Transforms/Scalar/Release/InstructionCombining.d.tmp" -MT "/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Transforms/Scalar/Release/InstructionCombining.lo" -MT "/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Transforms/Scalar/Release/InstructionCombining.o" -MT "/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Transforms/Scalar/Release/InstructionCombining.d" /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Transforms/Scalar/InstructionCombining.cpp -o /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Transforms/Scalar/Release/InstructionCombining.o ; \
then /bin/mv -f "/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Transforms/Scalar/Release/InstructionCombining.d.tmp" "/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Trans
llvm-svn: 64311
2009-02-11 18:19:24 +00:00
Duncan Sands
e71d1394f6
Make sure the SCC pass manager initializes any contained
...
function pass managers. Without this, simplify-libcalls
would add nocapture attributes when run on its own, but
not when run as part of -std-compile-opts or similar.
llvm-svn: 64300
2009-02-11 09:58:43 +00:00
Devang Patel
dd611eac76
If llvm.dbg.region.end is disappearing then remove corresponding llvm.dbg.func.start also.
...
llvm-svn: 64278
2009-02-11 01:29:06 +00:00
Devang Patel
60571be0de
Ignore dbg intrinsic while folding unconditional branch.
...
llvm-svn: 64242
2009-02-10 22:14:17 +00:00
Devang Patel
6c041de2ff
Do not clone llvm.dbg.func.start and corresponding llvm.dbg.region.end during inlining.
...
llvm-svn: 64209
2009-02-10 07:48:18 +00:00
Devang Patel
7377e7aa89
Enable scalar replacement of AllocaInst whose one of the user is dbg info.
...
llvm-svn: 64207
2009-02-10 07:00:59 +00:00
Dale Johannesen
ef9b8f0d4c
Fix PR 3471, and some cleanups.
...
llvm-svn: 64177
2009-02-09 22:14:15 +00:00
Mon P Wang
028d995112
Instrcombine should not change load(cast p) to cast(load p) if the cast
...
changes the address space of the pointer.
llvm-svn: 64035
2009-02-07 22:19:29 +00:00
Devang Patel
85ae609834
Ignore DbgInfoIntrinsics.
...
llvm-svn: 63923
2009-02-06 06:19:06 +00:00
Chris Lattner
5118081112
fix PR3489, use bits instead of bytes.
...
llvm-svn: 63916
2009-02-06 04:34:07 +00:00
Devang Patel
a6f77d01c7
Ignore dbg intrinsics while propagating conditional expression info. Take 2.
...
llvm-svn: 63898
2009-02-05 23:32:52 +00:00
Devang Patel
72f5fba371
Revert rev. 63876. It is causing llvm-gcc bootstrap failure.
...
llvm-svn: 63888
2009-02-05 21:46:41 +00:00
Devang Patel
5b3fe253c5
Remove dead blocks in the end.
...
llvm-svn: 63880
2009-02-05 19:59:42 +00:00
Devang Patel
66eee02024
Ignore dbg intrinsics while propagating conditional expression info.
...
llvm-svn: 63876
2009-02-05 19:15:39 +00:00
Devang Patel
e665f78460
Ignore dbg intrinsics while folding switch instruction.
...
llvm-svn: 63802
2009-02-05 00:30:42 +00:00
Devang Patel
10be164b28
Ignore dbg intrinsics.
...
llvm-svn: 63781
2009-02-04 21:39:48 +00:00
Duncan Sands
6b95b76bca
Allow the inverse transform x86_fp80 -> i80 (also
...
fires during the Ada build).
llvm-svn: 63731
2009-02-04 11:17:06 +00:00
Duncan Sands
528bb91ea8
Fix PR3468: a crash when constant folding a bitcast of
...
i80 to x86 long double (this was presumably generated
by sroa).
llvm-svn: 63730
2009-02-04 10:17:14 +00:00
Devang Patel
2fac28a8c7
While folding vallue comparison terminators ignore dbg intrinsics.
...
llvm-svn: 63700
2009-02-04 01:06:11 +00:00
Devang Patel
bc5a1a7007
Ignore dbg intrinsics while hoisting common code in the two blocks up into the branch block.
...
llvm-svn: 63687
2009-02-04 00:03:08 +00:00
Devang Patel
4b56b3c66e
Do not let dbg intrinsic block folding of two entry phi node.
...
llvm-svn: 63671
2009-02-03 22:12:02 +00:00