https://bugs.llvm.org/show_bug.cgi?id=43143
Bug ID: 43143
Summary: [InstCombine] SimplifyAssociativeOrCommutative - dodgy
NSW transform checks
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected]
The following code in InstructionCombining.cpp ~line 345 needs reviewing and
cleaning up:
if (IsNSW &&
(!Op0 || (isa<BinaryOperator>(Op0) && Op0->hasNoSignedWrap()))) {
// Note: this is only valid because SimplifyBinOp doesn't look at
// the operands to Op0.
I.setHasNoSignedWrap(true);
}
1 - Op0 came from dyn_cast<BinaryOperator>(I.getOperand(0)), and an outer if()
has already confirmed that its not null.
2 - Op0->hasNoSignedWrap does a cast<OverflowingBinaryOperator> which we're not
checking for.
I only noticed in passing as cppcheck warned that the !Op0 should be redundant.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs