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)
commita52e0d7cc03306d3a89d891c1c5f4d6fee2cac1f
treef037c10b8fbae7b4b31b7b0a7b7a411dcd350448
parent3ca55d9c414541026dfea39bff809fc65e94cc87
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.

llvm-svn: 221065
clang/lib/Headers/bmiintrin.h