GEPs with all zero indices are trivially coalesced by fast-isel. For example,
authorChad Rosier <mcrosier@apple.com>
Tue, 15 Nov 2011 23:34:05 +0000 (23:34 +0000)
committerChad Rosier <mcrosier@apple.com>
Tue, 15 Nov 2011 23:34:05 +0000 (23:34 +0000)
commit22b34cce4d270f787d4c991baee596a9e3b7f836
tree9ea1b16af909b16585be9b5062b81185a0d5bb1b
parente43862b6a6130ec29ee4e9e6c6c30b5607c9a728
GEPs with all zero indices are trivially coalesced by fast-isel.  For example,

%arrayidx135 = getelementptr inbounds [4 x [4 x [4 x [4 x i32]]]]* %M0, i32 0, i64 0
%arrayidx136 = getelementptr inbounds [4 x [4 x [4 x i32]]]* %arrayidx135, i32 0, i64 %idxprom134

Prior to this commit, the GEP instruction that defines %arrayidx136 thought that
%arrayidx135 was a trivial kill.  The GEP that defines %arrayidx135 doesn't
generate any code and thus %M0 gets folded into the second GEP.  Thus, we need
to look through GEPs with all zero indices.
rdar://10443319

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144730 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/FastISel.cpp