https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101701
--- Comment #4 from Jeremy R. <llvm at rifkin dot dev> --- I see with gcc x86_64 it does get the fold correct if another term (val == 5) is added to the if-else chain: https://godbolt.org/z/TE15Wf1bo.