In current getPointerAlignemnt implementation, CallBase.getPointerAlignement(..) checks only parameter attriutes in the callsite. For example,
declare align 8 i8* @foo()
define void @bar() {
%a = tail call align 8 i8* @foo() ; getPointerAlignment returns 8
%b = tail call i8* @foo() ; getPointerAlignemnt returns 0
ret void
}This patch will fix the problem.