insertAfter method Patch

Hi,
I have added an insertAfter method to the ilist and Instruction classes. The methods are implemented as efficiently as the currently existing insert and insertBefore methods. The insertAfter method was created to mirror a similar method in another compiler in order to ease an ongoing port. The patch, which is very small is included as AddInsertBefore.patch. Additionally, I wrote a small test pass which demonstrates the correctness of insertAfter and have attached it as ScratchPass.cpp. Thanks.
Tom

AddInsertAfter.patch (1.83 KB)

ScratchPass.cpp (1.52 KB)

Thomas B. Jablin wrote:

Hi,
I have added an insertAfter method to the ilist and Instruction classes. The methods are implemented as efficiently as the currently existing insert and insertBefore methods. The insertAfter method was created to mirror a similar method in another compiler in order to ease an ongoing port. The patch, which is very small is included as AddInsertBefore.patch. Additionally, I wrote a small test pass which demonstrates the correctness of insertAfter and have attached it as ScratchPass.cpp. Thanks.
Tom

Small nitpick: in Instruction.cpp, the comment for insertAfter says insertBefore and not insertAfter.
:slight_smile:

-- John T.

John Criswell wrote:

Small nitpick: in Instruction.cpp, the comment for insertAfter says insertBefore and not insertAfter.
:slight_smile:

-- John T.

_______________________________________________
LLVM Developers mailing list
LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
  
Thanks for spotting the problem. Looking at the code again, I made the same mistake in the comment in Instruction.h. Here is the patch with the corrected comments.
Tom

AddInsertAfter.patch (1.83 KB)

Looks fine. Have you committed this?

Evan

Applied, thanks!
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090112/072078.html