=?utf-8?q?FĂ©lix?= Cloutier <[email protected]>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/[email protected]>


================
@@ -2198,8 +2211,16 @@ llvm::Value *CodeGenFunction::EmitFromMemory(llvm::Value 
*Value, QualType Ty) {
   }
 
   llvm::Type *ResTy = ConvertType(Ty);
-  if (Ty->hasBooleanRepresentation() || Ty->isBitIntType() ||
-      Ty->isExtVectorBoolType())
+  bool IsBitInt = Ty->isBitIntType();
+  bool HasBoolRep = Ty->hasBooleanRepresentation();
+  if (HasBoolRep && !IsBitInt &&
----------------
apple-fcloutier wrote:

If we treat `BitInt(1)` as a bool for the purposes of loading from memory, then:

* under `-fstrict-bool`, all BitInt values are truncated and insensitive to 
their padding bits
* under `-fno-strict-bool=truncate`, all BitInt values are truncated and 
insensitive to their padding bits
* under `-fno-strict-bool=nonzero`, all BitInt values are truncated and 
insensitive to their padding bits _except_ for `BitInt(1)`, which considers the 
value of its entire storage unit

There would be a strong case to make that it's a bug. Since BitInt values never 
get !range metadata at this time, I think it's better to leave it alone. 
If/when they do, there can be a `-f{,no-}strict-bitint` that controls how all 
BitInt values, including BitInt(1), behave with respect to their padding bits.

https://github.com/llvm/llvm-project/pull/160790
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to