Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
With the above changes to the test case (and the corresponding changes to the reference output), the problem would have been blatantly obvious from the start and we wouldn't have to jump through hoops to ensure opt isn't just giving us the right answer.
SingleSource/Benchmarks/Misc/revertBits.c | ||
---|---|---|
42 ↗ | (On Diff #119174) | I believe the focus in a test case such as this should be not only on ensuring the faster code-gen, but on functional correctness. unsigned int Rev32 = strtoll("0x11223344", NULL, 16); unsigned long long Rev64 = strtoll("0x1122334455667788", NULL, 16); printf("0x%X -> 0x%X\n", Rev32, ReverseBits32(Rev32)); printf("0x%llX -> 0x%llX\n", Rev64, ReverseBits64(Rev64)); |
45 ↗ | (On Diff #119174) | Here' we'd just print the expected values: printf("0x%X -> 0x%X\n", Rev32, ReverseBits32(Rev32)); printf("0x%llX -> 0x%llX\n", Rev64, ReverseBits64(Rev64)); |
48 ↗ | (On Diff #119174) | And here, we'd generate the values using the builtin: printf("0x%X -> 0x%X\n", Rev32, __builtin_bitreverse32(Rev32)); printf("0x%llX -> 0x%llX\n", Rev64, __builtin_bitreverse64(Rev64)); |
SingleSource/Benchmarks/Misc/revertBits.reference_output | ||
1 ↗ | (On Diff #119174) | As I mentioned before, I would very much prefer that this test case include an obvious, easily verifiable functional test. See above. |
SingleSource/Benchmarks/Misc/revertBits.c | ||
---|---|---|
36 ↗ | (On Diff #119489) | Changing the type from long long to int here is probably not safe. Since we are calculating the summation of 0x1000000 reversed numbers. Without reversing them, the total sum would definitely overflow an integer ((1+0x1000000)* 0x1000000/2). With reversing, I don't calculate, but we'd better leave it to long long for safety. |
42 ↗ | (On Diff #119174) | I agree with Nemanja here. Some obvious functional testing is necessary. |
SingleSource/Benchmarks/Misc/revertBits.c | ||
---|---|---|
42 ↗ | (On Diff #119174) | There is another issue. ReverseBits32/64 should use unsigned types. Updated |
While the change itself makes sense:
- Please give some more descriptions than "update test" in the future.
- Also give a warning in the commit message as this changes performance and will show up in the LNT numbers.
We also have a live installation at http://lnt.llvm.org
A few of our buildbots submit data there.