[LLVMdev] Overly restrictive size argument to llvm.invariant.start

Nick Lewycky nicholas at mxc.ca
Thu Jul 28 23:30:29 PDT 2011

Geoff Reedy wrote:
> Why is it that @llvm.invariant.start requires the size argument to be a
> constant integer literal and does not accept constant expressions? For
> example the following IR:
> declare {}* @llvm.invariant.start(i64,i8*)
> define void @foo() {
>    %1 = call {}* @llvm.invariant.start(i64 ptrtoint(i8* getelementptr(i8*
>    %null, i32 1) to i64), i8* null)
>    ret void
> }
> gives the following error from llvm-as:
> size argument of memory use markers must be a constant integer

Because the optimizers couldn't make use of such expressions anyway. If 
you have TargetData, you can resolve that offsetof expression to a 
concrete value, or else you can emit -1.


More information about the llvm-dev mailing list