[llvm] b846f43 - [ConstantFolding] Update failure behavior documentation (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 20 05:51:11 PDT 2023


Author: Nikita Popov
Date: 2023-07-20T14:51:03+02:00
New Revision: b846f439240887f5c6ac24eadded2d41ae8c1bd1

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

LOG: [ConstantFolding] Update failure behavior documentation (NFC)

These functions may return null or a constant expression on failure,
depending on whether such a constant expression is still supported.

Added: 
    

Modified: 
    llvm/include/llvm/Analysis/ConstantFolding.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/ConstantFolding.h b/llvm/include/llvm/Analysis/ConstantFolding.h
index b11981c609ce1f..169a1d0c48e650 100644
--- a/llvm/include/llvm/Analysis/ConstantFolding.h
+++ b/llvm/include/llvm/Analysis/ConstantFolding.h
@@ -68,28 +68,26 @@ Constant *ConstantFoldInstOperands(Instruction *I, ArrayRef<Constant *> Ops,
                                    const TargetLibraryInfo *TLI = nullptr);
 
 /// Attempt to constant fold a compare instruction (icmp/fcmp) with the
-/// specified operands.  If it fails, it returns a constant expression of the
-/// specified operands.
+/// specified operands. Returns null or a constant expression of the specified
+/// operands on failure.
 /// Denormal inputs may be flushed based on the denormal handling mode.
 Constant *ConstantFoldCompareInstOperands(
     unsigned Predicate, Constant *LHS, Constant *RHS, const DataLayout &DL,
     const TargetLibraryInfo *TLI = nullptr, const Instruction *I = nullptr);
 
-/// Attempt to constant fold a unary operation with the specified
-/// operand. If it fails, it returns a constant expression of the specified
-/// operands.
+/// Attempt to constant fold a unary operation with the specified operand.
+/// Returns null on failure.
 Constant *ConstantFoldUnaryOpOperand(unsigned Opcode, Constant *Op,
                                      const DataLayout &DL);
 
-/// Attempt to constant fold a binary operation with the specified
-/// operands.  If it fails, it returns a constant expression of the specified
-/// operands.
+/// Attempt to constant fold a binary operation with the specified operands.
+/// Returns null or a constant expression of the specified operands on failure.
 Constant *ConstantFoldBinaryOpOperands(unsigned Opcode, Constant *LHS,
                                        Constant *RHS, const DataLayout &DL);
 
 /// Attempt to constant fold a floating point binary operation with the
-/// specified operands, applying the denormal handling mod to the operands.  If
-/// it fails, it returns a constant expression of the specified operands.
+/// specified operands, applying the denormal handling mod to the operands.
+/// Returns null or a constant expression of the specified operands on failure.
 Constant *ConstantFoldFPInstOperands(unsigned Opcode, Constant *LHS,
                                      Constant *RHS, const DataLayout &DL,
                                      const Instruction *I);


        


More information about the llvm-commits mailing list