[llvm] 0af53fc - [SROA] Don't create constant expressions (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 29 02:53:00 PDT 2022


Author: Nikita Popov
Date: 2022-06-29T11:51:22+02:00
New Revision: 0af53fcb99edb4c90ef42f1d173e382029ca96ee

URL: https://github.com/llvm/llvm-project/commit/0af53fcb99edb4c90ef42f1d173e382029ca96ee
DIFF: https://github.com/llvm/llvm-project/commit/0af53fcb99edb4c90ef42f1d173e382029ca96ee.diff

LOG: [SROA] Don't create constant expressions (NFC)

Use IRBuilder instead, which will fold these. Just to clarify
that this does not actually create any udiv expression.

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/SROA.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp
index c28333e7c12a7..143a035749c75 100644
--- a/llvm/lib/Transforms/Scalar/SROA.cpp
+++ b/llvm/lib/Transforms/Scalar/SROA.cpp
@@ -2733,10 +2733,9 @@ class llvm::sroa::AllocaSliceRewriter
     Type *SplatIntTy = Type::getIntNTy(VTy->getContext(), Size * 8);
     V = IRB.CreateMul(
         IRB.CreateZExt(V, SplatIntTy, "zext"),
-        ConstantExpr::getUDiv(
-            Constant::getAllOnesValue(SplatIntTy),
-            ConstantExpr::getZExt(Constant::getAllOnesValue(V->getType()),
-                                  SplatIntTy)),
+        IRB.CreateUDiv(Constant::getAllOnesValue(SplatIntTy),
+                       IRB.CreateZExt(Constant::getAllOnesValue(V->getType()),
+                                      SplatIntTy)),
         "isplat");
     return V;
   }


        


More information about the llvm-commits mailing list