mirror of
https://github.com/RPCSX/llvm.git
synced 2025-03-05 03:19:11 +00:00
Use APInt arithmetic, fixed typo. Thanks to Benjamin Kramer for noticing that.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206144 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
01b72784c9
commit
aa827a513c
@ -2149,7 +2149,7 @@ static Instruction *ProcessUMulZExtIdiom(ICmpInst &I, Value *MulVal,
|
|||||||
// mulval = mul(zext A, zext B)
|
// mulval = mul(zext A, zext B)
|
||||||
// cmp ule mulval, max + 1
|
// cmp ule mulval, max + 1
|
||||||
if (ConstantInt *CI = dyn_cast<ConstantInt>(OtherVal)) {
|
if (ConstantInt *CI = dyn_cast<ConstantInt>(OtherVal)) {
|
||||||
APInt MaxVal(CI->getBitWidth(), 1ULL << MulWidth);
|
APInt MaxVal = APInt::getOneBitSet(CI->getBitWidth(), MulWidth);
|
||||||
if (MaxVal.eq(CI->getValue()))
|
if (MaxVal.eq(CI->getValue()))
|
||||||
break; // Recognized
|
break; // Recognized
|
||||||
}
|
}
|
||||||
@ -2176,7 +2176,7 @@ static Instruction *ProcessUMulZExtIdiom(ICmpInst &I, Value *MulVal,
|
|||||||
|
|
||||||
// If there are uses of mul result other than the comparison, we know that
|
// If there are uses of mul result other than the comparison, we know that
|
||||||
// they are truncation or binary AND. Change them to use result of
|
// they are truncation or binary AND. Change them to use result of
|
||||||
// mul.with.overflow and ajust properly mask/size.
|
// mul.with.overflow and adjust properly mask/size.
|
||||||
if (MulVal->hasNUsesOrMore(2)) {
|
if (MulVal->hasNUsesOrMore(2)) {
|
||||||
Value *Mul = Builder->CreateExtractValue(Call, 0, "umul.value");
|
Value *Mul = Builder->CreateExtractValue(Call, 0, "umul.value");
|
||||||
for (User *U : MulVal->users()) {
|
for (User *U : MulVal->users()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user