mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 12:19:53 +00:00
[ConstantFolding] Use sdiv_ov
This is a simplification, there should be no functional change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275273 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
15e94506a9
commit
549def0571
@ -850,13 +850,13 @@ Constant *SymbolicallyEvaluateGEP(const GEPOperator *GEP,
|
||||
// index for this level and proceed to the next level to see if it can
|
||||
// accommodate the offset.
|
||||
NewIdxs.push_back(ConstantInt::get(IntPtrTy, 0));
|
||||
} else if (ElemSize.isAllOnesValue()) {
|
||||
// Avoid signed overflow.
|
||||
break;
|
||||
} else {
|
||||
// The element size is non-zero divide the offset by the element
|
||||
// size (rounding down), to compute the index at this level.
|
||||
APInt NewIdx = Offset.sdiv(ElemSize);
|
||||
bool Overflow;
|
||||
APInt NewIdx = Offset.sdiv_ov(ElemSize, Overflow);
|
||||
if (Overflow)
|
||||
break;
|
||||
Offset -= NewIdx * ElemSize;
|
||||
NewIdxs.push_back(ConstantInt::get(IntPtrTy, NewIdx));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user