[SCCP] Make check for unknown/undef in unary op handling more explicit (NFCI)
Make the implementation more similar to other functions, by explicitly skipping an unknown/undef first, and always falling back to overdefined at the end. I don't think it makes a difference now, but could make one once the constant evaluation can fail. In that case we would directly mark the result as overdefined now, rather than keeping it unknown (and later making it overdefined because we think it's undef-based).
This commit is contained in:
parent
3e0bf1c7a9
commit
ebc54e0cd4
|
@ -953,15 +953,15 @@ void SCCPInstVisitor::visitUnaryOperator(Instruction &I) {
|
|||
if (isOverdefined(IV))
|
||||
return (void)markOverdefined(&I);
|
||||
|
||||
// If something is unknown/undef, wait for it to resolve.
|
||||
if (V0State.isUnknownOrUndef())
|
||||
return;
|
||||
|
||||
if (isConstant(V0State))
|
||||
if (Constant *C = ConstantFoldUnaryOpOperand(I.getOpcode(),
|
||||
getConstant(V0State), DL))
|
||||
return (void)markConstant(IV, &I, C);
|
||||
|
||||
// If something is undef, wait for it to resolve.
|
||||
if (!isOverdefined(V0State))
|
||||
return;
|
||||
|
||||
markOverdefined(&I);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue