@@ -332,98 +332,98 @@ struct llvm::gvn::AvailableValueInBlock {
332
332
// ===----------------------------------------------------------------------===//
333
333
334
334
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 ();
338
338
if (const GCRelocateInst *GCR = dyn_cast<GCRelocateInst>(I)) {
339
339
// gc.relocate is 'special' call: its second and third operands are
340
340
// not real values, but indices into statepoint's argument list.
341
341
// 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 ()));
345
345
} else {
346
346
for (Use &Op : I->operands ())
347
- e .varargs .push_back (lookupOrAdd (Op));
347
+ E .varargs .push_back (lookupOrAdd (Op));
348
348
}
349
349
if (I->isCommutative ()) {
350
350
// Ensure that commutative instructions that only differ by a permutation
351
351
// of their operands get the same value number by sorting the operand value
352
352
// numbers. Since commutative operands are the 1st two operands it is more
353
353
// efficient to sort by hand rather than using, say, std::sort.
354
354
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 ;
358
358
}
359
359
360
360
if (auto *C = dyn_cast<CmpInst>(I)) {
361
361
// Sort the operand value numbers so x<y and y>x get the same value number.
362
362
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 ]);
365
365
Predicate = CmpInst::getSwappedPredicate (Predicate);
366
366
}
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 ());
371
371
} else if (auto *SVI = dyn_cast<ShuffleVectorInst>(I)) {
372
372
ArrayRef<int > ShuffleMask = SVI->getShuffleMask ();
373
- e .varargs .append (ShuffleMask.begin (), ShuffleMask.end ());
373
+ E .varargs .append (ShuffleMask.begin (), ShuffleMask.end ());
374
374
} else if (auto *CB = dyn_cast<CallBase>(I)) {
375
- e .attrs = CB->getAttributes ();
375
+ E .attrs = CB->getAttributes ();
376
376
}
377
377
378
- return e ;
378
+ return E ;
379
379
}
380
380
381
381
GVNPass::Expression GVNPass::ValueTable::createCmpExpr (
382
382
unsigned Opcode, CmpInst::Predicate Predicate, Value *LHS, Value *RHS) {
383
383
assert ((Opcode == Instruction::ICmp || Opcode == Instruction::FCmp) &&
384
384
" 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));
389
389
390
390
// 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 ]);
393
393
Predicate = CmpInst::getSwappedPredicate (Predicate);
394
394
}
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 ;
398
398
}
399
399
400
400
GVNPass::Expression
401
401
GVNPass::ValueTable::createExtractvalueExpr (ExtractValueInst *EI) {
402
402
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 ;
406
406
407
407
WithOverflowInst *WO = dyn_cast<WithOverflowInst>(EI->getAggregateOperand ());
408
408
if (WO != nullptr && EI->getNumIndices () == 1 && *EI->idx_begin () == 0 ) {
409
409
// EI is an extract from one of our with.overflow intrinsics. Synthesize
410
410
// a semantically equivalent expression instead of an extract value
411
411
// 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 ;
416
416
}
417
417
418
418
// Not a recognised intrinsic. Fall back to producing an extract value
419
419
// expression.
420
- e .opcode = EI->getOpcode ();
420
+ E .opcode = EI->getOpcode ();
421
421
for (Use &Op : EI->operands ())
422
- e .varargs .push_back (lookupOrAdd (Op));
422
+ E .varargs .push_back (lookupOrAdd (Op));
423
423
424
- append_range (e .varargs , EI->indices ());
424
+ append_range (E .varargs , EI->indices ());
425
425
426
- return e ;
426
+ return E ;
427
427
}
428
428
429
429
GVNPass::Expression GVNPass::ValueTable::createGEPExpr (GetElementPtrInst *GEP) {
0 commit comments