mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
ImplicitCastElision: elide casts only on integrals
For comparison operators (==, !=, <, >, <=, >=) the elision is only sound when both operands are of integral type; otherwise we'd be changing the kind of comparison being performed.
This commit is contained in:
@@ -44,14 +44,13 @@ public:
|
||||
BitwiseOrOp,
|
||||
BitwiseXorOp,
|
||||
ShiftLeftOp,
|
||||
ShiftRightOp,
|
||||
CmpEqOp,
|
||||
CmpNeOp,
|
||||
CmpLtOp,
|
||||
CmpGtOp,
|
||||
CmpLeOp,
|
||||
CmpGeOp>(Op))
|
||||
ShiftRightOp>(Op))
|
||||
return elideArithmeticCasts(Op);
|
||||
|
||||
if (mlir::isa<CmpEqOp, CmpNeOp, CmpLtOp, CmpGtOp, CmpLeOp, CmpGeOp>(Op)) {
|
||||
if (clift::unwrapped_isa<IntegralType>(Op->getOperand(0).getType()))
|
||||
elideArithmeticCasts(Op);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user