This is an archive of the discontinued LLVM Phabricator instance.

[GISel]: Allow the MachineIRBuilder to insert instructions after
AbandonedPublic

Authored by aditya_nandakumar on Aug 22 2017, 11:23 AM.

Details

Summary

At times, it's necessary to insert instruction after an iterator.
Allow to specify InsertAfter as a boolean in the setInstr interface.

Diff Detail

Repository
rL LLVM

Event Timeline

qcolombet accepted this revision.Aug 22 2017, 4:09 PM

I believe we use to do that by using std::next([Instr | Iterator]WeWantToInsertAfter), but I can see how that could make things easier, so LGTM

This revision is now accepted and ready to land.Aug 22 2017, 4:09 PM

Just one nit.

include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
88

We should put a default value on that.

aditya_nandakumar marked an inline comment as done.Aug 22 2017, 4:20 PM

Thanks for the feedback. I've defaulted it to false.

Note: Given the other review, I let you decide if we need that patch or not.

Good point. I think this is not needed. I'll update the other patch to use the std::next version. We can add this back at a later time if it's of value.

aditya_nandakumar abandoned this revision.Aug 22 2017, 4:36 PM

Good point. I think this is not needed. I'll update the other patch to use the std::next version. We can add this back at a later time if it's of value.

You can probably directly use setInsertPt with getFirstTerminator I think (i.e., no need to use std::next ;))

Yup. That would work :). Thanks