[Frontend] Sort featuresVec for AMDGPU target features
authorFangrui Song <i@maskray.me>
Sat, 22 Jul 2023 22:57:41 +0000 (15:57 -0700)
committerFangrui Song <i@maskray.me>
Sat, 22 Jul 2023 22:57:41 +0000 (15:57 -0700)
D145579 leverages the iteration order of StringSet, which is not
guaranteed to be deterministic.

flang/lib/Frontend/FrontendActions.cpp
flang/test/Lower/OpenMP/target_cpu_features.f90

index d1158cb..0154fd2 100644 (file)
@@ -165,7 +165,7 @@ getExplicitAndImplicitAMDGPUTargetFeatures(CompilerInstance &ci,
                            implicitFeatureItem.first().str())
                               .str());
   }
-
+  llvm::sort(featuresVec);
   return llvm::join(featuresVec, ",");
 }
 
index eb87c81..08aee02 100644 (file)
@@ -6,10 +6,10 @@
 !===============================================================================
 
 !CHECK: omp.target = #omp.target<target_cpu = "gfx908",
-!CHECK-SAME: target_features = "+dot3-insts,+dot4-insts,+s-memtime-inst,
-!CHECK-SAME: +16-bit-insts,+s-memrealtime,+dot6-insts,+dl-insts,+image-insts,+wavefrontsize64,
-!CHECK-SAME: +gfx9-insts,+gfx8-insts,+ci-insts,+dot10-insts,+dot7-insts,
-!CHECK-SAME: +dot1-insts,+dot5-insts,+mai-insts,+dpp,+dot2-insts">
+!CHECK-SAME: target_features = "+16-bit-insts,+ci-insts,+dl-insts,+dot1-insts,+dot10-insts,
+!CHECK-SAME: +dot2-insts,+dot3-insts,+dot4-insts,+dot5-insts,+dot6-insts,+dot7-insts,+dpp,
+!CHECK-SAME: +gfx8-insts,+gfx9-insts,+image-insts,+mai-insts,+s-memrealtime,+s-memtime-inst,
+!CHECK-SAME: +wavefrontsize64">
 !CHECK-LABEL: func.func @_QPomp_target_simple()
 subroutine omp_target_simple
   ! Directive needed to prevent subroutine from being filtered out when