[llvm] LoopIdiomRecognize: strip bad TODO (NFC) (PR #92890)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Tue May 21 03:07:38 PDT 2024


https://github.com/artagnon created https://github.com/llvm/llvm-project/pull/92890

There are several reasons why handling powi in LoopIdiomRecognize is a bad idea:

- powi corresponds to a GCC builtin that is only defined for C int (which is i32 for most targets).
- powi isn't always lowered by targets correctly for non-i32 parameters. Several targets fail to compile llvm.powi.f32.i16, for example.
- Unlike memcpy and memset, which tend to be important enough internal intrinsics that you have to handle them correctly even in freestanding modes, powi isn't.

Strip this bad TODO to avoid misleading contributors.

>From fab34e5e2d33a88b8e75338e732f7039171a82e4 Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <r at artagnon.com>
Date: Tue, 21 May 2024 11:00:57 +0100
Subject: [PATCH] LoopIdiomRecognize: strip bad TODO (NFC)

There are several reasons why handling powi in LoopIdiomRecognize is a
bad idea:

- powi corresponds to a GCC builtin that is only defined for C int
  (which is i32 for most targets).
- powi isn't always lowered by targets correctly for non-i32 parameters.
  Several targets fail to compile llvm.powi.f32.i16, for example.
- Unlike memcpy and memset, which tend to be important enough internal
  intrinsics that you have to handle them correctly even in freestanding
  modes, powi isn't.

Strip this bad TODO to avoid misleading contributors.
---
 llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
index c7e25c9f3d2c9..3fe5478408d45 100644
--- a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
@@ -22,8 +22,6 @@
 //
 // Future loop memory idioms to recognize:
 //   memcmp, strlen, etc.
-// Future floating point idioms to recognize in -ffast-math mode:
-//   fpowi
 //
 // This could recognize common matrix multiplies and dot product idioms and
 // replace them with calls to BLAS (if linked in??).
@@ -1107,7 +1105,7 @@ bool LoopIdiomRecognize::processLoopStridedStore(
     GV->setAlignment(Align(16));
     Value *PatternPtr = GV;
     NewCall = Builder.CreateCall(MSP, {BasePtr, PatternPtr, NumBytes});
-    
+
     // Set the TBAA info if present.
     if (AATags.TBAA)
       NewCall->setMetadata(LLVMContext::MD_tbaa, AATags.TBAA);
@@ -1117,7 +1115,7 @@ bool LoopIdiomRecognize::processLoopStridedStore(
 
     if (AATags.NoAlias)
       NewCall->setMetadata(LLVMContext::MD_noalias, AATags.NoAlias);
-  } 
+  }
 
   NewCall->setDebugLoc(TheStore->getDebugLoc());
 



More information about the llvm-commits mailing list