mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-23 16:19:52 +00:00
InstSimplify: Don't simplify gep X, (Y-X) to Y if types differ
It's incorrect to perform this simplification if the types differ. A bitcast would need to be inserted for this to work. This fixes PR20771. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216597 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2837,7 +2837,8 @@ static Value *SimplifyGEPInst(ArrayRef<Value *> Ops, const Query &Q, unsigned) {
|
||||
return Constant::getNullValue(GEPTy);
|
||||
Value *Temp;
|
||||
if (match(P, m_PtrToInt(m_Value(Temp))))
|
||||
return Temp;
|
||||
if (Temp->getType() == GEPTy)
|
||||
return Temp;
|
||||
return nullptr;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user