Author: abataev Date: Wed Oct 9 13:54:06 2019 New Revision: 374224 URL: http://llvm.org/viewvc/llvm-project?rev=374224&view=rev Log: [OPENMP50]Fix scoring of contexts with and without user provided scores.
The context selector with user provided score must have higher score than the context selector without user provided score. Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp cfe/trunk/test/OpenMP/declare_variant_implementation_vendor_codegen.cpp Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=374224&r1=374223&r2=374224&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original) +++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Wed Oct 9 13:54:06 2019 @@ -11187,7 +11187,7 @@ static bool greaterCtxScore(ASTContext & return false; llvm::APSInt LHSVal = LHS->EvaluateKnownConstInt(Ctx); llvm::APSInt RHSVal = RHS->EvaluateKnownConstInt(Ctx); - return llvm::APSInt::compareValues(LHSVal, RHSVal) <= 0; + return llvm::APSInt::compareValues(LHSVal, RHSVal) >= 0; } namespace { @@ -11250,7 +11250,7 @@ static const FunctionDecl *getDeclareVar } // If the attribute matches the context, find the attribute with the highest // score. - if (SelectedAttr && (!TopMostAttr || Comparer(TopMostAttr, SelectedAttr))) + if (SelectedAttr && (!TopMostAttr || !Comparer(TopMostAttr, SelectedAttr))) TopMostAttr = SelectedAttr; } if (!TopMostAttr) Modified: cfe/trunk/test/OpenMP/declare_variant_implementation_vendor_codegen.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/declare_variant_implementation_vendor_codegen.cpp?rev=374224&r1=374223&r2=374224&view=diff ============================================================================== --- cfe/trunk/test/OpenMP/declare_variant_implementation_vendor_codegen.cpp (original) +++ cfe/trunk/test/OpenMP/declare_variant_implementation_vendor_codegen.cpp Wed Oct 9 13:54:06 2019 @@ -8,11 +8,11 @@ // CHECK-DAG: @_ZN16SpecSpecialFuncs6MethodEv = {{.*}}alias i32 (%struct.SpecSpecialFuncs*), i32 (%struct.SpecSpecialFuncs*)* @_ZN16SpecSpecialFuncs7method_Ev // CHECK-DAG: @_ZN16SpecSpecialFuncs6methodEv = linkonce_odr {{.*}}alias i32 (%struct.SpecSpecialFuncs*), i32 (%struct.SpecSpecialFuncs*)* @_ZN16SpecSpecialFuncs7method_Ev // CHECK-DAG: @_ZN12SpecialFuncs6methodEv = linkonce_odr {{.*}}alias i32 (%struct.SpecialFuncs*), i32 (%struct.SpecialFuncs*)* @_ZN12SpecialFuncs7method_Ev -// CHECK-DAG: @_Z5prio_v = {{.*}}alias i32 (), i32 ()* @_Z4priov +// CHECK-DAG: @_Z5prio_v = {{.*}}alias i32 (), i32 ()* @_Z5prio1v // CHECK-DAG: @_ZL6prio1_v = internal alias i32 (), i32 ()* @_ZL5prio2v // CHECK-DAG: @_Z4callv = {{.*}}alias i32 (), i32 ()* @_Z4testv // CHECK-DAG: @_ZL9stat_usedv = internal alias i32 (), i32 ()* @_ZL10stat_used_v -// CHECK-DAG: @_ZN12SpecialFuncs6MethodEv = {{.*}}alias i32 (%struct.SpecialFuncs*), i32 (%struct.SpecialFuncs*)* @_ZN12SpecialFuncs7method_Ev +// CHECK-DAG: @_ZN12SpecialFuncs6MethodEv = {{.*}}alias i32 (%struct.SpecialFuncs*), i32 (%struct.SpecialFuncs*)* @_ZN12SpecialFuncs7method_Ev // CHECK-DAG: @fn_linkage = {{.*}}alias i32 (), i32 ()* @_Z18fn_linkage_variantv // CHECK-DAG: @_Z11fn_linkage1v = {{.*}}alias i32 (), i32 ()* @fn_linkage_variant1 // CHECK-DAG: declare {{.*}}i32 @_Z5bazzzv() _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits