From a926b3e71b6aad25a53713cf85a0ee3c8583d2af Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Fri, 29 Jul 2016 03:27:33 +0000 Subject: [PATCH] [ConstantFolding] Remove an unused ConstantFoldInstOperands overload No functional change is intended. llvm-svn: 277101 --- llvm/include/llvm/Analysis/ConstantFolding.h | 13 ------------- llvm/lib/Analysis/ConstantFolding.cpp | 19 +++++-------------- 2 files changed, 5 insertions(+), 27 deletions(-) diff --git a/llvm/include/llvm/Analysis/ConstantFolding.h b/llvm/include/llvm/Analysis/ConstantFolding.h index 9f93d6efd621..2aa388714c6e 100644 --- a/llvm/include/llvm/Analysis/ConstantFolding.h +++ b/llvm/include/llvm/Analysis/ConstantFolding.h @@ -63,19 +63,6 @@ Constant *ConstantFoldInstOperands(Instruction *I, ArrayRef Ops, const DataLayout &DL, const TargetLibraryInfo *TLI = nullptr); -/// ConstantFoldInstOperands - Attempt to constant fold an instruction with the -/// specified operands. If successful, the constant result is returned, if not, -/// null is returned. Note that this function can fail when attempting to -/// fold instructions like loads and stores, which have no constant expression -/// form. -/// -/// This function doesn't work for compares (use ConstantFoldCompareInstOperands -/// for this) and GEPs. -Constant *ConstantFoldInstOperands(unsigned Opcode, Type *DestTy, - ArrayRef Ops, - const DataLayout &DL, - const TargetLibraryInfo *TLI = nullptr); - /// ConstantFoldCompareInstOperands - 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. diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index c7f656a09dbc..010f5d62f06f 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -918,11 +918,12 @@ Constant *SymbolicallyEvaluateGEP(const GEPOperator *GEP, /// information, due to only being passed an opcode and operands. Constant /// folding using this function strips this information. /// -Constant *ConstantFoldInstOperandsImpl(const Value *InstOrCE, Type *DestTy, - unsigned Opcode, +Constant *ConstantFoldInstOperandsImpl(const Value *InstOrCE, unsigned Opcode, ArrayRef Ops, const DataLayout &DL, const TargetLibraryInfo *TLI) { + Type *DestTy = InstOrCE->getType(); + // Handle easy binops first. if (Instruction::isBinaryOp(Opcode)) return ConstantFoldBinaryOpOperands(Opcode, Ops[0], Ops[1], DL); @@ -1003,8 +1004,7 @@ ConstantFoldConstantImpl(const Constant *C, const DataLayout &DL, return ConstantFoldCompareInstOperands(CE->getPredicate(), Ops[0], Ops[1], DL, TLI); - return ConstantFoldInstOperandsImpl(CE, CE->getType(), CE->getOpcode(), Ops, - DL, TLI); + return ConstantFoldInstOperandsImpl(CE, CE->getOpcode(), Ops, DL, TLI); } assert(isa(C)); @@ -1094,16 +1094,7 @@ Constant *llvm::ConstantFoldInstOperands(Instruction *I, ArrayRef Ops, const DataLayout &DL, const TargetLibraryInfo *TLI) { - return ConstantFoldInstOperandsImpl(I, I->getType(), I->getOpcode(), Ops, DL, - TLI); -} - -Constant *llvm::ConstantFoldInstOperands(unsigned Opcode, Type *DestTy, - ArrayRef Ops, - const DataLayout &DL, - const TargetLibraryInfo *TLI) { - assert(Opcode != Instruction::GetElementPtr && "Invalid for GEPs"); - return ConstantFoldInstOperandsImpl(nullptr, DestTy, Opcode, Ops, DL, TLI); + return ConstantFoldInstOperandsImpl(I, I->getOpcode(), Ops, DL, TLI); } Constant *llvm::ConstantFoldCompareInstOperands(unsigned Predicate,