[LLVMdev] InsertElementInst and ExtractElementInst
Vasileios Koutsoumpos
bill_koutsoumpos at hotmail.com
Tue Jul 22 03:59:05 PDT 2014
Hello,
I am create a <3 x i32> vector in LLVM IR. Then I insert 3 instructions
and later on I try to load one instruction from the vector. The
insertion seems to work, however, when I try to load a specific
instruction from a vector I seems that it does not work.
This is the part of my IR:
%"ins or1" = insertelement <3 x i32> undef, i32 %38, i32 0
%"ins and2" = insertelement <3 x i32> undef, i32 %41, i32 1
%"ins xor3" = insertelement <3 x i32> undef, i32 %43, i32 2
%extract4 = extractelement <3 x i32> undef, i32 %35
...
store i32 %extract4, i32* %46, align 4
The output of my program is different that the expected one, like the
extractelement takes an undefined value.
The instructions I used are:
Instruction *Insert0 = InsertElementInst::Create(vector, Or_set, index0,
"ins or");
..
Instruction *extract = ExtractElementInst::Create(vector, ch,
"extract"); //where ch takes a value from 0 to 2
instr->replaceAllUsesWith(extract); //where I want to replace the instr
instruction with the instruction from the vector.
I am new in the LLVM and I am not sure if I have done something wrong.
Any suggestions are welcomed.
Regards,
Vasilis
More information about the llvm-dev
mailing list