Check if operand of mul is constant value of one for certain atomic
instructions in order to avoid making unnecessary instructions when
-amdgpu-atomic-optimizer is present.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/test/CodeGen/AMDGPU/atomic_optimizations_mul_one.mir | ||
---|---|---|
1 ↗ | (On Diff #294336) | It's weird to use MIR and -run-pass for an IR pass. Should have regular ll test, with an end to end llc line and an opt line for just the pass |
llvm/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp | ||
---|---|---|
407 | It would be neater to have a BuildMul helper function that checks for and optimizes the mul-by-1 case. |
- Changed test to opt + llc global-isel (SDag was already removing these mul instructions, just later on). Should I split the file into two tests?
llvm/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp | ||
---|---|---|
407 | A new BuildMul or update the current one (looks like some unittests need to be updated in this case)? |
llvm/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp | ||
---|---|---|
407 | I was suggesting a new BuildMul helper function in this source file, not changing IRBuilder at all. |
llvm/test/CodeGen/AMDGPU/GlobalISel/atomic_optimizations_mul_one.ll | ||
---|---|---|
8–11 | These negative checks are extremely fragile. These should use positive checks |
- Updated llc test check lines.
llvm/test/CodeGen/AMDGPU/GlobalISel/atomic_optimizations_mul_one.ll | ||
---|---|---|
8–11 | Just llc or opt check lines as well? |
llvm/test/CodeGen/AMDGPU/GlobalISel/atomic_optimizations_mul_one.ll | ||
---|---|---|
8–11 | Both. Negative checks are just too easy to get wrong |
It would be neater to have a BuildMul helper function that checks for and optimizes the mul-by-1 case.