mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 00:32:55 +00:00
[SROA] Use the members for New{Begin,End}Offset in the rewrite helpers
rather than passing them as arguments. While I generally prefer actual arguments, in this case the readability loss is substantial. By using members we avoid repeatedly calculating the offsets, and once we're using members it is useful to ensure that those names *always* refer to the original-alloca-relative new offset for a rewritten slice. No functionality changed. Follow-up refactoring, all toward getting the address space patch merged. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202228 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
abd2555e36
commit
f11f7a49b9
@ -2169,8 +2169,7 @@ private:
|
|||||||
Pass.DeadInsts.insert(I);
|
Pass.DeadInsts.insert(I);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *rewriteVectorizedLoadInst(uint64_t NewBeginOffset,
|
Value *rewriteVectorizedLoadInst() {
|
||||||
uint64_t NewEndOffset) {
|
|
||||||
unsigned BeginIndex = getIndex(NewBeginOffset);
|
unsigned BeginIndex = getIndex(NewBeginOffset);
|
||||||
unsigned EndIndex = getIndex(NewEndOffset);
|
unsigned EndIndex = getIndex(NewEndOffset);
|
||||||
assert(EndIndex > BeginIndex && "Empty vector!");
|
assert(EndIndex > BeginIndex && "Empty vector!");
|
||||||
@ -2180,8 +2179,7 @@ private:
|
|||||||
return extractVector(IRB, V, BeginIndex, EndIndex, "vec");
|
return extractVector(IRB, V, BeginIndex, EndIndex, "vec");
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *rewriteIntegerLoad(LoadInst &LI, uint64_t NewBeginOffset,
|
Value *rewriteIntegerLoad(LoadInst &LI) {
|
||||||
uint64_t NewEndOffset) {
|
|
||||||
assert(IntTy && "We cannot insert an integer to the alloca");
|
assert(IntTy && "We cannot insert an integer to the alloca");
|
||||||
assert(!LI.isVolatile());
|
assert(!LI.isVolatile());
|
||||||
Value *V = IRB.CreateAlignedLoad(&NewAI, NewAI.getAlignment(),
|
Value *V = IRB.CreateAlignedLoad(&NewAI, NewAI.getAlignment(),
|
||||||
@ -2205,9 +2203,9 @@ private:
|
|||||||
bool IsPtrAdjusted = false;
|
bool IsPtrAdjusted = false;
|
||||||
Value *V;
|
Value *V;
|
||||||
if (VecTy) {
|
if (VecTy) {
|
||||||
V = rewriteVectorizedLoadInst(NewBeginOffset, NewEndOffset);
|
V = rewriteVectorizedLoadInst();
|
||||||
} else if (IntTy && LI.getType()->isIntegerTy()) {
|
} else if (IntTy && LI.getType()->isIntegerTy()) {
|
||||||
V = rewriteIntegerLoad(LI, NewBeginOffset, NewEndOffset);
|
V = rewriteIntegerLoad(LI);
|
||||||
} else if (NewBeginOffset == NewAllocaBeginOffset &&
|
} else if (NewBeginOffset == NewAllocaBeginOffset &&
|
||||||
canConvertValue(DL, NewAllocaTy, LI.getType())) {
|
canConvertValue(DL, NewAllocaTy, LI.getType())) {
|
||||||
V = IRB.CreateAlignedLoad(&NewAI, NewAI.getAlignment(),
|
V = IRB.CreateAlignedLoad(&NewAI, NewAI.getAlignment(),
|
||||||
@ -2254,9 +2252,7 @@ private:
|
|||||||
return !LI.isVolatile() && !IsPtrAdjusted;
|
return !LI.isVolatile() && !IsPtrAdjusted;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rewriteVectorizedStoreInst(Value *V, StoreInst &SI, Value *OldOp,
|
bool rewriteVectorizedStoreInst(Value *V, StoreInst &SI, Value *OldOp) {
|
||||||
uint64_t NewBeginOffset,
|
|
||||||
uint64_t NewEndOffset) {
|
|
||||||
if (V->getType() != VecTy) {
|
if (V->getType() != VecTy) {
|
||||||
unsigned BeginIndex = getIndex(NewBeginOffset);
|
unsigned BeginIndex = getIndex(NewBeginOffset);
|
||||||
unsigned EndIndex = getIndex(NewEndOffset);
|
unsigned EndIndex = getIndex(NewEndOffset);
|
||||||
@ -2282,8 +2278,7 @@ private:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rewriteIntegerStore(Value *V, StoreInst &SI,
|
bool rewriteIntegerStore(Value *V, StoreInst &SI) {
|
||||||
uint64_t NewBeginOffset, uint64_t NewEndOffset) {
|
|
||||||
assert(IntTy && "We cannot extract an integer from the alloca");
|
assert(IntTy && "We cannot extract an integer from the alloca");
|
||||||
assert(!SI.isVolatile());
|
assert(!SI.isVolatile());
|
||||||
if (DL.getTypeSizeInBits(V->getType()) != IntTy->getBitWidth()) {
|
if (DL.getTypeSizeInBits(V->getType()) != IntTy->getBitWidth()) {
|
||||||
@ -2329,10 +2324,9 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (VecTy)
|
if (VecTy)
|
||||||
return rewriteVectorizedStoreInst(V, SI, OldOp, NewBeginOffset,
|
return rewriteVectorizedStoreInst(V, SI, OldOp);
|
||||||
NewEndOffset);
|
|
||||||
if (IntTy && V->getType()->isIntegerTy())
|
if (IntTy && V->getType()->isIntegerTy())
|
||||||
return rewriteIntegerStore(V, SI, NewBeginOffset, NewEndOffset);
|
return rewriteIntegerStore(V, SI);
|
||||||
|
|
||||||
StoreInst *NewSI;
|
StoreInst *NewSI;
|
||||||
if (NewBeginOffset == NewAllocaBeginOffset &&
|
if (NewBeginOffset == NewAllocaBeginOffset &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user