I am trying to use LLVMBuildShuffleVector function which asks for:
LLVMBuildShuffleVector (LLVMBuilderRef, LLVMValueRef V1, LLVMValueRef V2, LLVMValueRef Mask, const char *Name)
I have this two LLVMValueRef:
LLVMValueRef value1 = getChildren().get(0).getLlvmValueRef();
LLVMValueRef value2 = getChildren().get(1).getLlvmValueRef();
With them I create mask, which is also a LLVMValueRef, where maskElemArray is an array with the mask's elements:
LLVMValueRef mask = LLVMConstVector(new PointerPointer(maskElemArray), maskElemArray.length);
Now I have to call LLVMBuildShuffleVector:
LLVMValueRef shuffleV = LLVMBuildShuffleVector(builderRef, value1, value2, mask, "shuffleV");
The problem is that I get this error:
Invalid shufflevector operands!
%shuffleV = shufflevector [8 x i8] %a3, [4 x i8] %b4, <11 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 8, i32 9, i32 10, i32 11>
LLVM ERROR: Broken module found, compilation aborted!
What's the reason of this? What am I missing? Any hints how to solve it? Thanks for all your help!