=?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 &&
+ CGM.getCodeGenOpts().getLoadBoolFromMem() ==
+ CodeGenOptions::BoolFromMem::NonZero) {
+ auto *NonZero = Builder.CreateICmpNE(
+ Value, llvm::Constant::getNullValue(Value->getType()), "loadedv.nz");
+ return Builder.CreateIntCast(NonZero, ResTy, false, "loadedv");
----------------
apple-fcloutier wrote:
I can't really think of a situation where it is needed, but it just returns
NonZero if there's no cast to do. It felt less hard-codey but I'll remove it.
https://github.com/llvm/llvm-project/pull/160790
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits