[all-commits] [llvm/llvm-project] ea2e66: [LLVM][ConstantFold] Undefined values are not cons...
Kees Cook via All-commits
all-commits at lists.llvm.org
Wed Mar 12 09:51:12 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: ea2e66aa8b6e363b89df66dc44275a0d7ecd70ce
https://github.com/llvm/llvm-project/commit/ea2e66aa8b6e363b89df66dc44275a0d7ecd70ce
Author: Kees Cook <kees at kernel.org>
Date: 2025-03-12 (Wed, 12 Mar 2025)
Changed paths:
M llvm/lib/IR/Constants.cpp
M llvm/test/Transforms/LowerConstantIntrinsics/constant-intrinsics.ll
Log Message:
-----------
[LLVM][ConstantFold] Undefined values are not constant (#130713)
llvm.is.constant (and therefore Clang's __builtin_constant_p()) need to
report undefined values as non-constant or future DCE choices end up
making no sense. This was encountered while building the Linux kernel
which uses __builtin_constant_p() while trying to evaluate if it is safe
to use a compile-time constant resolution for string lengths or if it
must kick over to a full runtime call to strlen(). Obviously an
undefined variable cannot be known at compile-time, so
__builtin_constant_p() needs to return false. This change will also mean
that Clang will match GCC's behavior under the same conditions.
Fixes #130649
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list