Module: Mesa
Branch: staging/21.3
Commit: 24c0a1ba66ca5ff4694fcfd6b4ec06f46af1d539
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=24c0a1ba66ca5ff4694fcfd6b4ec06f46af1d539

Author: Emma Anholt <[email protected]>
Date:   Mon Dec  6 16:43:45 2021 -0800

r300: Also consider ALU condition modifiers for loop DCE.

Since we typically use an ALU op to set the condition modifier for the
IF-BRK-ENDIF, we were particularly likely to remove the increment of the
loop counter!

Cc: mesa-stable
Reviewed-by: Marek Olšák <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14117>
(cherry picked from commit 26b3e2f7cd71bdc58dfddb235ae13b0a3c558495)

---

 .pick_status.json                                            | 2 +-
 src/gallium/drivers/r300/compiler/radeon_dataflow_deadcode.c | 9 +++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 205289eaf23..96a78ff5a1b 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -3991,7 +3991,7 @@
         "description": "r300: Also consider ALU condition modifiers for loop 
DCE.",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/drivers/r300/compiler/radeon_dataflow_deadcode.c 
b/src/gallium/drivers/r300/compiler/radeon_dataflow_deadcode.c
index 678e1475883..708e3e96d97 100644
--- a/src/gallium/drivers/r300/compiler/radeon_dataflow_deadcode.c
+++ b/src/gallium/drivers/r300/compiler/radeon_dataflow_deadcode.c
@@ -253,8 +253,13 @@ void rc_dataflow_deadcode(struct radeon_compiler * c, void 
*user)
                                if(opcode->HasDstReg){
                                        int src = 0;
                                        unsigned int srcmasks[3];
-                                       rc_compute_sources_for_writemask(ptr,
-                                               ptr->U.I.DstReg.WriteMask, 
srcmasks);
+                                       unsigned int writemask = 
ptr->U.I.DstReg.WriteMask;
+                                       if (ptr->U.I.WriteALUResult == 
RC_ALURESULT_X)
+                                               writemask |= RC_MASK_X;
+                                       else if (ptr->U.I.WriteALUResult == 
RC_ALURESULT_W)
+                                               writemask |= RC_MASK_W;
+
+                                       rc_compute_sources_for_writemask(ptr, 
writemask, srcmasks);
                                        for(src=0; src < opcode->NumSrcRegs; 
src++){
                                                mark_used(&s,
                                                        
ptr->U.I.SrcReg[src].File,

Reply via email to