vsk added a comment.

In https://reviews.llvm.org/D29369#664366, @regehr wrote:

> Out of curiosity, how many of these superfluous checks are not subsequently 
> eliminated by InstCombine?


I don't have numbers from a benchmark prepped. Here's what we get with the 
'ubsan-promoted-arith.cpp' test case from this patch:

| Setup                        | # of overflow checks |
| unpatched, -O0               | 22                   |
| unpatched, -O0 + instcombine | 7                    |
| patched, -O0                 | 8                    |
| patched, -O0 + instcombine   | 7                    |

(There's a difference between the "patched, -O0" setup and the "patched, -O0 + 
instcombine" setup because llvm figures out that the symbol 'a' is 0, and gets 
rid of an addition that way.)

At least for us, this patch is still worthwhile, because our use case is `-O0 
-fsanitized=undefined`. Also, this makes less work for instcombine, but I 
haven't measured the compile-time effect.


https://reviews.llvm.org/D29369



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to