[PATCH] D39417: InstCombine: Preserve nuw when reassociating nuw ops
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 18 11:54:19 PDT 2019
lebedev.ri added inline comments.
================
Comment at: lib/Transforms/InstCombine/InstructionCombining.cpp:198-229
// Return true, if No Signed Wrap should be maintained for I.
// The No Signed Wrap flag can be kept if the operation "B (I.getOpcode) C",
// where both B and C should be ConstantInts, results in a constant that does
// not overflow. This function only handles the Add and Sub opcodes. For
// all other opcodes, the function conservatively returns false.
static bool MaintainNoSignedWrap(BinaryOperator &I, Value *B, Value *C) {
OverflowingBinaryOperator *OBO = dyn_cast<OverflowingBinaryOperator>(&I);
----------------
Why does `MaintainNoSignedWrap()` need all that logic to prove that no overflow happens,
but `MaintainNoUnsignedWrap()` does nothing of sorts?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D39417/new/
https://reviews.llvm.org/D39417
More information about the llvm-commits
mailing list