[all-commits] [llvm/llvm-project] 18ccca: [UBSan] Consider zero input to __builtin_clz/ctz t...
Craig Topper via All-commits
all-commits at lists.llvm.org
Fri Jun 2 13:01:31 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 18ccca4da8dec5fbfd1072a1c1544ce25f528627
https://github.com/llvm/llvm-project/commit/18ccca4da8dec5fbfd1072a1c1544ce25f528627
Author: Craig Topper <craig.topper at sifive.com>
Date: 2023-06-02 (Fri, 02 Jun 2023)
Changed paths:
M clang/lib/CodeGen/CGBuiltin.cpp
M clang/test/CodeGen/ubsan-builtin-checks.c
Log Message:
-----------
[UBSan] Consider zero input to __builtin_clz/ctz to be undefined independent of the target.
Previously we checked isCLZForZeroUndef and only added UBSan checks
if it returned true.
The builtin should be considered undefined for 0 regardless of
the target so that code using it is portable. The isCLZForZeroUndef
was only intended to disable optimizations in the middle end and
backend.
See https://discourse.llvm.org/t/should-ubsan-detect-0-input-to-builtin-clz-ctz-regardless-of-target/71060
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D152023
More information about the All-commits
mailing list