another random stab in the dark trying to fix llvm-gcc-i386-linux-selfhost
llvm-svn: 123149
This commit is contained in:
parent
ec1387cf4b
commit
88bc848ab6
|
@ -71,13 +71,14 @@ static int64_t GetOffsetFromIndex(const GetElementPtrInst *GEP, unsigned Idx,
|
||||||
/// be &A[42], and Ptr2 might be &A[40]. In this case offset would be -8.
|
/// be &A[42], and Ptr2 might be &A[40]. In this case offset would be -8.
|
||||||
static bool IsPointerOffset(Value *Ptr1, Value *Ptr2, int64_t &Offset,
|
static bool IsPointerOffset(Value *Ptr1, Value *Ptr2, int64_t &Offset,
|
||||||
const TargetData &TD) {
|
const TargetData &TD) {
|
||||||
Ptr1 = Ptr1->stripPointerCasts();
|
//Ptr1 = Ptr1->stripPointerCasts();
|
||||||
Ptr2 = Ptr2->stripPointerCasts();
|
//Ptr2 = Ptr2->stripPointerCasts();
|
||||||
GetElementPtrInst *GEP1 = dyn_cast<GetElementPtrInst>(Ptr1);
|
GetElementPtrInst *GEP1 = dyn_cast<GetElementPtrInst>(Ptr1);
|
||||||
GetElementPtrInst *GEP2 = dyn_cast<GetElementPtrInst>(Ptr2);
|
GetElementPtrInst *GEP2 = dyn_cast<GetElementPtrInst>(Ptr2);
|
||||||
|
|
||||||
bool VariableIdxFound = false;
|
bool VariableIdxFound = false;
|
||||||
|
|
||||||
|
#if 0
|
||||||
// If one pointer is a GEP and the other isn't, then see if the GEP is a
|
// If one pointer is a GEP and the other isn't, then see if the GEP is a
|
||||||
// constant offset from the base, as in "P" and "gep P, 1".
|
// constant offset from the base, as in "P" and "gep P, 1".
|
||||||
if (GEP1 && GEP2 == 0 && GEP1->getOperand(0)->stripPointerCasts() == Ptr2) {
|
if (GEP1 && GEP2 == 0 && GEP1->getOperand(0)->stripPointerCasts() == Ptr2) {
|
||||||
|
@ -89,6 +90,7 @@ static bool IsPointerOffset(Value *Ptr1, Value *Ptr2, int64_t &Offset,
|
||||||
Offset = GetOffsetFromIndex(GEP2, 1, VariableIdxFound, TD);
|
Offset = GetOffsetFromIndex(GEP2, 1, VariableIdxFound, TD);
|
||||||
return !VariableIdxFound;
|
return !VariableIdxFound;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Right now we handle the case when Ptr1/Ptr2 are both GEPs with an identical
|
// Right now we handle the case when Ptr1/Ptr2 are both GEPs with an identical
|
||||||
// base. After that base, they may have some number of common (and
|
// base. After that base, they may have some number of common (and
|
||||||
|
|
Loading…
Reference in New Issue