[llvm] 804467d - Use isNegative (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 15 14:26:30 PDT 2023


Author: Kazu Hirata
Date: 2023-04-15T14:26:24-07:00
New Revision: 804467de94b7506e2b67cab2e36e82858f02e1cc

URL: https://github.com/llvm/llvm-project/commit/804467de94b7506e2b67cab2e36e82858f02e1cc
DIFF: https://github.com/llvm/llvm-project/commit/804467de94b7506e2b67cab2e36e82858f02e1cc.diff

LOG: Use isNegative (NFC)

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/BasicTTIImpl.h
    llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
    mlir/lib/Dialect/Affine/IR/AffineOps.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
index e8c28fa5eb3ee..fdb6109882e08 100644
--- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -1514,7 +1514,7 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
           InstructionCost Cost = (ActiveBits + PopCount - 2) *
                                  thisT()->getArithmeticInstrCost(
                                      Instruction::FMul, RetTy, CostKind);
-          if (RHSC->getSExtValue() < 0)
+          if (RHSC->isNegative())
             Cost += thisT()->getArithmeticInstrCost(Instruction::FDiv, RetTy,
                                                     CostKind);
           return Cost;

diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index fbbd6465f3285..28bb85942d686 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -1305,7 +1305,7 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
   // not a multiple of element size then behavior is undefined.
   if (auto *AMI = dyn_cast<AtomicMemIntrinsic>(II))
     if (ConstantInt *NumBytes = dyn_cast<ConstantInt>(AMI->getLength()))
-      if (NumBytes->getSExtValue() < 0 ||
+      if (NumBytes->isNegative() ||
           (NumBytes->getZExtValue() % AMI->getElementSizeInBytes() != 0)) {
         CreateNonTerminatorUnreachable(AMI);
         assert(AMI->getType()->isVoidTy() &&

diff  --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
index e5c88caefdf5b..90a42eced78f5 100644
--- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
+++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
@@ -2026,7 +2026,7 @@ ParseResult AffineForOp::parse(OpAsmParser &parser, OperationState &result) {
                               result.attributes))
       return failure();
 
-    if (stepAttr.getValue().getSExtValue() < 0)
+    if (stepAttr.getValue().isNegative())
       return parser.emitError(
           stepLoc,
           "expected step to be representable as a positive signed integer");


        


More information about the llvm-commits mailing list