Alias Analysis and backend specific memory intrinsic


I have a custom backend specific intrinsic with the signature {i32, i8*} {i8*, i32}.

The intrinsic is similar to a post increment load but does some thing extra.

It returns the value that is loaded from the memory and the updates the base pointer.

void foo (int *restrict ptr, int *output, int loaded_value, int N) {

// This updates loaded_value and updates the ptr to ptr+N

ptr = intrinsic_call( ptr,&loaded_value, N);

*output = N;


The ScheduleDAG creates an ordered memory dependency from the intrinsic_call to the unrelated store from “output”.

which is causing a performance degradation in my case. The value of “ptr” is updated through

“extractvalue” and that makes it harder for the AA to identify the underlying object and ends up with a “mayalias”.

I have tried playing around with attributes to the intrinsic call and none of them seem appropriate in my case.

Any pointers, ideas and suggestions would be most welcomed.