mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
fix two transposed lines duncan caught and add an explanatory comment.
llvm-svn: 89958
This commit is contained in:
parent
f7a0da351e
commit
a403a7eddc
@ -1064,12 +1064,15 @@ const Value *llvm::DecomposeGEPExpression(const Value *V, int64_t &BaseOffs,
|
|||||||
|
|
||||||
uint64_t Scale = TD->getTypeAllocSize(*GTI);
|
uint64_t Scale = TD->getTypeAllocSize(*GTI);
|
||||||
|
|
||||||
|
// Use GetLinearExpression to decompose the index into a C1*V+C2 form.
|
||||||
unsigned Width = cast<IntegerType>(Index->getType())->getBitWidth();
|
unsigned Width = cast<IntegerType>(Index->getType())->getBitWidth();
|
||||||
APInt IndexScale(Width, 0), IndexOffset(Width, 0);
|
APInt IndexScale(Width, 0), IndexOffset(Width, 0);
|
||||||
Index = GetLinearExpression(Index, IndexScale, IndexOffset, TD);
|
Index = GetLinearExpression(Index, IndexScale, IndexOffset, TD);
|
||||||
|
|
||||||
Scale *= IndexScale.getZExtValue();
|
// The GEP index scale ("Scale") scales C1*V+C2, yielding (C1*V+C2)*Scale.
|
||||||
|
// This gives us an aggregate computation of (C1*Scale)*V + C2*Scale.
|
||||||
BaseOffs += IndexOffset.getZExtValue()*Scale;
|
BaseOffs += IndexOffset.getZExtValue()*Scale;
|
||||||
|
Scale *= IndexScale.getZExtValue();
|
||||||
|
|
||||||
|
|
||||||
// If we already had an occurrance of this index variable, merge this
|
// If we already had an occurrance of this index variable, merge this
|
||||||
|
Loading…
Reference in New Issue
Block a user