-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[clang] Rework hasBooleanRepresentation.
#136038
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1920,7 +1920,7 @@ static bool getRangeForType(CodeGenFunction &CGF, QualType Ty, | |
| llvm::MDNode *CodeGenFunction::getRangeForLoadFromType(QualType Ty) { | ||
| llvm::APInt Min, End; | ||
| if (!getRangeForType(*this, Ty, Min, End, CGM.getCodeGenOpts().StrictEnums, | ||
| Ty->hasBooleanRepresentation())) | ||
| Ty->hasBooleanRepresentation() && !Ty->isVectorType())) | ||
| return nullptr; | ||
|
|
||
| llvm::MDBuilder MDHelper(getLLVMContext()); | ||
|
|
@@ -1948,7 +1948,7 @@ bool CodeGenFunction::EmitScalarRangeCheck(llvm::Value *Value, QualType Ty, | |
| if (!HasBoolCheck && !HasEnumCheck) | ||
| return false; | ||
|
|
||
| bool IsBool = Ty->hasBooleanRepresentation() || | ||
| bool IsBool = (Ty->hasBooleanRepresentation() && !Ty->isVectorType()) || | ||
| NSAPI(CGM.getContext()).isObjCBOOLType(Ty); | ||
| bool NeedsBoolCheck = HasBoolCheck && IsBool; | ||
| bool NeedsEnumCheck = HasEnumCheck && Ty->getAs<EnumType>(); | ||
|
|
@@ -2068,11 +2068,8 @@ llvm::Value *CodeGenFunction::EmitLoadOfScalar(Address Addr, bool Volatile, | |
| /// by ConvertType) to its load/store type (as returned by | ||
| /// convertTypeForLoadStore). | ||
| llvm::Value *CodeGenFunction::EmitToMemory(llvm::Value *Value, QualType Ty) { | ||
| if (Ty->hasBooleanRepresentation() || Ty->isBitIntType()) { | ||
| llvm::Type *StoreTy = convertTypeForLoadStore(Ty, Value->getType()); | ||
| bool Signed = Ty->isSignedIntegerOrEnumerationType(); | ||
| return Builder.CreateIntCast(Value, StoreTy, Signed, "storedv"); | ||
| } | ||
| if (auto *AtomicTy = Ty->getAs<AtomicType>()) | ||
| Ty = AtomicTy->getValueType(); | ||
|
|
||
| if (Ty->isExtVectorBoolType()) { | ||
| llvm::Type *StoreTy = convertTypeForLoadStore(Ty, Value->getType()); | ||
|
|
@@ -2088,13 +2085,22 @@ llvm::Value *CodeGenFunction::EmitToMemory(llvm::Value *Value, QualType Ty) { | |
| Value = Builder.CreateBitCast(Value, StoreTy); | ||
| } | ||
|
|
||
| if (Ty->hasBooleanRepresentation() || Ty->isBitIntType()) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll double check. I know there have been changes recently to support a different ABI in the HLSL case.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only |
||
| llvm::Type *StoreTy = convertTypeForLoadStore(Ty, Value->getType()); | ||
| bool Signed = Ty->isSignedIntegerOrEnumerationType(); | ||
| return Builder.CreateIntCast(Value, StoreTy, Signed, "storedv"); | ||
| } | ||
|
|
||
| return Value; | ||
| } | ||
|
|
||
| /// Converts a scalar value from its load/store type (as returned | ||
| /// by convertTypeForLoadStore) to its primary IR type (as returned | ||
| /// by ConvertType). | ||
| llvm::Value *CodeGenFunction::EmitFromMemory(llvm::Value *Value, QualType Ty) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In here it is fine to handle the vector of bool types when |
||
| if (auto *AtomicTy = Ty->getAs<AtomicType>()) | ||
| Ty = AtomicTy->getValueType(); | ||
|
|
||
| if (Ty->isPackedVectorBoolType(getContext())) { | ||
| const auto *RawIntTy = Value->getType(); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.