[PATCH] D157495: [WIP] Run SimplifyCFG from Atomic-Expand on CAS loop blocks.
Pravin Jagtap via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 14 01:28:04 PDT 2023
pravinjagtap added inline comments.
================
Comment at: llvm/test/Transforms/AtomicExpand/AMDGPU/expand-atomic-simplify-cfg-CAS-block.ll:24
+; GFX90A-NEXT: [[TMP4]] = bitcast i32 [[NEWLOADED]] to float
+; GFX90A-NEXT: br i1 [[SUCCESS]], label [[ENDIF:%.*]], label [[ATOMICRMW_START]]
+; GFX90A: else:
----------------
pravinjagtap wrote:
> Here, we can observe the potential benefits of running simplify CFG. It simplifies the branching.
Without this it would have been:
```
; GFX90A: atomicrmw.start:
; GFX90A-NEXT: [[LOADED:%.*]] = phi float [ [[TMP0]], [[IF]] ], [ [[TMP4:%.*]], [[ATOMICRMW_START]] ]
; GFX90A-NEXT: [[NEW:%.*]] = fadd float [[LOADED]], [[IN:%.*]]
; GFX90A-NEXT: [[TMP1:%.*]] = bitcast float [[NEW]] to i32
; GFX90A-NEXT: [[TMP2:%.*]] = bitcast float [[LOADED]] to i32
; GFX90A-NEXT: [[TMP3:%.*]] = cmpxchg ptr addrspace(1) [[OUT]], i32 [[TMP2]], i32 [[TMP1]] seq_cst seq_cst, align 4
; GFX90A-NEXT: [[SUCCESS:%.*]] = extractvalue { i32, i1 } [[TMP3]], 1
; GFX90A-NEXT: [[NEWLOADED:%.*]] = extractvalue { i32, i1 } [[TMP3]], 0
; GFX90A-NEXT: [[TMP4]] = bitcast i32 [[NEWLOADED]] to float
; GFX90A-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]]
; GFX90A: atomicrmw.end:
; GFX90A-NEXT: br label [[ENDIF:%.*]]
; GFX90A: else:
; GFX90A-NEXT: [[TMP5:%.*]] = load float, ptr addrspace(1) [[OUT]], align 4
; GFX90A-NEXT: br label [[ATOMICRMW_START2:%.*]]
; GFX90A: atomicrmw.start2:
````
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157495/new/
https://reviews.llvm.org/D157495
More information about the llvm-commits
mailing list