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
opt: /home/xx/llvm2/llvm/include/llvm/Support/Casting.h:237: typename
enable_if<is_same<Y, typename simplify_type<Y>::SimpleType>,
typename
cast_retty<X, Y
*>::ret_type>::type llvm::cast(Y *) [X = llvm::IntegerType, Y llvm::Type]:
Assertion
`isa<X>(Val) && "cast<Ty>() argument of incompatible
type!"' failed.
How could this crash be fixed?
Thanks in advance
--
* Rasha Salah Omar
Msc Student at E-JUST
Demonestrator at Faculty of Computers and Informatics
Benha University*
* e-mail: rasha.omar at ejust.edu.eg*
P* Please consider the environment before printing this email.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20130822/3133b4aa/attachment.html>
> 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 again.
Hi Tim, It works Thanks On 22 August 2013 08:58, Tim Northover <t.p.northover at gmail.com> wrote:> > 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 > again. >-- * Rasha Salah Omar Msc Student at E-JUST Demonestrator at Faculty of Computers and Informatics Benha University* * e-mail: rasha.omar at ejust.edu.eg* P* Please consider the environment before printing this email.* -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130822/6f93d3d9/attachment.html>