Crash in CreateShl() method

Hi All,

AllocaInst * AI = builder.CreateAlloca(type, 0, BBName);
StoreInst* ST=  builderTF.CreateStore(ConstantInt::get(type,1),AI);
Value * Vresult = (Value*)ST;
Vresult = builderWait.CreateShl(Vresult, 1);

I need to make one bit shift left to the variable stored in the second step

I’ve got crash in this step

How could this crash be fixed?

What you've basically written is:
    %AI = alloca i32
    %Vresult = store i32 1, i32* %AI
    %res = shl i32 %Vresult, 1

The problem is that stores don't produce values that can be used
elsewhere (they have type "void"). If you want to shift a variable
like "AI" in LLVM you have to load it, do the shift and then store it

Hi Tim,

It works