This change extends GVN to handle the following case:
%1 = tail call noalias i8* @calloc(i64 1, i64 4) #2
%2 = bitcast i8* %1 to i32*
; This load is trivially constant zero
%3 = load i32* %2, align 4
This is analogous to the handling for malloc in the same places. Malloc returns undef, calloc returns a zero value. Note that it is correct to return zero even for out of bounds geps since the result of such a gep would be undefined.
I'm not entirely clear why this code lives in GVN rather than elsewhere; I have chosen to simply extend the existing design.
Please note: I do not have commit access and will need someone to commit this on my behalf.