nir: Use reorderable access flag
authorConnor Abbott <cwabbott0@gmail.com>
Tue, 4 Jun 2019 12:12:34 +0000 (14:12 +0200)
committerConnor Abbott <cwabbott0@gmail.com>
Wed, 19 Jun 2019 12:08:28 +0000 (14:08 +0200)
No changes with radeonsi shader-db.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/compiler/nir/nir.h

index bbe3fed70ddf185ed3fcf56ae7129c8b7949e681..203601cee2c6f99b4061b8af8fb5b1dd64e1497d 100644 (file)
@@ -1459,10 +1459,18 @@ void nir_rewrite_image_intrinsic(nir_intrinsic_instr *instr,
 static inline bool
 nir_intrinsic_can_reorder(nir_intrinsic_instr *instr)
 {
-   const nir_intrinsic_info *info =
-      &nir_intrinsic_infos[instr->intrinsic];
-   return (info->flags & NIR_INTRINSIC_CAN_ELIMINATE) &&
-          (info->flags & NIR_INTRINSIC_CAN_REORDER);
+   if (instr->intrinsic == nir_intrinsic_load_deref ||
+       instr->intrinsic == nir_intrinsic_load_ssbo ||
+       instr->intrinsic == nir_intrinsic_bindless_image_load ||
+       instr->intrinsic == nir_intrinsic_image_deref_load ||
+       instr->intrinsic == nir_intrinsic_image_load) {
+      return nir_intrinsic_access(instr) & ACCESS_CAN_REORDER;
+   } else {
+      const nir_intrinsic_info *info =
+         &nir_intrinsic_infos[instr->intrinsic];
+      return (info->flags & NIR_INTRINSIC_CAN_ELIMINATE) &&
+             (info->flags & NIR_INTRINSIC_CAN_REORDER);
+   }
 }
 
 /**