File tree Expand file tree Collapse file tree 2 files changed +8
-13
lines changed Expand file tree Collapse file tree 2 files changed +8
-13
lines changed Original file line number Diff line number Diff line change @@ -39,18 +39,19 @@ class mapped_mcinst_iterator
3939MCInstReference MCInstReference::get (const MCInst &Inst,
4040 const BinaryFunction &BF) {
4141 if (BF.hasCFG ()) {
42- for (BinaryBasicBlock &BB : BF)
42+ for (BinaryBasicBlock &BB : BF) {
4343 for (MCInst &MI : BB)
4444 if (&MI == &Inst)
4545 return MCInstReference (BB, Inst);
46- return {};
46+ }
47+ llvm_unreachable (" Inst is not contained in BF" );
4748 }
4849
4950 for (auto I = BF.instrs ().begin (), E = BF.instrs ().end (); I != E; ++I) {
5051 if (&I->second == &Inst)
5152 return MCInstReference (BF, I);
5253 }
53- return {} ;
54+ llvm_unreachable ( " Inst is not contained in BF " ) ;
5455}
5556
5657uint64_t MCInstReference::computeAddress (const MCCodeEmitter *Emitter) const {
Original file line number Diff line number Diff line change @@ -531,11 +531,8 @@ class SrcSafetyAnalysis {
531531 const SrcState &S = getStateBefore (Inst);
532532
533533 std::vector<MCInstReference> Result;
534- for (const MCInst *Inst : lastWritingInsts (S, ClobberedReg)) {
535- MCInstReference Ref = MCInstReference::get (*Inst, BF);
536- assert (!Ref.empty () && " Expected Inst to be found" );
537- Result.push_back (Ref);
538- }
534+ for (const MCInst *Inst : lastWritingInsts (S, ClobberedReg))
535+ Result.push_back (MCInstReference::get (*Inst, BF));
539536 return Result;
540537 }
541538};
@@ -1103,11 +1100,8 @@ class DstSafetyAnalysis {
11031100 const DstState &S = getStateAfter (Inst);
11041101
11051102 std::vector<MCInstReference> Result;
1106- for (const MCInst *Inst : firstLeakingInsts (S, LeakedReg)) {
1107- MCInstReference Ref = MCInstReference::get (*Inst, BF);
1108- assert (!Ref.empty () && " Expected Inst to be found" );
1109- Result.push_back (Ref);
1110- }
1103+ for (const MCInst *Inst : firstLeakingInsts (S, LeakedReg))
1104+ Result.push_back (MCInstReference::get (*Inst, BF));
11111105 return Result;
11121106 }
11131107};
You can’t perform that action at this time.
0 commit comments