Commit Graph

3998 Commits

Author SHA1 Message Date
Chandler Carruth 91f4faf877 Delete a dead member. Dunno if this was ever used, but the current code
directly manipulates the weights inside of the BranchProbabilityInfo
that is passed in.

llvm-svn: 142163
2011-10-16 22:27:54 +00:00
Andrew Trick fd4ca0f4ac Fix SCEVExpander assert during LSR: "argument of incompatible type".
Just because we're dealing with a GEP doesn't mean we can assert the
SCEV has a pointer type. The fix is simply to ignore the SCEV pointer
type, which we really didn't need.
Fixes PR11138 webkit crash.

llvm-svn: 142058
2011-10-15 06:19:55 +00:00
Nick Lewycky a447e0f38f An instruction's operands aren't necessarily instructions or constants. They
could be arguments, for example.

No testcase because this is a bug-fix broken out of a larger optimization patch.

llvm-svn: 141951
2011-10-14 09:38:46 +00:00
Eli Friedman c1702c8f22 Enhance the memdep interface so that users can tell the difference between a dependency which cannot be calculated and a path reaching the entry point of the function. This patch introduces isNonFuncLocal, which replaces isUnknown in some cases.
Patch by Xiaoyi Guo.

llvm-svn: 141896
2011-10-13 22:14:57 +00:00
Andrew Trick 870c1a3f15 Reapply r141870, SCEV expansion of post-inc.
Speculatively reapply to see if this test case still crashes on
linux. I may have fixed it in my last checkin.

llvm-svn: 141895
2011-10-13 21:55:29 +00:00
Andrew Trick 7e442569dc Fix memory corruption I introduced a few checkins ago.
Self-review easily caught this obvious bug.

llvm-svn: 141880
2011-10-13 18:49:23 +00:00
Andrew Trick 41c253c35c Revert r141870. The test case crashes on linux with data corruption. A deeper issue was exposed.
llvm-svn: 141873
2011-10-13 17:58:24 +00:00
Andrew Trick e15d6e14e3 LSR: Reuse the post-inc expansion of expressions.
This avoids unnecessary expansion of expressions and allows the SCEV
expander to work on expression DAGs, not just trees.
Fixes PR11090.

llvm-svn: 141870
2011-10-13 17:31:47 +00:00
Andrew Trick 1393ec29af SCEV: Rewrite TrandformForPostIncUse to handle expression DAGs, not
just expression trees.

Partially fixes PR11090. Test case will be with the full fix.

llvm-svn: 141868
2011-10-13 17:21:09 +00:00
Andrew Trick adfe72b33c Slightly more useful tracing.
llvm-svn: 141867
2011-10-13 17:06:38 +00:00
Eric Christopher 6647b83087 Add a new wrapper node for a DILexicalBlock that encapsulates it and a
file. Since it should only be used when necessary propagate it through
the backend code generation and tweak testcases accordingly.

This helps with code like in clang's test/CodeGen/debug-info-line.c where
we have multiple #line directives within a single lexical block and want
to generate only a single block that contains each file change.

Part of rdar://10246360

llvm-svn: 141729
2011-10-11 22:59:11 +00:00
Andrew Trick f9201c572e Move replaceCongruentIVs into SCEVExapander and bias toward "expanded"
IVs.

Indvars previously chose randomly between congruent IVs. Now it will
bias the decision toward IVs that SCEVExpander likes to create. This
was not done to fix any problem, it's just a welcome side effect of
factoring code.

llvm-svn: 141633
2011-10-11 02:28:51 +00:00
Andrew Trick eef7308df6 Add an extra safety check in front of the optimization in r141442.
llvm-svn: 141470
2011-10-08 02:16:39 +00:00
Andrew Trick 7fb669ab48 LSR should only reuse phis that match its formula.
Fixes rdar://problem/5064068

llvm-svn: 141442
2011-10-07 23:46:21 +00:00
Eli Friedman 1456cd20b4 Remove the old atomic instrinsics. autoupgrade functionality is included with this patch.
llvm-svn: 141333
2011-10-06 23:20:49 +00:00
Andrew Trick 3e8a576da1 Fixes PR11070 - assert in SCEV getConstantEvolvingPHIOperands.
llvm-svn: 141219
2011-10-05 22:06:53 +00:00
Andrew Trick ed39bb8efd Typo. Thanks Bob.
llvm-svn: 141188
2011-10-05 16:52:28 +00:00
Chandler Carruth f6567a131d Fix a broken assert found by -Wparentheses.
llvm-svn: 141168
2011-10-05 07:02:23 +00:00
Andrew Trick e9162f1ff8 Fix disabled SCEV analysis caused r141161 and add unit test.
I noticed during self-review that my previous checkin disabled some
analysis. Even with the reenabled analysis the test case runs in about
5ms. Without the fix, it will take several minutes at least.

llvm-svn: 141164
2011-10-05 05:58:49 +00:00
Andrew Trick 3a86ba767c Avoid exponential recursion in SCEV getConstantEvolvingPHI and EvaluateExpression.
Note to compiler writers: never recurse on multiple instruction
operands without memoization.
Fixes rdar://10187945. Was taking 45s, now taking 5ms.

llvm-svn: 141161
2011-10-05 03:25:31 +00:00
Nick Lewycky 287682ead1 The product of two chrec's can always be represented as a chrec.
llvm-svn: 141066
2011-10-04 06:51:26 +00:00
Nick Lewycky 3155552461 Reapply r140979 with fix! We never did get a testcase, but careful review of the
logic by David Meyer revealed this bug.

llvm-svn: 140992
2011-10-03 07:10:45 +00:00
Nick Lewycky b1dbce1406 Revert r140979 due to reports of bootstrap failure.
llvm-svn: 140980
2011-10-03 05:14:59 +00:00
Nick Lewycky 3c624b8d0d Add one more case we compute a max trip count.
llvm-svn: 140979
2011-10-03 01:03:57 +00:00
Andrew Trick f7656015fc Inlining and unrolling heuristics should be aware of free truncs.
We want heuristics to be based on accurate data, but more importantly
we don't want llvm to behave randomly. A benign trunc inserted by an
upstream pass should not cause a wild swings in optimization
level. See PR11034. It's a general problem with threshold-based
heuristics, but we can make it less bad.

llvm-svn: 140919
2011-10-01 01:39:05 +00:00
Andrew Trick caa500bf93 whitespace
llvm-svn: 140916
2011-10-01 01:27:56 +00:00
Andrew Trick ef8e4efff8 indvars: generalize SCEV getPreStartForSignExtend.
Handle general Add expressions to avoid leaving around redundant
32-bit IVs.

llvm-svn: 140701
2011-09-28 17:02:54 +00:00
Eli Friedman 5f476dc3ef PR10628: Fix getModRefInfo so it queries the underlying alias() implementation correctly while checking nocapture calls.
llvm-svn: 140666
2011-09-28 00:34:27 +00:00
Benjamin Kramer 547b6c5ecd Stop emitting instructions with the name "tmp" they eat up memory and have to be uniqued, without any benefit.
If someone prefers %tmp42 to %42, run instnamer.

llvm-svn: 140634
2011-09-27 20:39:19 +00:00
Eli Friedman 5c91891cf3 Enhance alias analysis for atomic instructions a bit. Upgrade a couple alias-analysis tests to the new atomic instructions.
llvm-svn: 140557
2011-09-26 20:15:28 +00:00
Galina Kistanova ef65f002df Fix for DbgInfoPrinter.cpp:174:12: warning: ‘LineNo’ may be used uninitialized in this function.
llvm-svn: 140281
2011-09-21 23:34:23 +00:00
Devang Patel 04d6d47865 Add support to emit debug info for C++0x nullptr type.
llvm-svn: 139751
2011-09-14 23:13:28 +00:00
Eric Christopher 777c928369 Fix typo.
llvm-svn: 139530
2011-09-12 19:58:22 +00:00
Devang Patel 1ad1abe165 Add asserts to keep front-ends honest while encoding debug info into LLVM IR using DIBuilder.
llvm-svn: 139515
2011-09-12 18:26:08 +00:00
Andrew Trick a51d74fc35 Set NSW/NUW flags on SCEVAddExpr when the operation is flagged as
such.

I'm doing this now for completeness because I can't think of/remember
any reason that it was left out. I'm not sure it will help anything,
but if we don't do it we need to explain why in comments.

llvm-svn: 139450
2011-09-10 01:09:50 +00:00
Eli Friedman b78ac543c7 A couple minor corrections to r139276.
llvm-svn: 139277
2011-09-08 02:37:07 +00:00
Eli Friedman 3d1b307672 Fix the logic in BasicAliasAnalysis::aliasGEP for comparing GEP's with variable differences so that it actually does something sane. Fixes PR10881.
llvm-svn: 139276
2011-09-08 02:23:31 +00:00
Owen Anderson f4f09f8c26 memset_pattern16 uses a 16 BYTE pattern, not a 16 BIT pattern. Add comments to that effect.
llvm-svn: 139205
2011-09-06 23:43:26 +00:00
Owen Anderson 653cb03191 Teach BasicAA about the aliasing properties of memset_pattern16.
Fixes PR10872 and <rdar://problem/10065079>.

llvm-svn: 139204
2011-09-06 23:33:25 +00:00
Nick Lewycky e0aa54bb98 This transform only handles two-operand AddRec's. Prevent it from trying to
handle anything more complex. Fixes PR10383 again!

llvm-svn: 139186
2011-09-06 21:42:18 +00:00
Devang Patel 5ea5d7965b Now, named mdnode llvm.dbg.cu keeps track of all compile units in a module. Update DebugInfoFinder to collect compile units from llvm.dbg.cu.
llvm-svn: 139147
2011-09-06 17:40:08 +00:00
Nick Lewycky 78664db054 Fix typo in comment again.
llvm-svn: 139139
2011-09-06 07:02:40 +00:00
Nick Lewycky 237878b7ac Apparently we compile the code, not the comments. Thanks Eli!
llvm-svn: 139138
2011-09-06 06:56:00 +00:00
Nick Lewycky 0af94cc50b Fix typo in comment.
llvm-svn: 139137
2011-09-06 06:46:01 +00:00
Nick Lewycky 702cf1eccc Nope! I had it right the first time. Revert the operative part of r139135 and
add more showing of my work.

llvm-svn: 139136
2011-09-06 06:39:54 +00:00
Nick Lewycky 6f86e001d6 Fix flipped sign. While there, show my math.
llvm-svn: 139135
2011-09-06 05:33:18 +00:00
Nick Lewycky db66b82dd5 No no no, fix typo properly!
llvm-svn: 139134
2011-09-06 05:08:09 +00:00
Nick Lewycky 658bdb5133 The logic inside getMulExpr to simplify {a,+,b}*{c,+,d} was wrong, which was
visible given a=b=c=d=1, on iteration #1 (the second iteration). Replace it with
correct math. Fixes PR10383!

llvm-svn: 139133
2011-09-06 05:05:14 +00:00
Nick Lewycky b1438c763a Revert r139126 due to selfhost failures reported by buildbots.
llvm-svn: 139130
2011-09-06 02:43:13 +00:00
Nick Lewycky c4c43fbb07 Teach SCEV to report a max backedge count in one interesting case in
HowFarToZero; the case for a canonical loop.

llvm-svn: 139126
2011-09-05 23:25:16 +00:00