Skip to content

Commit b8c2781

Browse files
committed
[NFC] format InstructionSimplify & lowerCaseFunctionNames
Clang-format InstructionSimplify and convert all "FunctionName"s to "functionName". This patch does touch a lot of files but gets done with the cleanup of InstructionSimplify in one commit. This is the alternative to the less invasive clang-format only patch: D126783 Reviewed By: spatel, rengolin Differential Revision: https://reviews.llvm.org/D126889
1 parent 7dbfcfa commit b8c2781

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+643
-629
lines changed

llvm/include/llvm/Analysis/InstSimplifyFolder.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,38 +48,38 @@ class InstSimplifyFolder final : public IRBuilderFolder {
4848
//===--------------------------------------------------------------------===//
4949
Value *FoldAdd(Value *LHS, Value *RHS, bool HasNUW = false,
5050
bool HasNSW = false) const override {
51-
return SimplifyAddInst(LHS, RHS, HasNUW, HasNSW, SQ);
51+
return simplifyAddInst(LHS, RHS, HasNUW, HasNSW, SQ);
5252
}
5353

5454
Value *FoldAnd(Value *LHS, Value *RHS) const override {
55-
return SimplifyAndInst(LHS, RHS, SQ);
55+
return simplifyAndInst(LHS, RHS, SQ);
5656
}
5757

5858
Value *FoldOr(Value *LHS, Value *RHS) const override {
59-
return SimplifyOrInst(LHS, RHS, SQ);
59+
return simplifyOrInst(LHS, RHS, SQ);
6060
}
6161

6262
Value *FoldICmp(CmpInst::Predicate P, Value *LHS, Value *RHS) const override {
63-
return SimplifyICmpInst(P, LHS, RHS, SQ);
63+
return simplifyICmpInst(P, LHS, RHS, SQ);
6464
}
6565

6666
Value *FoldGEP(Type *Ty, Value *Ptr, ArrayRef<Value *> IdxList,
6767
bool IsInBounds = false) const override {
68-
return SimplifyGEPInst(Ty, Ptr, IdxList, IsInBounds, SQ);
68+
return simplifyGEPInst(Ty, Ptr, IdxList, IsInBounds, SQ);
6969
}
7070

7171
Value *FoldSelect(Value *C, Value *True, Value *False) const override {
72-
return SimplifySelectInst(C, True, False, SQ);
72+
return simplifySelectInst(C, True, False, SQ);
7373
}
7474

7575
Value *FoldExtractValue(Value *Agg,
7676
ArrayRef<unsigned> IdxList) const override {
77-
return SimplifyExtractValueInst(Agg, IdxList, SQ);
77+
return simplifyExtractValueInst(Agg, IdxList, SQ);
7878
};
7979

8080
Value *FoldInsertValue(Value *Agg, Value *Val,
8181
ArrayRef<unsigned> IdxList) const override {
82-
return SimplifyInsertValueInst(Agg, Val, IdxList, SQ);
82+
return simplifyInsertValueInst(Agg, Val, IdxList, SQ);
8383
}
8484

8585
//===--------------------------------------------------------------------===//

llvm/include/llvm/Analysis/InstructionSimplify.h

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -144,162 +144,162 @@ struct SimplifyQuery {
144144
// Please use the SimplifyQuery versions in new code.
145145

146146
/// Given operand for an FNeg, fold the result or return null.
147-
Value *SimplifyFNegInst(Value *Op, FastMathFlags FMF, const SimplifyQuery &Q);
147+
Value *simplifyFNegInst(Value *Op, FastMathFlags FMF, const SimplifyQuery &Q);
148148

149149
/// Given operands for an Add, fold the result or return null.
150-
Value *SimplifyAddInst(Value *LHS, Value *RHS, bool isNSW, bool isNUW,
150+
Value *simplifyAddInst(Value *LHS, Value *RHS, bool isNSW, bool isNUW,
151151
const SimplifyQuery &Q);
152152

153153
/// Given operands for a Sub, fold the result or return null.
154-
Value *SimplifySubInst(Value *LHS, Value *RHS, bool isNSW, bool isNUW,
154+
Value *simplifySubInst(Value *LHS, Value *RHS, bool isNSW, bool isNUW,
155155
const SimplifyQuery &Q);
156156

157157
/// Given operands for an FAdd, fold the result or return null.
158158
Value *
159-
SimplifyFAddInst(Value *LHS, Value *RHS, FastMathFlags FMF,
159+
simplifyFAddInst(Value *LHS, Value *RHS, FastMathFlags FMF,
160160
const SimplifyQuery &Q,
161161
fp::ExceptionBehavior ExBehavior = fp::ebIgnore,
162162
RoundingMode Rounding = RoundingMode::NearestTiesToEven);
163163

164164
/// Given operands for an FSub, fold the result or return null.
165165
Value *
166-
SimplifyFSubInst(Value *LHS, Value *RHS, FastMathFlags FMF,
166+
simplifyFSubInst(Value *LHS, Value *RHS, FastMathFlags FMF,
167167
const SimplifyQuery &Q,
168168
fp::ExceptionBehavior ExBehavior = fp::ebIgnore,
169169
RoundingMode Rounding = RoundingMode::NearestTiesToEven);
170170

171171
/// Given operands for an FMul, fold the result or return null.
172172
Value *
173-
SimplifyFMulInst(Value *LHS, Value *RHS, FastMathFlags FMF,
173+
simplifyFMulInst(Value *LHS, Value *RHS, FastMathFlags FMF,
174174
const SimplifyQuery &Q,
175175
fp::ExceptionBehavior ExBehavior = fp::ebIgnore,
176176
RoundingMode Rounding = RoundingMode::NearestTiesToEven);
177177

178178
/// Given operands for the multiplication of a FMA, fold the result or return
179-
/// null. In contrast to SimplifyFMulInst, this function will not perform
179+
/// null. In contrast to simplifyFMulInst, this function will not perform
180180
/// simplifications whose unrounded results differ when rounded to the argument
181181
/// type.
182-
Value *SimplifyFMAFMul(Value *LHS, Value *RHS, FastMathFlags FMF,
182+
Value *simplifyFMAFMul(Value *LHS, Value *RHS, FastMathFlags FMF,
183183
const SimplifyQuery &Q,
184184
fp::ExceptionBehavior ExBehavior = fp::ebIgnore,
185185
RoundingMode Rounding = RoundingMode::NearestTiesToEven);
186186

187187
/// Given operands for a Mul, fold the result or return null.
188-
Value *SimplifyMulInst(Value *LHS, Value *RHS, const SimplifyQuery &Q);
188+
Value *simplifyMulInst(Value *LHS, Value *RHS, const SimplifyQuery &Q);
189189

190190
/// Given operands for an SDiv, fold the result or return null.
191-
Value *SimplifySDivInst(Value *LHS, Value *RHS, const SimplifyQuery &Q);
191+
Value *simplifySDivInst(Value *LHS, Value *RHS, const SimplifyQuery &Q);
192192

193193
/// Given operands for a UDiv, fold the result or return null.
194-
Value *SimplifyUDivInst(Value *LHS, Value *RHS, const SimplifyQuery &Q);
194+
Value *simplifyUDivInst(Value *LHS, Value *RHS, const SimplifyQuery &Q);
195195

196196
/// Given operands for an FDiv, fold the result or return null.
197197
Value *
198-
SimplifyFDivInst(Value *LHS, Value *RHS, FastMathFlags FMF,
198+
simplifyFDivInst(Value *LHS, Value *RHS, FastMathFlags FMF,
199199
const SimplifyQuery &Q,
200200
fp::ExceptionBehavior ExBehavior = fp::ebIgnore,
201201
RoundingMode Rounding = RoundingMode::NearestTiesToEven);
202202

203203
/// Given operands for an SRem, fold the result or return null.
204-
Value *SimplifySRemInst(Value *LHS, Value *RHS, const SimplifyQuery &Q);
204+
Value *simplifySRemInst(Value *LHS, Value *RHS, const SimplifyQuery &Q);
205205

206206
/// Given operands for a URem, fold the result or return null.
207-
Value *SimplifyURemInst(Value *LHS, Value *RHS, const SimplifyQuery &Q);
207+
Value *simplifyURemInst(Value *LHS, Value *RHS, const SimplifyQuery &Q);
208208

209209
/// Given operands for an FRem, fold the result or return null.
210210
Value *
211-
SimplifyFRemInst(Value *LHS, Value *RHS, FastMathFlags FMF,
211+
simplifyFRemInst(Value *LHS, Value *RHS, FastMathFlags FMF,
212212
const SimplifyQuery &Q,
213213
fp::ExceptionBehavior ExBehavior = fp::ebIgnore,
214214
RoundingMode Rounding = RoundingMode::NearestTiesToEven);
215215

216216
/// Given operands for a Shl, fold the result or return null.
217-
Value *SimplifyShlInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
217+
Value *simplifyShlInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
218218
const SimplifyQuery &Q);
219219

220220
/// Given operands for a LShr, fold the result or return null.
221-
Value *SimplifyLShrInst(Value *Op0, Value *Op1, bool isExact,
221+
Value *simplifyLShrInst(Value *Op0, Value *Op1, bool isExact,
222222
const SimplifyQuery &Q);
223223

224224
/// Given operands for a AShr, fold the result or return nulll.
225-
Value *SimplifyAShrInst(Value *Op0, Value *Op1, bool isExact,
225+
Value *simplifyAShrInst(Value *Op0, Value *Op1, bool isExact,
226226
const SimplifyQuery &Q);
227227

228228
/// Given operands for an And, fold the result or return null.
229-
Value *SimplifyAndInst(Value *LHS, Value *RHS, const SimplifyQuery &Q);
229+
Value *simplifyAndInst(Value *LHS, Value *RHS, const SimplifyQuery &Q);
230230

231231
/// Given operands for an Or, fold the result or return null.
232-
Value *SimplifyOrInst(Value *LHS, Value *RHS, const SimplifyQuery &Q);
232+
Value *simplifyOrInst(Value *LHS, Value *RHS, const SimplifyQuery &Q);
233233

234234
/// Given operands for an Xor, fold the result or return null.
235-
Value *SimplifyXorInst(Value *LHS, Value *RHS, const SimplifyQuery &Q);
235+
Value *simplifyXorInst(Value *LHS, Value *RHS, const SimplifyQuery &Q);
236236

237237
/// Given operands for an ICmpInst, fold the result or return null.
238-
Value *SimplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS,
238+
Value *simplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS,
239239
const SimplifyQuery &Q);
240240

241241
/// Given operands for an FCmpInst, fold the result or return null.
242-
Value *SimplifyFCmpInst(unsigned Predicate, Value *LHS, Value *RHS,
242+
Value *simplifyFCmpInst(unsigned Predicate, Value *LHS, Value *RHS,
243243
FastMathFlags FMF, const SimplifyQuery &Q);
244244

245245
/// Given operands for a SelectInst, fold the result or return null.
246-
Value *SimplifySelectInst(Value *Cond, Value *TrueVal, Value *FalseVal,
246+
Value *simplifySelectInst(Value *Cond, Value *TrueVal, Value *FalseVal,
247247
const SimplifyQuery &Q);
248248

249249
/// Given operands for a GetElementPtrInst, fold the result or return null.
250-
Value *SimplifyGEPInst(Type *SrcTy, Value *Ptr, ArrayRef<Value *> Indices,
250+
Value *simplifyGEPInst(Type *SrcTy, Value *Ptr, ArrayRef<Value *> Indices,
251251
bool InBounds, const SimplifyQuery &Q);
252252

253253
/// Given operands for an InsertValueInst, fold the result or return null.
254-
Value *SimplifyInsertValueInst(Value *Agg, Value *Val, ArrayRef<unsigned> Idxs,
254+
Value *simplifyInsertValueInst(Value *Agg, Value *Val, ArrayRef<unsigned> Idxs,
255255
const SimplifyQuery &Q);
256256

257257
/// Given operands for an InsertElement, fold the result or return null.
258-
Value *SimplifyInsertElementInst(Value *Vec, Value *Elt, Value *Idx,
258+
Value *simplifyInsertElementInst(Value *Vec, Value *Elt, Value *Idx,
259259
const SimplifyQuery &Q);
260260

261261
/// Given operands for an ExtractValueInst, fold the result or return null.
262-
Value *SimplifyExtractValueInst(Value *Agg, ArrayRef<unsigned> Idxs,
262+
Value *simplifyExtractValueInst(Value *Agg, ArrayRef<unsigned> Idxs,
263263
const SimplifyQuery &Q);
264264

265265
/// Given operands for an ExtractElementInst, fold the result or return null.
266-
Value *SimplifyExtractElementInst(Value *Vec, Value *Idx,
266+
Value *simplifyExtractElementInst(Value *Vec, Value *Idx,
267267
const SimplifyQuery &Q);
268268

269269
/// Given operands for a CastInst, fold the result or return null.
270-
Value *SimplifyCastInst(unsigned CastOpc, Value *Op, Type *Ty,
270+
Value *simplifyCastInst(unsigned CastOpc, Value *Op, Type *Ty,
271271
const SimplifyQuery &Q);
272272

273273
/// Given operands for a ShuffleVectorInst, fold the result or return null.
274274
/// See class ShuffleVectorInst for a description of the mask representation.
275-
Value *SimplifyShuffleVectorInst(Value *Op0, Value *Op1, ArrayRef<int> Mask,
275+
Value *simplifyShuffleVectorInst(Value *Op0, Value *Op1, ArrayRef<int> Mask,
276276
Type *RetTy, const SimplifyQuery &Q);
277277

278278
//=== Helper functions for higher up the class hierarchy.
279279

280280
/// Given operands for a CmpInst, fold the result or return null.
281-
Value *SimplifyCmpInst(unsigned Predicate, Value *LHS, Value *RHS,
281+
Value *simplifyCmpInst(unsigned Predicate, Value *LHS, Value *RHS,
282282
const SimplifyQuery &Q);
283283

284284
/// Given operand for a UnaryOperator, fold the result or return null.
285-
Value *SimplifyUnOp(unsigned Opcode, Value *Op, const SimplifyQuery &Q);
285+
Value *simplifyUnOp(unsigned Opcode, Value *Op, const SimplifyQuery &Q);
286286

287287
/// Given operand for a UnaryOperator, fold the result or return null.
288288
/// Try to use FastMathFlags when folding the result.
289-
Value *SimplifyUnOp(unsigned Opcode, Value *Op, FastMathFlags FMF,
289+
Value *simplifyUnOp(unsigned Opcode, Value *Op, FastMathFlags FMF,
290290
const SimplifyQuery &Q);
291291

292292
/// Given operands for a BinaryOperator, fold the result or return null.
293-
Value *SimplifyBinOp(unsigned Opcode, Value *LHS, Value *RHS,
293+
Value *simplifyBinOp(unsigned Opcode, Value *LHS, Value *RHS,
294294
const SimplifyQuery &Q);
295295

296296
/// Given operands for a BinaryOperator, fold the result or return null.
297297
/// Try to use FastMathFlags when folding the result.
298-
Value *SimplifyBinOp(unsigned Opcode, Value *LHS, Value *RHS, FastMathFlags FMF,
298+
Value *simplifyBinOp(unsigned Opcode, Value *LHS, Value *RHS, FastMathFlags FMF,
299299
const SimplifyQuery &Q);
300300

301301
/// Given a callsite, fold the result or return null.
302-
Value *SimplifyCall(CallBase *Call, const SimplifyQuery &Q);
302+
Value *simplifyCall(CallBase *Call, const SimplifyQuery &Q);
303303

304304
/// Given a constrained FP intrinsic call, tries to compute its simplified
305305
/// version. Returns a simplified result or null.
@@ -308,21 +308,21 @@ Value *SimplifyCall(CallBase *Call, const SimplifyQuery &Q);
308308
/// simplification succeeds that the intrinsic is side effect free. As a result,
309309
/// successful simplification can be used to delete the intrinsic not just
310310
/// replace its result.
311-
Value *SimplifyConstrainedFPCall(CallBase *Call, const SimplifyQuery &Q);
311+
Value *simplifyConstrainedFPCall(CallBase *Call, const SimplifyQuery &Q);
312312

313313
/// Given an operand for a Freeze, see if we can fold the result.
314314
/// If not, this returns null.
315-
Value *SimplifyFreezeInst(Value *Op, const SimplifyQuery &Q);
315+
Value *simplifyFreezeInst(Value *Op, const SimplifyQuery &Q);
316316

317317
/// See if we can compute a simplified version of this instruction. If not,
318318
/// return null.
319-
Value *SimplifyInstruction(Instruction *I, const SimplifyQuery &Q,
319+
Value *simplifyInstruction(Instruction *I, const SimplifyQuery &Q,
320320
OptimizationRemarkEmitter *ORE = nullptr);
321321

322-
/// Like \p SimplifyInstruction but the operands of \p I are replaced with
322+
/// Like \p simplifyInstruction but the operands of \p I are replaced with
323323
/// \p NewOps. Returns a simplified value, or null if none was found.
324324
Value *
325-
SimplifyInstructionWithOperands(Instruction *I, ArrayRef<Value *> NewOps,
325+
simplifyInstructionWithOperands(Instruction *I, ArrayRef<Value *> NewOps,
326326
const SimplifyQuery &Q,
327327
OptimizationRemarkEmitter *ORE = nullptr);
328328

llvm/lib/Analysis/InlineCost.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1984,11 +1984,11 @@ bool CallAnalyzer::visitBinaryOperator(BinaryOperator &I) {
19841984

19851985
Value *SimpleV = nullptr;
19861986
if (auto FI = dyn_cast<FPMathOperator>(&I))
1987-
SimpleV = SimplifyBinOp(I.getOpcode(), CLHS ? CLHS : LHS, CRHS ? CRHS : RHS,
1987+
SimpleV = simplifyBinOp(I.getOpcode(), CLHS ? CLHS : LHS, CRHS ? CRHS : RHS,
19881988
FI->getFastMathFlags(), DL);
19891989
else
19901990
SimpleV =
1991-
SimplifyBinOp(I.getOpcode(), CLHS ? CLHS : LHS, CRHS ? CRHS : RHS, DL);
1991+
simplifyBinOp(I.getOpcode(), CLHS ? CLHS : LHS, CRHS ? CRHS : RHS, DL);
19921992

19931993
if (Constant *C = dyn_cast_or_null<Constant>(SimpleV))
19941994
SimplifiedValues[&I] = C;
@@ -2018,7 +2018,7 @@ bool CallAnalyzer::visitFNeg(UnaryOperator &I) {
20182018
if (!COp)
20192019
COp = SimplifiedValues.lookup(Op);
20202020

2021-
Value *SimpleV = SimplifyFNegInst(
2021+
Value *SimpleV = simplifyFNegInst(
20222022
COp ? COp : Op, cast<FPMathOperator>(I).getFastMathFlags(), DL);
20232023

20242024
if (Constant *C = dyn_cast_or_null<Constant>(SimpleV))

0 commit comments

Comments
 (0)