change iterator invalidation avoidance to just move the iterator backward
authorChris Lattner <sabre@nondot.org>
Sat, 29 Mar 2008 05:15:47 +0000 (05:15 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 29 Mar 2008 05:15:47 +0000 (05:15 +0000)
commit97ae12a98845c44807b4ee833d86c0b4d2521d05
treedee38bd74984f4b18ae76b115358258ab89e70cb
parentd22fe2b51f553f7eca200cd22b9e2247f9aea2ff
change iterator invalidation avoidance to just move the iterator backward
when something changes, instead of moving forward.  This allows us to
simplify memset lowering, inserting the memset at the end of the range of
stuff we're touching instead of at the start.

This, in turn, allows us to make use of the addressing instructions already
used in the function instead of inserting our own.  For example, we now
codegen:

%tmp41 = getelementptr [8 x i8]* %ref_idx, i32 0, i32 0 ; <i8*> [#uses=2]
call void @llvm.memset.i64( i8* %tmp41, i8 -1, i64 8, i32 1 )

instead of:

%tmp20 = getelementptr [8 x i8]* %ref_idx, i32 0, i32 7 ; <i8*> [#uses=1]
%ptroffset = getelementptr i8* %tmp20, i64 -7 ; <i8*> [#uses=1]
call void @llvm.memset.i64( i8* %ptroffset, i8 -1, i64 8, i32 1 )

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48940 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/GVN.cpp