llvm-6502/test/Analysis/BasicAA
Hal Finkel db1e51359d Revert r219432 - "Revert "[BasicAA] Revert "Revert r218714 - Make better use of zext and sign information."""
Let's try this again...

This reverts r219432, plus a bug fix.

Description of the bug in r219432 (by Nick):

The bug was using AllPositive to break out of the loop; if the loop break
condition i != e is changed to i != e && AllPositive then the
test_modulo_analysis_with_global test I've added will fail as the Modulo will
be calculated incorrectly (as the last loop iteration is skipped, so Modulo
isn't updated with its Scale).

Nick also adds this comment:

ComputeSignBit is safe to use in loops as it takes into account phi nodes, and
the  == EK_ZeroEx check is safe in loops as, no matter how the variable changes
between iterations, zero-extensions will always guarantee a zero sign bit. The
isValueEqualInPotentialCycles check is therefore definitely not needed as all
the variable analysis holds no matter how the variables change between loop
iterations.

And this patch also adds another enhancement to GetLinearExpression - basically
to convert ConstantInts to Offsets (see test_const_eval and
test_const_eval_scaled for the situations this improves).

Original commit message:

This reverts r218944, which reverted r218714, plus a bug fix.

Description of the bug in r218714 (by Nick):

The original patch forgot to check if the Scale in VariableGEPIndex flipped the
sign of the variable. The BasicAA pass iterates over the instructions in the
order they appear in the function, and so BasicAliasAnalysis::aliasGEP is
called with the variable it first comes across as parameter GEP1. Adding a
%reorder label puts the definition of %a after %b so aliasGEP is called with %b
as the first parameter and %a as the second. aliasGEP later calculates that %a
== %b + 1 - %idxprom where %idxprom >= 0 (if %a was passed as the first
parameter it would calculate %b == %a - 1 + %idxprom where %idxprom >= 0) -
ignoring that %idxprom is scaled by -1 here lead the patch to incorrectly
conclude that %a > %b.

Revised patch by Nick White, thanks! Thanks to Lang to isolating the bug.
Slightly modified by me to add an early exit from the loop and avoid
unnecessary, but expensive, function calls.

Original commit message:

Two related things:

 1. Fixes a bug when calculating the offset in GetLinearExpression. The code
    previously used zext to extend the offset, so negative offsets were converted
    to large positive ones.

 2. Enhance aliasGEP to deduce that, if the difference between two GEP
    allocations is positive and all the variables that govern the offset are also
    positive (i.e. the offset is strictly after the higher base pointer), then
    locations that fit in the gap between the two base pointers are NoAlias.

Patch by Nick White!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221876 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-13 09:16:54 +00:00
..
2003-02-26-AccessSizeTest.ll
2003-03-04-GEPCrash.ll
2003-04-22-GEPProblem.ll
2003-04-25-GEPCrash.ll
2003-05-21-GEP-Problem.ll
2003-06-01-AliasCrash.ll
2003-07-03-BasicAACrash.ll
2003-09-19-LocalArgument.ll
2003-11-04-SimpleCases.ll
2003-12-11-ConstExprGEP.ll
2004-07-28-MustAliasbug.ll
2006-03-03-BadArraySubscript.ll BasicAA: Use reachabilty instead of dominance for checking value equality in phi 2014-01-03 05:47:03 +00:00
2006-11-03-BasicAAVectorCrash.ll
2007-01-13-BasePointerBadNoAlias.ll
2007-08-01-NoAliasAndCalls.ll
2007-08-01-NoAliasAndGEP.ll
2007-08-05-GetOverloadedModRef.ll
2007-10-24-ArgumentsGlobals.ll
2007-11-05-SizeCrash.ll Reject alias to undefined symbols in the verifier. 2014-03-12 20:15:49 +00:00
2007-12-08-OutOfBoundsCrash.ll Reject alias to undefined symbols in the verifier. 2014-03-12 20:15:49 +00:00
2008-04-15-Byval.ll Delete -std-compile-opts. 2014-10-16 20:00:02 +00:00
2008-06-02-GEPTailCrash.ll
2008-11-23-NoaliasRet.ll
2009-03-04-GEPNoalias.ll
2009-10-13-AtomicModRef.ll
2009-10-13-GEP-BaseNoAlias.ll
2010-09-15-GEP-SignedArithmetic.ll
2014-03-18-Maxlookup-reached.ll PR15967 Fix in basicaa for faulty returning no alias. 2014-03-26 21:30:19 +00:00
aligned-overread.ll
args-rets-allocas-loads.ll
assume.ll Add @llvm.assume, lowering, and some basic properties 2014-07-25 21:13:35 +00:00
byval.ll
cas.ll
constant-over-index.ll
cs-cs.ll Improve BasicAA CS-CS queries (redux) 2014-07-17 01:28:25 +00:00
dag.ll
empty.ll
featuretest.ll
full-store-partial-alias.ll TBAA: handle scalar TBAA format and struct-path aware TBAA format. 2013-09-27 18:34:27 +00:00
gcsetest.ll CHECK-LABELize test 2014-09-15 17:56:56 +00:00
gep-alias.ll Use correct size for address space in BasicAA. 2013-11-16 00:36:43 +00:00
getmodrefinfo-cs-cs.ll
global-size.ll Use correct size for address space in BasicAA. 2013-11-16 00:36:43 +00:00
intrinsics.ll
invariant_load.ll TBAA: remove !tbaa from testing cases if not used. 2013-04-29 22:42:01 +00:00
memset_pattern.ll
modref.ll CHECK-LABELize test 2014-09-15 17:56:56 +00:00
must-and-partial.ll
no-escape-call.ll
noalias-bugs.ll BasicAA: We need to check both access sizes when comparing a gep and an 2014-01-16 04:53:18 +00:00
noalias-geps.ll Use CHECK-LABEL 2013-09-30 23:31:55 +00:00
noalias-param.ll Make BasicAliasAnalysis recognize the fact a noalias argument cannot alias another argument, even if the other argument is not itself marked noalias. 2013-05-28 08:17:48 +00:00
nocapture.ll
phi-aa.ll Revert r219432 - "Revert "[BasicAA] Revert "Revert r218714 - Make better use of zext and sign information.""" 2014-11-13 09:16:54 +00:00
phi-and-select.ll
phi-spec-order.ll BasicAA: Use reachabilty instead of dominance for checking value equality in phi 2014-01-03 05:47:03 +00:00
phi-speculation.ll
pr18573.ll Test case I forgot to 'add' for r201126. 2014-02-12 03:58:47 +00:00
pure-const-dce.ll
store-promote.ll
tailcall-modref.ll
underlying-value.ll
unreachable-block.ll
zext.ll Revert r219432 - "Revert "[BasicAA] Revert "Revert r218714 - Make better use of zext and sign information.""" 2014-11-13 09:16:54 +00:00