[clang] Revert "[HLSL] Vector standard conversions (#71098)" (PR #81944)

via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 15 15:59:24 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-static-analyzer-1

Author: Prabhuk (Prabhuk)

<details>
<summary>Changes</summary>

This reverts commit 5c57fd717d5d6a285efeb8402c6fe0c8f70592f3. 
This commit causes crashes in Clang codegen tests.

---

Patch is 53.50 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/81944.diff


24 Files Affected:

- (modified) clang/include/clang/AST/OperationKinds.def (-3) 
- (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (-3) 
- (modified) clang/include/clang/Sema/Overload.h (+1-11) 
- (modified) clang/lib/AST/Expr.cpp (-1) 
- (modified) clang/lib/AST/ExprConstant.cpp (-2) 
- (modified) clang/lib/CodeGen/CGExpr.cpp (-1) 
- (modified) clang/lib/CodeGen/CGExprAgg.cpp (-2) 
- (modified) clang/lib/CodeGen/CGExprComplex.cpp (-1) 
- (modified) clang/lib/CodeGen/CGExprConstant.cpp (-1) 
- (modified) clang/lib/CodeGen/CGExprScalar.cpp (+3-61) 
- (modified) clang/lib/Edit/RewriteObjCFoundationAPI.cpp (-4) 
- (modified) clang/lib/Sema/SemaChecking.cpp (+2-9) 
- (modified) clang/lib/Sema/SemaExprCXX.cpp (-86) 
- (modified) clang/lib/Sema/SemaInit.cpp (+1-1) 
- (modified) clang/lib/Sema/SemaOverload.cpp (+35-118) 
- (modified) clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp (+1-2) 
- (removed) clang/test/CodeGenHLSL/BasicFeatures/standard_conversion_sequences.hlsl (-119) 
- (modified) clang/test/CodeGenHLSL/builtins/ScalarSwizzles.hlsl (+27-10) 
- (modified) clang/test/CodeGenHLSL/builtins/sqrt.hlsl (+5) 
- (modified) clang/test/SemaHLSL/BuiltIns/vector-constructors-erros.hlsl (+1-1) 
- (removed) clang/test/SemaHLSL/OverloadResolutionBugs.hlsl (-39) 
- (modified) clang/test/SemaHLSL/Types/BuiltinVector/ScalarSwizzles.hlsl (+23-2) 
- (removed) clang/test/SemaHLSL/VectorOverloadResolution.hlsl (-30) 
- (removed) clang/test/SemaHLSL/standard_conversion_sequences.hlsl (-92) 


``````````diff
diff --git a/clang/include/clang/AST/OperationKinds.def b/clang/include/clang/AST/OperationKinds.def
index ef05072800f11a..8dd98730dff742 100644
--- a/clang/include/clang/AST/OperationKinds.def
+++ b/clang/include/clang/AST/OperationKinds.def
@@ -361,9 +361,6 @@ CAST_OPERATION(AddressSpaceConversion)
 // Convert an integer initializer to an OpenCL sampler.
 CAST_OPERATION(IntToOCLSampler)
 
-// Truncate a vector type by dropping elements from the end (HLSL only).
-CAST_OPERATION(HLSLVectorTruncation)
-
 //===- Binary Operations  -------------------------------------------------===//
 // Operators listed in order of precedence.
 // Note that additions to this should also update the StmtVisitor class,
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index fb44495199ee56..ce619d2996f201 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -12112,9 +12112,6 @@ def err_hlsl_operator_unsupported : Error<
 def err_hlsl_param_qualifier_mismatch :
   Error<"conflicting parameter qualifier %0 on parameter %1">;
 
-def warn_hlsl_impcast_vector_truncation : Warning<
-  "implicit conversion truncates vector: %0 to %1">, InGroup<Conversion>;
-
 // Layout randomization diagnostics.
 def err_non_designated_init_used : Error<
   "a randomized struct can only be initialized with a designated initializer">;
diff --git a/clang/include/clang/Sema/Overload.h b/clang/include/clang/Sema/Overload.h
index e4717dd5baf1e8..9b342c09168444 100644
--- a/clang/include/clang/Sema/Overload.h
+++ b/clang/include/clang/Sema/Overload.h
@@ -195,9 +195,6 @@ class Sema;
     /// Fixed point type conversions according to N1169.
     ICK_Fixed_Point_Conversion,
 
-    /// HLSL vector truncation.
-    ICK_HLSL_Vector_Truncation,
-
     /// The number of conversion kinds
     ICK_Num_Conversion_Kinds,
   };
@@ -274,12 +271,6 @@ class Sema;
     /// pointer-to-member conversion, or boolean conversion.
     ImplicitConversionKind Second : 8;
 
-    /// Element - Between the second and third conversion a vector or matrix
-    /// element conversion may occur. If this is not ICK_Identity this
-    /// conversion is applied element-wise to each element in the vector or
-    /// matrix.
-    ImplicitConversionKind Element : 8;
-
     /// Third - The third conversion can be a qualification conversion
     /// or a function conversion.
     ImplicitConversionKind Third : 8;
@@ -376,8 +367,7 @@ class Sema;
     void setAsIdentityConversion();
 
     bool isIdentityConversion() const {
-      return Second == ICK_Identity && Element == ICK_Identity &&
-             Third == ICK_Identity;
+      return Second == ICK_Identity && Third == ICK_Identity;
     }
 
     ImplicitConversionRank getRank() const;
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index cc0407131d7931..8b10e289583260 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -1897,7 +1897,6 @@ bool CastExpr::CastConsistency() const {
   case CK_FixedPointToIntegral:
   case CK_IntegralToFixedPoint:
   case CK_MatrixCast:
-  case CK_HLSLVectorTruncation:
     assert(!getType()->isBooleanType() && "unheralded conversion to bool");
     goto CheckNoBasePath;
 
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index fcf8f6591a7923..010010120cf6dd 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -13980,7 +13980,6 @@ bool IntExprEvaluator::VisitCastExpr(const CastExpr *E) {
   case CK_FixedPointCast:
   case CK_IntegralToFixedPoint:
   case CK_MatrixCast:
-  case CK_HLSLVectorTruncation:
     llvm_unreachable("invalid cast kind for integral value");
 
   case CK_BitCast:
@@ -14819,7 +14818,6 @@ bool ComplexExprEvaluator::VisitCastExpr(const CastExpr *E) {
   case CK_FixedPointToIntegral:
   case CK_IntegralToFixedPoint:
   case CK_MatrixCast:
-  case CK_HLSLVectorTruncation:
     llvm_unreachable("invalid cast kind for complex value");
 
   case CK_LValueToRValue:
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 59a7fe8925001c..4a2f3caad6588c 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -5180,7 +5180,6 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
   case CK_FixedPointToIntegral:
   case CK_IntegralToFixedPoint:
   case CK_MatrixCast:
-  case CK_HLSLVectorTruncation:
     return EmitUnsupportedLValue(E, "unexpected cast lvalue");
 
   case CK_Dependent:
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp
index d0d6202974fe9b..22f55fe9aac904 100644
--- a/clang/lib/CodeGen/CGExprAgg.cpp
+++ b/clang/lib/CodeGen/CGExprAgg.cpp
@@ -933,7 +933,6 @@ void AggExprEmitter::VisitCastExpr(CastExpr *E) {
   case CK_BuiltinFnToFnPtr:
   case CK_ZeroToOCLOpaqueType:
   case CK_MatrixCast:
-  case CK_HLSLVectorTruncation:
 
   case CK_IntToOCLSampler:
   case CK_FloatingToFixedPoint:
@@ -1458,7 +1457,6 @@ static bool castPreservesZero(const CastExpr *CE) {
   case CK_MatrixCast:
   case CK_NonAtomicToAtomic:
   case CK_AtomicToNonAtomic:
-  case CK_HLSLVectorTruncation:
     return true;
 
   case CK_BaseToDerivedMemberPointer:
diff --git a/clang/lib/CodeGen/CGExprComplex.cpp b/clang/lib/CodeGen/CGExprComplex.cpp
index 176a7e00141f94..9ddf0e763f139b 100644
--- a/clang/lib/CodeGen/CGExprComplex.cpp
+++ b/clang/lib/CodeGen/CGExprComplex.cpp
@@ -564,7 +564,6 @@ ComplexPairTy ComplexExprEmitter::EmitCast(CastKind CK, Expr *Op,
   case CK_FixedPointToIntegral:
   case CK_IntegralToFixedPoint:
   case CK_MatrixCast:
-  case CK_HLSLVectorTruncation:
     llvm_unreachable("invalid cast kind for complex value");
 
   case CK_FloatingRealToComplex:
diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp
index 75286dceb13a7b..a054f38e860b72 100644
--- a/clang/lib/CodeGen/CGExprConstant.cpp
+++ b/clang/lib/CodeGen/CGExprConstant.cpp
@@ -1225,7 +1225,6 @@ class ConstExprEmitter :
     case CK_IntegralToFixedPoint:
     case CK_ZeroToOCLOpaqueType:
     case CK_MatrixCast:
-    case CK_HLSLVectorTruncation:
       return nullptr;
     }
     llvm_unreachable("Invalid CastKind");
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp
index 13526de3e76421..aa805f291d1757 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/lib/CodeGen/CGExprScalar.cpp
@@ -2408,12 +2408,6 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
                                 CE->getExprLoc());
 
   case CK_IntegralCast: {
-    if (E->getType()->isExtVectorType() && DestTy->isExtVectorType()) {
-      QualType SrcElTy = E->getType()->castAs<VectorType>()->getElementType();
-      return Builder.CreateIntCast(Visit(E), ConvertType(DestTy),
-                                   SrcElTy->isSignedIntegerOrEnumerationType(),
-                                   "conv");
-    }
     ScalarConversionOpts Opts;
     if (auto *ICE = dyn_cast<ImplicitCastExpr>(CE)) {
       if (!ICE->isPartOfExplicitCast())
@@ -2422,50 +2416,9 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
     return EmitScalarConversion(Visit(E), E->getType(), DestTy,
                                 CE->getExprLoc(), Opts);
   }
-  case CK_IntegralToFloating: {
-    if (E->getType()->isVectorType() && DestTy->isVectorType()) {
-      // TODO: Support constrained FP intrinsics.
-      assert(!Builder.getIsFPConstrained() &&
-             "FP Constrained vector casts not supported yet.");
-      QualType SrcElTy = E->getType()->castAs<VectorType>()->getElementType();
-      if (SrcElTy->isSignedIntegerOrEnumerationType())
-        return Builder.CreateSIToFP(Visit(E), ConvertType(DestTy), "conv");
-      return Builder.CreateUIToFP(Visit(E), ConvertType(DestTy), "conv");
-    }
-    CodeGenFunction::CGFPOptionsRAII FPOptsRAII(CGF, CE);
-    return EmitScalarConversion(Visit(E), E->getType(), DestTy,
-                                CE->getExprLoc());
-  }
-  case CK_FloatingToIntegral: {
-    if (E->getType()->isVectorType() && DestTy->isVectorType()) {
-      // TODO: Support constrained FP intrinsics.
-      assert(!Builder.getIsFPConstrained() &&
-             "FP Constrained vector casts not supported yet.");
-      QualType DstElTy = DestTy->castAs<VectorType>()->getElementType();
-      if (DstElTy->isSignedIntegerOrEnumerationType())
-        return Builder.CreateFPToSI(Visit(E), ConvertType(DestTy), "conv");
-      return Builder.CreateFPToUI(Visit(E), ConvertType(DestTy), "conv");
-    }
-    CodeGenFunction::CGFPOptionsRAII FPOptsRAII(CGF, CE);
-    return EmitScalarConversion(Visit(E), E->getType(), DestTy,
-                                CE->getExprLoc());
-  }
-  case CK_FloatingCast: {
-    if (E->getType()->isVectorType() && DestTy->isVectorType()) {
-      // TODO: Support constrained FP intrinsics.
-      assert(!Builder.getIsFPConstrained() &&
-             "FP Constrained vector casts not supported yet.");
-      QualType SrcElTy = E->getType()->castAs<VectorType>()->getElementType();
-      QualType DstElTy = DestTy->castAs<VectorType>()->getElementType();
-      if (DstElTy->castAs<BuiltinType>()->getKind() <
-          SrcElTy->castAs<BuiltinType>()->getKind())
-        return Builder.CreateFPTrunc(Visit(E), ConvertType(DestTy), "conv");
-      return Builder.CreateFPExt(Visit(E), ConvertType(DestTy), "conv");
-    }
-    CodeGenFunction::CGFPOptionsRAII FPOptsRAII(CGF, CE);
-    return EmitScalarConversion(Visit(E), E->getType(), DestTy,
-                                CE->getExprLoc());
-  }
+  case CK_IntegralToFloating:
+  case CK_FloatingToIntegral:
+  case CK_FloatingCast:
   case CK_FixedPointToFloating:
   case CK_FloatingToFixedPoint: {
     CodeGenFunction::CGFPOptionsRAII FPOptsRAII(CGF, CE);
@@ -2515,17 +2468,6 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
   case CK_IntToOCLSampler:
     return CGF.CGM.createOpenCLIntToSamplerConversion(E, CGF);
 
-  case CK_HLSLVectorTruncation: {
-    assert(DestTy->isVectorType() && "Expected dest type to be vector type");
-    Value *Vec = Visit(const_cast<Expr *>(E));
-    SmallVector<int, 16> Mask;
-    unsigned NumElts = DestTy->castAs<VectorType>()->getNumElements();
-    for (unsigned I = 0; I != NumElts; ++I)
-      Mask.push_back(I);
-
-    return Builder.CreateShuffleVector(Vec, Mask, "trunc");
-  }
-
   } // end of switch
 
   llvm_unreachable("unknown scalar cast");
diff --git a/clang/lib/Edit/RewriteObjCFoundationAPI.cpp b/clang/lib/Edit/RewriteObjCFoundationAPI.cpp
index 22f2c47e1d6a13..2e123e89b00365 100644
--- a/clang/lib/Edit/RewriteObjCFoundationAPI.cpp
+++ b/clang/lib/Edit/RewriteObjCFoundationAPI.cpp
@@ -1083,10 +1083,6 @@ static bool rewriteToNumericBoxedExpression(const ObjCMessageExpr *Msg,
     case CK_BooleanToSignedIntegral:
       llvm_unreachable("OpenCL-specific cast in Objective-C?");
 
-    case CK_HLSLVectorTruncation:
-      llvm_unreachable("HLSL-specific cast in Objective-C?");
-      break;
-
     case CK_FloatingToFixedPoint:
     case CK_FixedPointToFloating:
     case CK_FixedPointCast:
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 8e763384774444..afe2673479e40a 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -15676,18 +15676,11 @@ static void CheckImplicitConversion(Sema &S, Expr *E, QualType T,
       if (S.SourceMgr.isInSystemMacro(CC))
         return;
       return DiagnoseImpCast(S, E, T, CC, diag::warn_impcast_vector_scalar);
-    } else if (S.getLangOpts().HLSL &&
-               Target->castAs<VectorType>()->getNumElements() <
-                   Source->castAs<VectorType>()->getNumElements()) {
-      // Diagnose vector truncation but don't return. We may also want to
-      // diagnose an element conversion.
-      DiagnoseImpCast(S, E, T, CC, diag::warn_hlsl_impcast_vector_truncation);
     }
 
     // If the vector cast is cast between two vectors of the same size, it is
-    // a bitcast, not a conversion, except under HLSL where it is a conversion.
-    if (!S.getLangOpts().HLSL &&
-        S.Context.getTypeSize(Source) == S.Context.getTypeSize(Target))
+    // a bitcast, not a conversion.
+    if (S.Context.getTypeSize(Source) == S.Context.getTypeSize(Target))
       return;
 
     Source = cast<VectorType>(Source)->getElementType().getTypePtr();
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 801ce7b35ac47f..f2b89135af21cf 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -4762,22 +4762,6 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
                              CK_ZeroToOCLOpaqueType,
                              From->getValueKind()).get();
     break;
-  case ICK_HLSL_Vector_Truncation: {
-    // Note: HLSL built-in vectors are ExtVectors. Since this truncates a vector
-    // to a smaller vector, this can only operate on arguments where the source
-    // and destination types are ExtVectors.
-    assert(From->getType()->isExtVectorType() && ToType->isExtVectorType() &&
-           "HLSL vector truncation should only apply to ExtVectors");
-    auto *FromVec = From->getType()->castAs<VectorType>();
-    auto *ToVec = ToType->castAs<VectorType>();
-    QualType ElType = FromVec->getElementType();
-    QualType TruncTy =
-        Context.getExtVectorType(ElType, ToVec->getNumElements());
-    From = ImpCastExprToType(From, TruncTy, CK_HLSLVectorTruncation,
-                             From->getValueKind())
-               .get();
-    break;
-  }
 
   case ICK_Lvalue_To_Rvalue:
   case ICK_Array_To_Pointer:
@@ -4790,76 +4774,6 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
     llvm_unreachable("Improper second standard conversion");
   }
 
-  if (SCS.Element != ICK_Identity) {
-    // If SCS.Element is not ICK_Identity the To and From types must be HLSL
-    // vectors or matrices.
-
-    // TODO: Support HLSL matrices.
-    assert((!From->getType()->isMatrixType() && !ToType->isMatrixType()) &&
-           "Element conversion for matrix types is not implemented yet.");
-    assert(From->getType()->isVectorType() && ToType->isVectorType() &&
-           "Element conversion is only supported for vector types.");
-    assert(From->getType()->getAs<VectorType>()->getNumElements() ==
-               ToType->getAs<VectorType>()->getNumElements() &&
-           "Element conversion is only supported for vectors with the same "
-           "element counts.");
-    QualType FromElTy = From->getType()->getAs<VectorType>()->getElementType();
-    unsigned NumElts = ToType->getAs<VectorType>()->getNumElements();
-    switch (SCS.Element) {
-    case ICK_Boolean_Conversion:
-      // Perform half-to-boolean conversion via float.
-      if (FromElTy->isHalfType()) {
-        QualType FPExtType = Context.getExtVectorType(FromElTy, NumElts);
-        From = ImpCastExprToType(From, FPExtType, CK_FloatingCast).get();
-        FromType = FPExtType;
-      }
-
-      From =
-          ImpCastExprToType(From, ToType, ScalarTypeToBooleanCastKind(FromElTy),
-                            VK_PRValue,
-                            /*BasePath=*/nullptr, CCK)
-              .get();
-      break;
-    case ICK_Integral_Promotion:
-    case ICK_Integral_Conversion:
-      if (ToType->isBooleanType()) {
-        assert(FromType->castAs<EnumType>()->getDecl()->isFixed() &&
-               SCS.Second == ICK_Integral_Promotion &&
-               "only enums with fixed underlying type can promote to bool");
-        From = ImpCastExprToType(From, ToType, CK_IntegralToBoolean, VK_PRValue,
-                                 /*BasePath=*/nullptr, CCK)
-                   .get();
-      } else {
-        From = ImpCastExprToType(From, ToType, CK_IntegralCast, VK_PRValue,
-                                 /*BasePath=*/nullptr, CCK)
-                   .get();
-      }
-      break;
-
-    case ICK_Floating_Promotion:
-    case ICK_Floating_Conversion:
-      From = ImpCastExprToType(From, ToType, CK_FloatingCast, VK_PRValue,
-                               /*BasePath=*/nullptr, CCK)
-                 .get();
-      break;
-    case ICK_Floating_Integral:
-      if (ToType->isRealFloatingType())
-        From =
-            ImpCastExprToType(From, ToType, CK_IntegralToFloating, VK_PRValue,
-                              /*BasePath=*/nullptr, CCK)
-                .get();
-      else
-        From =
-            ImpCastExprToType(From, ToType, CK_FloatingToIntegral, VK_PRValue,
-                              /*BasePath=*/nullptr, CCK)
-                .get();
-      break;
-    case ICK_Identity:
-    default:
-      llvm_unreachable("Improper element standard conversion");
-    }
-  }
-
   switch (SCS.Third) {
   case ICK_Identity:
     // Nothing to do.
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 0fd458837163e5..b6de06464cd6f3 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -6432,7 +6432,7 @@ void InitializationSequence::InitializeFrom(Sema &S,
   // For HLSL ext vector types we allow list initialization behavior for C++
   // constructor syntax. This is accomplished by converting initialization
   // arguments an InitListExpr late.
-  if (S.getLangOpts().HLSL && Args.size() > 1 && DestType->isExtVectorType() &&
+  if (S.getLangOpts().HLSL && DestType->isExtVectorType() &&
       (SourceType.isNull() ||
        !Context.hasSameUnqualifiedType(SourceType, DestType))) {
 
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index f7645422348b65..5c6d463bb895df 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -159,7 +159,6 @@ ImplicitConversionRank clang::GetConversionRank(ImplicitConversionKind Kind) {
       ICR_C_Conversion,
       ICR_C_Conversion_Extension,
       ICR_Conversion,
-      ICR_Conversion,
   };
   static_assert(std::size(Rank) == (int)ICK_Num_Conversion_Kinds);
   return Rank[(int)Kind];
@@ -200,7 +199,6 @@ static const char *GetImplicitConversionName(ImplicitConversionKind Kind) {
       "C specific type conversion",
       "Incompatible pointer conversion",
       "Fixed point conversion",
-      "HLSL vector truncation",
   };
   static_assert(std::size(Name) == (int)ICK_Num_Conversion_Kinds);
   return Name[Kind];
@@ -211,7 +209,6 @@ static const char *GetImplicitConversionName(ImplicitConversionKind Kind) {
 void StandardConversionSequence::setAsIdentityConversion() {
   First = ICK_Identity;
   Second = ICK_Identity;
-  Element = ICK_Identity;
   Third = ICK_Identity;
   DeprecatedStringLiteralToCharPtr = false;
   QualificationIncludesObjCLifetime = false;
@@ -230,13 +227,11 @@ void StandardConversionSequence::setAsIdentityConversion() {
 /// implicit conversions.
 ImplicitConversionRank StandardConversionSequence::getRank() const {
   ImplicitConversionRank Rank = ICR_Exact_Match;
-  if (GetConversionRank(First) > Rank)
+  if  (GetConversionRank(First) > Rank)
     Rank = GetConversionRank(First);
-  if (GetConversionRank(Second) > Rank)
+  if  (GetConversionRank(Second) > Rank)
     Rank = GetConversionRank(Second);
-  if (GetConversionRank(Element) > Rank)
-    Rank = GetConversionRank(Element);
-  if (GetConversionRank(Third) > Rank)
+  if  (GetConversionRank(Third) > Rank)
     Rank = GetConversionRank(Third);
   return Rank;
 }
@@ -1833,86 +1828,13 @@ bool Sema::IsFunctionConversion(QualType FromType, QualType ToType,
   return true;
 }
 
-/// Determine whether the conversion from FromType to ToType is a valid
-/// floating point conversion.
-///
-static bool IsFloatingPointConversion(Sema &S, QualType FromType,
-                                      QualType ToType) {
-  if (!FromType->isRealFloatingType() || !ToType->isRealFloatingType())
-    return false;
-  // FIXME: disable conversions between long double, __ibm128 and __float128
-  // if their representation is different until there is back end support
-  // We of course allow this conversion if long double is really double.
-
-  // Conversions between bfloat16 and float16 are currently not supported.
-  if ((FromType->isBFloat16Type() &&
-       (ToType->isFloat16Type() || ToType->isHalfType())) ||
-      (ToType->isBFloat16Type() &&
-       (FromType->isFloat16Type() || FromType->isHalfType())))
-    return false;
-
-  // Conversions between IEEE-quad and IBM-extended semantic...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/81944


More information about the cfe-commits mailing list