llvm-6502/test
Jingyue Wu 6156e562ef Fixed several correctness issues in SeparateConstOffsetFromGEP
Most issues are on mishandling s/zext.

Fixes:

1. When rebuilding new indices, s/zext should be distributed to
sub-expressions. e.g., sext(a +nsw (b +nsw 5)) = sext(a) + sext(b) + 5 but not
sext(a + b) + 5. This also affects the logic of recursively looking for a
constant offset, we need to include s/zext into the context of the searching.

2. Function find should return the bitwidth of the constant offset instead of
always sign-extending it to i64.

3. Stop shortcutting zext'ed GEP indices. LLVM conceptually sign-extends GEP
indices to pointer-size before computing the address. Therefore, gep base,
zext(a + b) != gep base, a + b

Improvements:

1. Add an optimization for splitting sext(a + b): if a + b is proven
non-negative (e.g., used as an index of an inbound GEP) and one of a, b is
non-negative, sext(a + b) = sext(a) + sext(b)

2. Function Distributable checks whether both sext and zext can be distributed
to operands of a binary operator. This helps us split zext(sext(a + b)) to
zext(sext(a) + zext(sext(b)) when a + b does not signed or unsigned overflow.

Refactoring:

Merge some common logic of handling add/sub/or in find.

Testing:

Add many tests in split-gep.ll and split-gep-and-gvn.ll to verify the changes
we made.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210291 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-05 22:07:33 +00:00
..
Analysis remove constant terms 2014-05-27 22:41:45 +00:00
Assembler Allow alias to point to an arbitrary ConstantExpr. 2014-06-03 02:41:57 +00:00
Bindings
Bitcode Add a new attribute called 'jumptable' that creates jump-instruction tables for functions marked with this attribute. 2014-06-05 19:29:43 +00:00
BugPoint
CodeGen Adding explicit triples to the ARM jumptable tests 2014-06-05 21:40:13 +00:00
DebugInfo XFAIL: test/DebugInfo/missing-abstract-variable.ll on s390x as well 2014-06-05 14:20:54 +00:00
ExecutionEngine Use AArch64 instead of now removed ARM64 in test configs 2014-06-05 00:25:30 +00:00
Feature Fix a small bug in the parsing of anonymous globals. 2014-06-03 20:07:32 +00:00
FileCheck
Instrumentation [asancov] Fix coverage line info some more. 2014-06-05 14:34:45 +00:00
Integer
JitListener
Linker Allow alias to point to an arbitrary ConstantExpr. 2014-06-03 02:41:57 +00:00
LTO
MC [mips] Fix triple. 2014-06-05 12:07:14 +00:00
Object Add "-format darwin" to llvm-nm to be like darwin's nm(1) -m output. 2014-06-05 21:21:57 +00:00
Other
TableGen
tools
Transforms Fixed several correctness issues in SeparateConstOffsetFromGEP 2014-06-05 22:07:33 +00:00
Unit
Verifier Add a new attribute called 'jumptable' that creates jump-instruction tables for functions marked with this attribute. 2014-06-05 19:29:43 +00:00
YAMLParser
.clang-format
CMakeLists.txt
lit.cfg
lit.site.cfg.in
Makefile
Makefile.tests
TestRunner.sh