Skip to content

Commit b1ff6d1

Browse files
committed
[GVN][NFC] Match coding standards
As per LLVM coding standards "Variable names should be nouns (as they represent state). The name should be camel case, and start with an upper case letter (e.g. Leader or Boats)."
1 parent 06f3079 commit b1ff6d1

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

llvm/lib/Transforms/Scalar/GVN.cpp

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -332,98 +332,98 @@ struct llvm::gvn::AvailableValueInBlock {
332332
//===----------------------------------------------------------------------===//
333333

334334
GVNPass::Expression GVNPass::ValueTable::createExpr(Instruction *I) {
335-
Expression e;
336-
e.type = I->getType();
337-
e.opcode = I->getOpcode();
335+
Expression E;
336+
E.type = I->getType();
337+
E.opcode = I->getOpcode();
338338
if (const GCRelocateInst *GCR = dyn_cast<GCRelocateInst>(I)) {
339339
// gc.relocate is 'special' call: its second and third operands are
340340
// not real values, but indices into statepoint's argument list.
341341
// Use the refered to values for purposes of identity.
342-
e.varargs.push_back(lookupOrAdd(GCR->getOperand(0)));
343-
e.varargs.push_back(lookupOrAdd(GCR->getBasePtr()));
344-
e.varargs.push_back(lookupOrAdd(GCR->getDerivedPtr()));
342+
E.varargs.push_back(lookupOrAdd(GCR->getOperand(0)));
343+
E.varargs.push_back(lookupOrAdd(GCR->getBasePtr()));
344+
E.varargs.push_back(lookupOrAdd(GCR->getDerivedPtr()));
345345
} else {
346346
for (Use &Op : I->operands())
347-
e.varargs.push_back(lookupOrAdd(Op));
347+
E.varargs.push_back(lookupOrAdd(Op));
348348
}
349349
if (I->isCommutative()) {
350350
// Ensure that commutative instructions that only differ by a permutation
351351
// of their operands get the same value number by sorting the operand value
352352
// numbers. Since commutative operands are the 1st two operands it is more
353353
// efficient to sort by hand rather than using, say, std::sort.
354354
assert(I->getNumOperands() >= 2 && "Unsupported commutative instruction!");
355-
if (e.varargs[0] > e.varargs[1])
356-
std::swap(e.varargs[0], e.varargs[1]);
357-
e.commutative = true;
355+
if (E.varargs[0] > E.varargs[1])
356+
std::swap(E.varargs[0], E.varargs[1]);
357+
E.commutative = true;
358358
}
359359

360360
if (auto *C = dyn_cast<CmpInst>(I)) {
361361
// Sort the operand value numbers so x<y and y>x get the same value number.
362362
CmpInst::Predicate Predicate = C->getPredicate();
363-
if (e.varargs[0] > e.varargs[1]) {
364-
std::swap(e.varargs[0], e.varargs[1]);
363+
if (E.varargs[0] > E.varargs[1]) {
364+
std::swap(E.varargs[0], E.varargs[1]);
365365
Predicate = CmpInst::getSwappedPredicate(Predicate);
366366
}
367-
e.opcode = (C->getOpcode() << 8) | Predicate;
368-
e.commutative = true;
369-
} else if (auto *E = dyn_cast<InsertValueInst>(I)) {
370-
e.varargs.append(E->idx_begin(), E->idx_end());
367+
E.opcode = (C->getOpcode() << 8) | Predicate;
368+
E.commutative = true;
369+
} else if (auto *IVI = dyn_cast<InsertValueInst>(I)) {
370+
E.varargs.append(IVI->idx_begin(), IVI->idx_end());
371371
} else if (auto *SVI = dyn_cast<ShuffleVectorInst>(I)) {
372372
ArrayRef<int> ShuffleMask = SVI->getShuffleMask();
373-
e.varargs.append(ShuffleMask.begin(), ShuffleMask.end());
373+
E.varargs.append(ShuffleMask.begin(), ShuffleMask.end());
374374
} else if (auto *CB = dyn_cast<CallBase>(I)) {
375-
e.attrs = CB->getAttributes();
375+
E.attrs = CB->getAttributes();
376376
}
377377

378-
return e;
378+
return E;
379379
}
380380

381381
GVNPass::Expression GVNPass::ValueTable::createCmpExpr(
382382
unsigned Opcode, CmpInst::Predicate Predicate, Value *LHS, Value *RHS) {
383383
assert((Opcode == Instruction::ICmp || Opcode == Instruction::FCmp) &&
384384
"Not a comparison!");
385-
Expression e;
386-
e.type = CmpInst::makeCmpResultType(LHS->getType());
387-
e.varargs.push_back(lookupOrAdd(LHS));
388-
e.varargs.push_back(lookupOrAdd(RHS));
385+
Expression E;
386+
E.type = CmpInst::makeCmpResultType(LHS->getType());
387+
E.varargs.push_back(lookupOrAdd(LHS));
388+
E.varargs.push_back(lookupOrAdd(RHS));
389389

390390
// Sort the operand value numbers so x<y and y>x get the same value number.
391-
if (e.varargs[0] > e.varargs[1]) {
392-
std::swap(e.varargs[0], e.varargs[1]);
391+
if (E.varargs[0] > E.varargs[1]) {
392+
std::swap(E.varargs[0], E.varargs[1]);
393393
Predicate = CmpInst::getSwappedPredicate(Predicate);
394394
}
395-
e.opcode = (Opcode << 8) | Predicate;
396-
e.commutative = true;
397-
return e;
395+
E.opcode = (Opcode << 8) | Predicate;
396+
E.commutative = true;
397+
return E;
398398
}
399399

400400
GVNPass::Expression
401401
GVNPass::ValueTable::createExtractvalueExpr(ExtractValueInst *EI) {
402402
assert(EI && "Not an ExtractValueInst?");
403-
Expression e;
404-
e.type = EI->getType();
405-
e.opcode = 0;
403+
Expression E;
404+
E.type = EI->getType();
405+
E.opcode = 0;
406406

407407
WithOverflowInst *WO = dyn_cast<WithOverflowInst>(EI->getAggregateOperand());
408408
if (WO != nullptr && EI->getNumIndices() == 1 && *EI->idx_begin() == 0) {
409409
// EI is an extract from one of our with.overflow intrinsics. Synthesize
410410
// a semantically equivalent expression instead of an extract value
411411
// expression.
412-
e.opcode = WO->getBinaryOp();
413-
e.varargs.push_back(lookupOrAdd(WO->getLHS()));
414-
e.varargs.push_back(lookupOrAdd(WO->getRHS()));
415-
return e;
412+
E.opcode = WO->getBinaryOp();
413+
E.varargs.push_back(lookupOrAdd(WO->getLHS()));
414+
E.varargs.push_back(lookupOrAdd(WO->getRHS()));
415+
return E;
416416
}
417417

418418
// Not a recognised intrinsic. Fall back to producing an extract value
419419
// expression.
420-
e.opcode = EI->getOpcode();
420+
E.opcode = EI->getOpcode();
421421
for (Use &Op : EI->operands())
422-
e.varargs.push_back(lookupOrAdd(Op));
422+
E.varargs.push_back(lookupOrAdd(Op));
423423

424-
append_range(e.varargs, EI->indices());
424+
append_range(E.varargs, EI->indices());
425425

426-
return e;
426+
return E;
427427
}
428428

429429
GVNPass::Expression GVNPass::ValueTable::createGEPExpr(GetElementPtrInst *GEP) {

0 commit comments

Comments
 (0)