mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-04 06:09:05 +00:00
6156e562ef
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 |
||
---|---|---|
.. | ||
ADCE.cpp | ||
CMakeLists.txt | ||
ConstantHoisting.cpp | ||
ConstantProp.cpp | ||
CorrelatedValuePropagation.cpp | ||
DCE.cpp | ||
DeadStoreElimination.cpp | ||
EarlyCSE.cpp | ||
FlattenCFGPass.cpp | ||
GlobalMerge.cpp | ||
GVN.cpp | ||
IndVarSimplify.cpp | ||
JumpThreading.cpp | ||
LICM.cpp | ||
LLVMBuild.txt | ||
LoadCombine.cpp | ||
LoopDeletion.cpp | ||
LoopIdiomRecognize.cpp | ||
LoopInstSimplify.cpp | ||
LoopRerollPass.cpp | ||
LoopRotation.cpp | ||
LoopStrengthReduce.cpp | ||
LoopUnrollPass.cpp | ||
LoopUnswitch.cpp | ||
LowerAtomic.cpp | ||
Makefile | ||
MemCpyOptimizer.cpp | ||
PartiallyInlineLibCalls.cpp | ||
Reassociate.cpp | ||
Reg2Mem.cpp | ||
SampleProfile.cpp | ||
Scalar.cpp | ||
Scalarizer.cpp | ||
ScalarReplAggregates.cpp | ||
SCCP.cpp | ||
SeparateConstOffsetFromGEP.cpp | ||
SimplifyCFGPass.cpp | ||
Sink.cpp | ||
SROA.cpp | ||
StructurizeCFG.cpp | ||
TailRecursionElimination.cpp |