mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
GlobalOpt: Optimize in the face of insertvalue/extractvalue
GlobalOpt didn't know how to simulate InsertValueInst or ExtractValueInst. Optimizing these is pretty straightforward. N.B. This came up when looking at clang's IRGen for MS ABI member pointers; they are represented as aggregates. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215184 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2394,6 +2394,17 @@ bool Evaluator::EvaluateBlock(BasicBlock::iterator CurInst,
|
||||
getVal(SI->getOperand(2)));
|
||||
DEBUG(dbgs() << "Found a Select! Simplifying: " << *InstResult
|
||||
<< "\n");
|
||||
} else if (auto *EVI = dyn_cast<ExtractValueInst>(CurInst)) {
|
||||
InstResult = ConstantExpr::getExtractValue(
|
||||
getVal(EVI->getAggregateOperand()), EVI->getIndices());
|
||||
DEBUG(dbgs() << "Found an ExtractValueInst! Simplifying: " << *InstResult
|
||||
<< "\n");
|
||||
} else if (auto *IVI = dyn_cast<InsertValueInst>(CurInst)) {
|
||||
InstResult = ConstantExpr::getInsertValue(
|
||||
getVal(IVI->getAggregateOperand()),
|
||||
getVal(IVI->getInsertedValueOperand()), IVI->getIndices());
|
||||
DEBUG(dbgs() << "Found an InsertValueInst! Simplifying: " << *InstResult
|
||||
<< "\n");
|
||||
} else if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(CurInst)) {
|
||||
Constant *P = getVal(GEP->getOperand(0));
|
||||
SmallVector<Constant*, 8> GEPOps;
|
||||
|
||||
Reference in New Issue
Block a user