]> granicus.if.org Git - clang/commit
Avoid undefined behavior in the x86 bmi header file by explicitly checking for 0...
authorCraig Topper <craig.topper@gmail.com>
Sat, 1 Nov 2014 22:50:54 +0000 (22:50 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sat, 1 Nov 2014 22:50:54 +0000 (22:50 +0000)
commitd520349ab94cfa8814291e4eec3a9200fde47dd1
tree0d7bad4c0f693d1f16ec29585b4753a179f7df94
parentfd2bb3d314deec4d2c6dfd036db8d401ec5b16bc
Avoid undefined behavior in the x86 bmi header file by explicitly checking for 0 before calling __builtin_ctz. Without this the optimizers may take advantage of the undefined behavior and produce incorrect results. LLVM itself still needs to be taught to merge the zero check into the llvm.cttz with defined zero behavior.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221065 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Headers/bmiintrin.h