Removing zero indices opaque pointer gep, link, has caused Instcombine pass to not combine few GepOfGep instructions which were previously possible for non-opaque pointers case.
Consider below IR : link
@ext = external hidden global [2 x [1 x float]] %a = getelementptr inbounds [2 x [1 x float]], [2 x [1 x float]]* @ext, i64 0, i64 %c %b = getelementptr inbounds [1 x float], [1 x float]* %a, i64 0, i64 0 %c = getelementptr inbounds float, float* %b, i64 %in1
would be optimized to
%c = getelementptr inbounds [2 x [1 x float]], [2 x [1 x float]]* @ext, i64 0, i64 %c, i64 %in1
This is currently not happening for opaque pointer case. link
This patch tries to address this issue by combining single index gep with src gep.