mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-07 21:20:18 +00:00
[ValueTracking] Make the code in lookThroughCast
No functionality change is intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268108 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8c53c612ef
commit
c1284a6b7e
@ -3714,30 +3714,23 @@ static Value *lookThroughCast(CmpInst *CmpI, Value *V1, Value *V2,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (isa<ZExtInst>(CI) && CmpI->isUnsigned())
|
||||
return ConstantExpr::getTrunc(C, CI->getSrcTy());
|
||||
|
||||
if (isa<TruncInst>(CI))
|
||||
return ConstantExpr::getIntegerCast(C, CI->getSrcTy(), CmpI->isSigned());
|
||||
|
||||
if (isa<FPTruncInst>(CI))
|
||||
return ConstantExpr::getFPExtend(C, CI->getSrcTy(), true);
|
||||
|
||||
if (isa<FPExtInst>(CI))
|
||||
return ConstantExpr::getFPTrunc(C, CI->getSrcTy(), true);
|
||||
|
||||
// Sophisticated constants can have values which we cannot easily reason
|
||||
// about. Skip them for the fp<->int case.
|
||||
if (isa<ConstantExpr>(C))
|
||||
return nullptr;
|
||||
|
||||
Constant *CastedTo = nullptr;
|
||||
|
||||
// This is only valid if the truncated value can be sign-extended
|
||||
// back to the original value.
|
||||
if (isa<ZExtInst>(CI) && CmpI->isUnsigned())
|
||||
CastedTo = ConstantExpr::getTrunc(C, CI->getSrcTy());
|
||||
|
||||
if (isa<SExtInst>(CI) && CmpI->isSigned())
|
||||
CastedTo = ConstantExpr::getTrunc(C, CI->getSrcTy(), true);
|
||||
|
||||
if (isa<TruncInst>(CI))
|
||||
CastedTo = ConstantExpr::getIntegerCast(C, CI->getSrcTy(), CmpI->isSigned());
|
||||
|
||||
if (isa<FPTruncInst>(CI))
|
||||
CastedTo = ConstantExpr::getFPExtend(C, CI->getSrcTy(), true);
|
||||
|
||||
if (isa<FPExtInst>(CI))
|
||||
CastedTo = ConstantExpr::getFPTrunc(C, CI->getSrcTy(), true);
|
||||
|
||||
if (isa<FPToUIInst>(CI))
|
||||
CastedTo = ConstantExpr::getUIToFP(C, CI->getSrcTy(), true);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user