[llvm] [AMDGPU] Use reverse iteration in CodeGenPrepare (PR #145484)

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 29 02:46:04 PDT 2025


================
@@ -2030,18 +2019,6 @@ bool AMDGPUCodeGenPrepareImpl::visitSqrt(IntrinsicInst &Sqrt) {
   if (ReqdAccuracy < 1.0f)
     return false;
 
-  // FIXME: This is an ugly hack for this pass using forward iteration instead
----------------
Pierre-vh wrote:

@arsenm Is this the right way to fix this hack ?
There are code changes in `amdgpu-codegenprepare-fdiv` that I can't explain. They're due to switching to reverse iteration, but I'm not sure why the sqrt is scalarized now when it wasn't before. Is it expected?
Re-adding this doesn't change anything in that test btw, it only changes `fdiv_flags.f32.ll`.

https://github.com/llvm/llvm-project/pull/145484


More information about the llvm-commits mailing list