Sorry for the delay, this has been a rocky summer. The PR is now up: [clang] Implement -fstrict-bool by apple-fcloutier · Pull Request #160790 · llvm/llvm-project · GitHub
As clarified, this introduces the following options:
-fstrict-bool[the default, maintaining the status quo]: Clang can optimize code based on the assumption that bool values always have a bit pattern of 0 or 1.-fno-strict-bool=truncate: Clang does not optimize code on the assumption that bool values always have a bit pattern of 0 or 1: when loading aboolfrom memory, it will treat it as true if the least significant bit is set, and false otherwise (ie,value & 1).-fno-strict-bool=nonzero: Clang does not optimize code on the assumption that bool values always have a bit pattern of 0 or 1: when loading aboolfrom memory, it will treat it as true if any bit is set, and false otherwise (ie,value != 0).-fno-strict-bool: for now, the same as-fno-strict-bool=truncate.
The nonzero and truncate options were introduced so that the community can assess impact on their preferred targets, and we can change the default for specific targets if that makes sense. In my experience, nonzero is typically what people expect, but the code for truncate on arm64 is slightly better in the worst case.