Skip to content

Commit 6cdf104

Browse files
kazutakahiratackoparkar
authored andcommitted
[IR, Analysis] Remove redundant declarations (NFC) (llvm#166023)
These ConstantFold* functions are declared in both: - llvm/include/llvm/Analysis/ConstantFolding.h - llvm/include/llvm/IR/ConstantFold.h However, the implementation resides in llvm/lib/IR/ConstantFold.cpp. This patch removes the declarations in Analysis/ConstantFolding.h and moves associated comments to IR/ConstantFold.h.
1 parent bd2a8cb commit 6cdf104

File tree

3 files changed

+26
-40
lines changed

3 files changed

+26
-40
lines changed

llvm/include/llvm/Analysis/ConstantFolding.h

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,6 @@ ConstantFoldFPInstOperands(unsigned Opcode, Constant *LHS, Constant *RHS,
119119
LLVM_ABI Constant *FlushFPConstant(Constant *Operand, const Instruction *I,
120120
bool IsOutput);
121121

122-
/// Attempt to constant fold a select instruction with the specified
123-
/// operands. The constant result is returned if successful; if not, null is
124-
/// returned.
125-
LLVM_ABI Constant *ConstantFoldSelectInstruction(Constant *Cond, Constant *V1,
126-
Constant *V2);
127-
128122
/// Attempt to constant fold a cast with the specified operand. If it
129123
/// fails, it returns a constant expression of the specified operand.
130124
LLVM_ABI Constant *ConstantFoldCastOperand(unsigned Opcode, Constant *C,
@@ -135,40 +129,6 @@ LLVM_ABI Constant *ConstantFoldCastOperand(unsigned Opcode, Constant *C,
135129
LLVM_ABI Constant *ConstantFoldIntegerCast(Constant *C, Type *DestTy,
136130
bool IsSigned, const DataLayout &DL);
137131

138-
/// ConstantFoldInsertValueInstruction - Attempt to constant fold an insertvalue
139-
/// instruction with the specified operands and indices. The constant result is
140-
/// returned if successful; if not, null is returned.
141-
LLVM_ABI Constant *ConstantFoldInsertValueInstruction(Constant *Agg,
142-
Constant *Val,
143-
ArrayRef<unsigned> Idxs);
144-
145-
/// Attempt to constant fold an extractvalue instruction with the
146-
/// specified operands and indices. The constant result is returned if
147-
/// successful; if not, null is returned.
148-
LLVM_ABI Constant *ConstantFoldExtractValueInstruction(Constant *Agg,
149-
ArrayRef<unsigned> Idxs);
150-
151-
/// Attempt to constant fold an insertelement instruction with the
152-
/// specified operands and indices. The constant result is returned if
153-
/// successful; if not, null is returned.
154-
LLVM_ABI Constant *ConstantFoldInsertElementInstruction(Constant *Val,
155-
Constant *Elt,
156-
Constant *Idx);
157-
158-
/// Attempt to constant fold an extractelement instruction with the
159-
/// specified operands and indices. The constant result is returned if
160-
/// successful; if not, null is returned.
161-
LLVM_ABI Constant *ConstantFoldExtractElementInstruction(Constant *Val,
162-
Constant *Idx);
163-
164-
/// Attempt to constant fold a shufflevector instruction with the
165-
/// specified operands and mask. See class ShuffleVectorInst for a description
166-
/// of the mask representation. The constant result is returned if successful;
167-
/// if not, null is returned.
168-
LLVM_ABI Constant *ConstantFoldShuffleVectorInstruction(Constant *V1,
169-
Constant *V2,
170-
ArrayRef<int> Mask);
171-
172132
/// Extract value of C at the given Offset reinterpreted as Ty. If bits past
173133
/// the end of C are accessed, they are assumed to be poison.
174134
LLVM_ABI Constant *ConstantFoldLoadFromConst(Constant *C, Type *Ty,

llvm/include/llvm/Analysis/TargetFolder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#include "llvm/ADT/ArrayRef.h"
2222
#include "llvm/Analysis/ConstantFolding.h"
23+
#include "llvm/IR/ConstantFold.h"
2324
#include "llvm/IR/Constants.h"
2425
#include "llvm/IR/IRBuilderFolder.h"
2526
#include "llvm/IR/Operator.h"

llvm/include/llvm/IR/ConstantFold.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,43 @@ ConstantFoldCastInstruction(unsigned opcode, ///< The opcode of the cast
3737
Constant *V, ///< The source constant
3838
Type *DestTy ///< The destination type
3939
);
40+
41+
/// Attempt to constant fold a select instruction with the specified
42+
/// operands. The constant result is returned if successful; if not, null is
43+
/// returned.
4044
LLVM_ABI Constant *ConstantFoldSelectInstruction(Constant *Cond, Constant *V1,
4145
Constant *V2);
46+
47+
/// Attempt to constant fold an extractelement instruction with the
48+
/// specified operands and indices. The constant result is returned if
49+
/// successful; if not, null is returned.
4250
LLVM_ABI Constant *ConstantFoldExtractElementInstruction(Constant *Val,
4351
Constant *Idx);
52+
53+
/// Attempt to constant fold an insertelement instruction with the
54+
/// specified operands and indices. The constant result is returned if
55+
/// successful; if not, null is returned.
4456
LLVM_ABI Constant *ConstantFoldInsertElementInstruction(Constant *Val,
4557
Constant *Elt,
4658
Constant *Idx);
59+
60+
/// Attempt to constant fold a shufflevector instruction with the
61+
/// specified operands and mask. See class ShuffleVectorInst for a description
62+
/// of the mask representation. The constant result is returned if successful;
63+
/// if not, null is returned.
4764
LLVM_ABI Constant *ConstantFoldShuffleVectorInstruction(Constant *V1,
4865
Constant *V2,
4966
ArrayRef<int> Mask);
67+
68+
/// Attempt to constant fold an extractvalue instruction with the
69+
/// specified operands and indices. The constant result is returned if
70+
/// successful; if not, null is returned.
5071
LLVM_ABI Constant *ConstantFoldExtractValueInstruction(Constant *Agg,
5172
ArrayRef<unsigned> Idxs);
73+
74+
/// Attempt to constant fold an insertvalue instruction with the specified
75+
/// operands and indices. The constant result is returned if successful; if
76+
/// not, null is returned.
5277
LLVM_ABI Constant *ConstantFoldInsertValueInstruction(Constant *Agg,
5378
Constant *Val,
5479
ArrayRef<unsigned> Idxs);

0 commit comments

Comments
 (0)