[ConstantFolding] Update failure behavior documentation (NFC)
authorNikita Popov <npopov@redhat.com>
Thu, 20 Jul 2023 12:47:50 +0000 (14:47 +0200)
committerNikita Popov <npopov@redhat.com>
Thu, 20 Jul 2023 12:51:03 +0000 (14:51 +0200)
These functions may return null or a constant expression on failure,
depending on whether such a constant expression is still supported.

llvm/include/llvm/Analysis/ConstantFolding.h

index b11981c..169a1d0 100644 (file)
@@ -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);