[ubsan] Diagnose invalid uses of builtins (clang)

Description

[ubsan] Diagnose invalid uses of builtins (clang)

On some targets, passing zero to the clz() or ctz() builtins has undefined
behavior. I ran into this issue while debugging UB in __hash_table from libcxx:
the bug I was seeing manifested itself differently under -O0 vs -Os, due to a
UB call to clz() (see: libcxx/r304617).

This patch introduces a check which can detect UB calls to builtins.

llvm.org/PR26979

Differential Revision: https://reviews.llvm.org/D34590

Details

Committed
vedantkJul 28 2017, 5:19 PM
Differential Revision
D34590: [ubsan] Diagnose invalid uses of builtins (clang)
Parents
rL309458: [test] Add test case for -polly-simplify. NFC.
Branches
Unknown
Tags
Unknown