As the commit of D132658, make the 'nuw' change separately.
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
Please include a general proof link to Alive2.
| llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp | ||
|---|---|---|
| 236 | To be safe, use "dyn_cast" here. I don't have an example, but it is possible that the builder can constant fold the multiply, so the NewMul is not a BinaryOperator at this point. | |
| llvm/test/Transforms/InstCombine/mul.ll | ||
| 628 | Do we have tests where only the add or only the mul has nuw? | |
Comment Actions
- add new test case with only mull or add has nuw
- add checking dyn_cast<BinaryOperator>(NewMul)
Comment Actions
LGTM - see inline comment for minor change.
| llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp | ||
|---|---|---|
| 237 | It is better to use the normal LLVM code pattern instead of using both dyn_cast and cast: if (auto *NewMulBO = dyn_cast<BinaryOperator>(NewMul)) NewMulBO->setHasNoUnsignedWrap(); | |
To be safe, use "dyn_cast" here. I don't have an example, but it is possible that the builder can constant fold the multiply, so the NewMul is not a BinaryOperator at this point.