mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
[InstSimplify] Teach InstSimplify how to simplify extractvalue
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242007 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2174,16 +2174,9 @@ Instruction *InstCombiner::visitExtractValueInst(ExtractValueInst &EV) {
|
||||
if (!EV.hasIndices())
|
||||
return ReplaceInstUsesWith(EV, Agg);
|
||||
|
||||
if (Constant *C = dyn_cast<Constant>(Agg)) {
|
||||
if (Constant *C2 = C->getAggregateElement(*EV.idx_begin())) {
|
||||
if (EV.getNumIndices() == 0)
|
||||
return ReplaceInstUsesWith(EV, C2);
|
||||
// Extract the remaining indices out of the constant indexed by the
|
||||
// first index
|
||||
return ExtractValueInst::Create(C2, EV.getIndices().slice(1));
|
||||
}
|
||||
return nullptr; // Can't handle other constants
|
||||
}
|
||||
if (Value *V =
|
||||
SimplifyExtractValueInst(Agg, EV.getIndices(), DL, TLI, DT, AC))
|
||||
return ReplaceInstUsesWith(EV, V);
|
||||
|
||||
if (InsertValueInst *IV = dyn_cast<InsertValueInst>(Agg)) {
|
||||
// We're extracting from an insertvalue instruction, compare the indices
|
||||
|
Reference in New Issue
Block a user