search for: strippointercasts

Displaying 20 results from an estimated 56 matches for "strippointercasts".

2018 Dec 12
2
The bit pattern after stripPointerCasts()
Hi, in a recent review [0], Florian Hahn helped me to realize something that was rather surprising to me: The widely popular and very useful function llvm::Value::stripPointerCasts() can return a value with a different bit pattern than the input. Now, I think this should not be the case but I want the hear other opinions. Before I go on, please not that there is at least one location in the code base [1] that makes a wrong assumption about the bit pattern preservation. T...
2018 Dec 14
2
The bit pattern after stripPointerCasts()
> On Dec 14, 2018, at 2:44 PM, Finkel, Hal J. <hfinkel at anl.gov> wrote: > > Do you have an opinion on which should be the default? > > -Hal > > Not particularly. The current name sounds to me like it would strip any casts it possibly can. Maybe most uses should now be converted to a newly named stripTrivialPointerCasts? -Matt -------------- next part
2018 Dec 14
2
The bit pattern after stripPointerCasts()
...On 12/11/18 6:51 PM, Doerfert, Johannes Rudolf via llvm-dev wrote: >> Hi, >> >> in a recent review [0], Florian Hahn helped me to realize something that >> was rather surprising to me: >> >> The widely popular and very useful function >> llvm::Value::stripPointerCasts() can return a value with a different >> bit pattern than the input. >> >> Now, I think this should not be the case but I want the hear other >> opinions. Before I go on, please not that there is at least one location >> in the code base [1] that makes a wrong assum...
2011 May 16
0
[LLVMdev] dyn_cast<Instruction *> returns NULL where it should return a valid instruction
...Am I doing anything wrong here? The bitcast you see above is not an instruction. Rather, it is a constant expression and is represented by a ConstExpr object in the C++ API. That is most likely because @P is a constant (a function pointer, global value, or something similar). So, 1) Use the stripPointerCasts() method of llvm::Value to strip away all pointer casts (whether they are cast instructions or ConstExpr casts): I->getOperand(0)->stripPointerCasts() 2) Realize that not all operands are instructions. In this case, the operand is probably a global variable. Chances are good that: dyn_...
2011 May 16
2
[LLVMdev] dyn_cast<Instruction *> returns NULL where it should return a valid instruction
I have the following prototype for a function: void bkp_memory(char *, int); Inside my LLVM IR, I have a callsite looks like the following: tail call void @bkp_memory(i8* bitcast (i32** @P to i8*), i32 4) nounwind When I try to obtain its 1st argument and check whether it is a valid instruction, using: Instruction *Inst = dyn_cast<Instruction *>(I->getOperand(0)); it gives me a
2014 Jul 07
2
[LLVMdev] Return Type of Call Function with nested bitcast
Hi All, I am facing an issue with CallInst with nested bitcast instruction. I want to check if the return type of a call is void or non-void the below line works well for CallInst without bit cast. *cast<CallInst>(I)->getCalledFunction()->getReturnType()->isVoidTy()* But for Call instructions like *call void bitcast (void (%struct.jpeg_compress_struct.131*, i32)*
2013 Jan 15
2
[LLVMdev] [cfe-dev] no-alias generated as result of restrict function arguments
...null). - // Note that generalizing to the case where LHS is a global variable address - // or null is pointless, since if both LHS and RHS are constants then we - // already constant folded the compare, and if only one of them is then we - // moved it to RHS already. - Value *LHSPtr = LHS->stripPointerCasts(); - Value *RHSPtr = RHS->stripPointerCasts(); - if (LHSPtr == RHSPtr) - return ConstantInt::get(ITy, CmpInst::isTrueWhenEqual(Pred)); - - // Be more aggressive about stripping pointer adjustments when checking a - // comparison of an alloca address to another object. We can rip off all...
2019 Mar 12
3
Help with bitcast instruction
Hi Tim, I'm still struggling on the instruction: call void bitcast (void (%struct.png_struct_def.68*, i8*, i8* (%struct.png_struct_def.68*, i64)*, void (%struct.png_struct_def.68*, i8*)*)* @png_set_mem_fn to void (%struct.png_struct_def*, i8*, i8* (%struct.png_struct_def*, i64)*, void (%struct.png_struct_def*, i8*)*)*)(%struct.png_struct_def* %create_struct, i8* %mem_ptr, i8*
2015 Aug 31
2
Should personality functions actually be functions
...ddPersonality(MBB, cast<Function>(LPadInst->getParent() >> ->getParent() >> ->getPersonalityFn() >> ->stripPointerCasts())); >> >> We get different behavior in this code, which is able to handle non-function personality functions. >> >> EHPersonality llvm::classifyEHPersonality(const Value *Pers) { >> const Function *F = dyn_cast<Function>(Pers->stripPointerCasts()); >&g...
2012 Jul 17
1
[LLVMdev] [DragonEgg] Why Fortran's "call flush()" is converted to "call void bitcast (void (...)* @_gfortran_flush_i4 to void (i8*)*)(i8* null) nounwind" ?
Thanks, Duncan, makes sense! I suppose you meant something like this: Function* callee = dyn_cast<Function>( call->getCalledValue()->stripPointerCasts()); if (!callee) continue; - D. 2012/7/17 Duncan Sands <baldrick at free.fr> > Hi Dmitry, it would be neater to use stripPointerCasts. > > Ciao, Duncan. > > > OK, at our end the following workaround seems to be sufficient: > > > >...
2009 Jul 23
0
[LLVMdev] [PATCH] PR2218
...rd (to support GVN) and forward (to support DSE). In the meantime, enhancing memcpyopt is fine, so long as there are good testcases (and your patch has them!). Nit picky stuff about the patch: + for(unsigned argI = 0; argI < CS.arg_size(); ++argI) { + if(CS.getArgument(argI)->stripPointerCasts() == pointer) Please put spaces after if/for. You get this right in some places, but wrong in others. + Value* pointer = L->getPointerOperand(); Please use "Value *pointer" style throughout. It looks like MemCpyOpt is already really inconsistent about this :-/ but please don&...
2009 Jul 22
2
[LLVMdev] [PATCH] PR2218
Hello, This patch fixes PR2218. However, I'm not pretty sure that this optimization should be in MemCpyOpt. I think that GVN is good place as well. Regards -- Jakub Staszak -------------- next part -------------- A non-text attachment was scrubbed... Name: pr2218.patch Type: application/octet-stream Size: 6146 bytes Desc: not available URL:
2013 Jan 16
0
[LLVMdev] [cfe-dev] no-alias generated as result of restrict function arguments
...null). - // Note that generalizing to the case where LHS is a global variable address - // or null is pointless, since if both LHS and RHS are constants then we - // already constant folded the compare, and if only one of them is then we - // moved it to RHS already. - Value *LHSPtr = LHS->stripPointerCasts(); - Value *RHSPtr = RHS->stripPointerCasts(); - if (LHSPtr == RHSPtr) - return ConstantInt::get(ITy, CmpInst::isTrueWhenEqual(Pred)); + // icmp <object*>, <object*/null> + if (LHS->getType()->isPointerTy() && RHS->getType()->isPointerTy()) { + // Ignore...
2012 Jul 17
0
[LLVMdev] [DragonEgg] Why Fortran's "call flush()" is converted to "call void bitcast (void (...)* @_gfortran_flush_i4 to void (i8*)*)(i8* null) nounwind" ?
Hi Dmitry, it would be neater to use stripPointerCasts. Ciao, Duncan. > OK, at our end the following workaround seems to be sufficient: > > // Check if function is called (needs -instcombine pass). > Function* callee = call->getCalledFunction(); > if (!callee) >...
2012 Dec 12
0
[LLVMdev] [cfe-dev] no-alias generated as result of restrict function arguments
On Wed, Dec 12, 2012 at 1:26 PM, Joerg Sonnenberger <joerg at britannica.bec.de> wrote: > On Wed, Dec 12, 2012 at 11:01:01AM -0800, Dan Gohman wrote: >> > Is that >> > assumption violated if I explicitly cast away const and pass the result >> > to a function with NoAlias argument? >> >> Not immediately, no. It means that you can't access the
2012 Dec 12
3
[LLVMdev] [cfe-dev] no-alias generated as result of restrict function arguments
On Wed, Dec 12, 2012 at 11:01:01AM -0800, Dan Gohman wrote: > > Is that > > assumption violated if I explicitly cast away const and pass the result > > to a function with NoAlias argument? > > Not immediately, no. It means that you can't access the constant > pointer's pointee directly within the noalias argument's scope. Access > to that object must go
2012 Jul 17
2
[LLVMdev] [DragonEgg] Why Fortran's "call flush()" is converted to "call void bitcast (void (...)* @_gfortran_flush_i4 to void (i8*)*)(i8* null) nounwind" ?
OK, at our end the following workaround seems to be sufficient: // Check if function is called (needs -instcombine pass). Function* callee = call->getCalledFunction(); if (!callee) { // Could be also a function called inside a bitcast. // So try to extract function
2009 Jul 25
2
[LLVMdev] [PATCH] PR2218
...(to support DSE). In the > meantime, enhancing memcpyopt is fine, so long as there are good > testcases (and your patch has them!). > > Nit picky stuff about the patch: > > + for(unsigned argI = 0; argI < CS.arg_size(); ++argI) { > + if(CS.getArgument(argI)->stripPointerCasts() == pointer) > > Please put spaces after if/for. You get this right in some places, > but wrong in others. > > + Value* pointer = L->getPointerOperand(); > > Please use "Value *pointer" style throughout. It looks like > MemCpyOpt is already really incons...
2009 Mar 26
0
[LLVMdev] how to get the InvodInst 's Operand Name?
...he latter @__cxa_throw i can get it throw value->getName(), but the > @_ZTi it did n't has name! if II is the invoke instruction, you can get the names as follows: "@__cxa_throw": II->getCalledFunction()->getValueName() "@_ZTi": II->getOperand(4)->stripPointerCasts()->getValueName() The first one won't work for indirect calls. The second one won't work in more complicated situations. Why do you want the names anyway? Ciao, Duncan.
2011 Oct 12
1
[LLVMdev] getting object from BitCastInst?
My pass is looking at StoreInsts acting on global variable that happen to be function pointers. From these StoreInsts I would like to get useful information(the function used if a direct assignment, function pointer used, etc) from the getValueOperand() method. Looking through several examples I see that this can return several things like: GlobalVariable, Function, LoadInst or BitCastInst