diff options
author | Richard Smith <richard@metafoo.co.uk> | 2020-10-19 20:03:18 -0700 |
---|---|---|
committer | Richard Smith <richard@metafoo.co.uk> | 2020-10-19 23:59:11 -0700 |
commit | 08c8d5bc51c512e605840b8003fcf38c86d0fc96 (patch) | |
tree | 0dcca8915a3abd3fbffa21ae8e2ddb72303770d3 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
parent | 1329944c221ce2187acd30920dde8d443f8dac19 (diff) | |
download | llvm-08c8d5bc51c512e605840b8003fcf38c86d0fc96.zip llvm-08c8d5bc51c512e605840b8003fcf38c86d0fc96.tar.gz llvm-08c8d5bc51c512e605840b8003fcf38c86d0fc96.tar.bz2 |
Properly track whether a variable is constant-initialized.
This fixes miscomputation of __builtin_constant_evaluated in the
initializer of a variable that's not usable in constant expressions, but
is readable when constant-folding.
If evaluation of a constant initializer fails, we throw away the
evaluated result instead of keeping it as a non-constant-initializer
value for the variable, because it might not be a correct value.
To avoid regressions for initializers that are foldable but not formally
constant initializers, we now try constant-evaluating some globals in
C++ twice: once to check for a constant initializer (in an mode where
is_constannt_evaluated returns true) and again to determine the runtime
value if the initializer is not a constant initializer.
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
0 files changed, 0 insertions, 0 deletions