[PATCH] D70043: [ConstantRange] Add `mulWithNoWrap()` method
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 9 05:48:30 PST 2019
lebedev.ri created this revision.
lebedev.ri added reviewers: nikic, spatel, reames, efriedma.
lebedev.ri added a project: LLVM.
Herald added a subscriber: hiraditya.
I'm not happy about this.
Baseline `ConstantRange::mul()` does not have an exhaustive test,
and if i add one (`TestUnsignedBinOpExhaustive()`+`/*CorrectnessOnly=*/true`),
it doesn't pass.
However `mulWithNoWrap` does pass conservatively correctness test.
Though it is less constrained than the brute-force approach.
I don't think it needs a different testing approach though?
Here we don't get `EXPECT_EQ(CR.isEmptySet(), AllOverflow);`
postcondition for free in any of the cases, so it needs to be
manually enforced. I wonder, shouldn't we be using
`unsigned*?MayOverflow() == OverflowResult::AlwaysOverflowsHigh*`
for that, everywhere? Should be more readable than manual inlined checks..
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D70043
Files:
llvm/include/llvm/IR/ConstantRange.h
llvm/lib/IR/ConstantRange.cpp
llvm/unittests/IR/ConstantRangeTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70043.228569.patch
Type: text/x-patch
Size: 7016 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191109/cd3a84f3/attachment.bin>
More information about the llvm-commits
mailing list