search for: constantpointernull

Displaying 20 results from an estimated 53 matches for "constantpointernull".

2009 Nov 06
2
[LLVMdev] BasicAliasAnalysis: Null pointers do not alias with anything
...tUnderlyingObject, since it's not valid to do arithmetic from null to > reach an LLVM identified object either. I'm not sure what you mean by generalizing. Do you mean I should do the check on O1 and O2, which are the results of calls to getUnderlyingObject? Something like: if (const ConstantPointerNull *CPN = dyn_cast<ConstantPointerNull>(O1)) if (CPN->getType()->getAddressSpace() == 0) return NoAlias; and the same for O2 (maybe extract it into a function?) / Hans > > Dan >
2011 Oct 08
0
[LLVMdev] Initializing GC roots
...+ } }; LowerIntrinsics::InsertRootInitializers is only 26 lines of code. You can find it here: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GCStrategy.cpp?annotate=123170#l174 More invasively, you could consider adding a hook to GCStrategy which replaces the indicated call to ConstantPointerNull::get in LowerIntrinsics::InsertRootInitializers: // Add root initializers. bool MadeChange = false; for (AllocaInst **I = Roots, **E = Roots + Count; I != E; ++I) if (!InitedRoots.count(*I)) { ====> StoreInst* SI = new StoreInst(ConstantPointerNull::get(cast<PointerType>( ==...
2011 Oct 06
2
[LLVMdev] Initializing GC roots
Hello all, I set: InitRoots = true; in my gc plugin as i want the roots to be initialized to the "null" value. Is there a way to define which value should be the initial one? For example, i would like to initialize my roots to -5 (tagged, null value for the GC in my runtime system) instead of 0. Ofcourse, i could do it in the frontend (storing -5 to all GC roots), but i was wondering
2009 Nov 07
0
[LLVMdev] BasicAliasAnalysis: Null pointers do not alias with anything
On Nov 6, 2009, at 7:49 AM, Hans Wennborg wrote: > > I'm not sure what you mean by generalizing. > Do you mean I should do the check on O1 and O2, which are the results of calls to getUnderlyingObject? > > Something like: > > if (const ConstantPointerNull *CPN = dyn_cast<ConstantPointerNull>(O1)) > if (CPN->getType()->getAddressSpace() == 0) > return NoAlias; > > and the same for O2 (maybe extract it into a function?) Yes, thanks. Dan
2009 Nov 07
1
[LLVMdev] BasicAliasAnalysis: Null pointers do not alias with anything
...Gohman wrote: > On Nov 6, 2009, at 7:49 AM, Hans Wennborg wrote: >> I'm not sure what you mean by generalizing. >> Do you mean I should do the check on O1 and O2, which are the results of calls to getUnderlyingObject? >> >> Something like: >> >> if (const ConstantPointerNull *CPN = dyn_cast<ConstantPointerNull>(O1)) >> if (CPN->getType()->getAddressSpace() == 0) >> return NoAlias; >> >> and the same for O2 (maybe extract it into a function?) > > Yes, thanks. Ok, patch with test case attached. / Hans > > Dan >...
2013 Nov 07
4
[LLVMdev] Should remove calling NULL pointer or not
...like calling undefvalue. In InstCombineCalls.cpp:930 I think it is not a right approach because calling null pointer function Will segfault the program. Converting to a store will make program pass Silently. This changes the behavior of a program. So we need remove the case if (isa<ConstantPointerNull>(Callee) at InstCombineCalls.cpp:918 and treat calling Null pointer reachable. How do you think? Is there any reason that we should convert a calling null pointer to a store? Thanks, Yin -------------- next part -------------- An HTML attachment was scrubbed... URL:...
2014 Dec 11
2
[LLVMdev] Dereferencing null pointers
...::visitLoadInst(LoadInst &LI) I see > that we replace load of null pointer by unreachable only for address > space 0. But there is also code doing the following transformation for > all the address spaces: > > // load (select (cond, null, P)) -> load P > > if(isa<ConstantPointerNull>(SI->getOperand(1)) && > > LI.getPointerAddressSpace() == 0) { > > LI.setOperand(0, SI->getOperand(2)); > > return &LI; > > } > > > > Is this a bug? Would the correct behavior be to check that the > pointers’ address space is 0? B...
2009 Sep 23
2
[LLVMdev] DebugFactory
...in wrote: > > // Calculate the size of the specified LLVM type. > Constant * DebugInfoBuilder::getSize(const Type * type) { > Constant * one = ConstantInt::get(Type::Int32Ty, 1); > return ConstantExpr::getPtrToInt( > ConstantExpr::getGetElementPtr( > ConstantPointerNull::get(PointerType::getUnqual(type)), > &one, 1), Type::Int32Ty); > } > > Constant * DebugInfoBuilder::getAlignment(const Type * type) { > // Calculates the alignment of T using "sizeof({i8, T}) - sizeof > (T)" > return ConstantExpr::getSub( &gt...
2009 Nov 05
0
[LLVMdev] BasicAliasAnalysis: Null pointers do not alias with anything
Hello, On Nov 4, 2009, at 1:51 AM, Hans Wennborg wrote: > > > / Hans > Index: lib/Analysis/BasicAliasAnalysis.cpp > =================================================================== > --- lib/Analysis/BasicAliasAnalysis.cpp (revision 86023) > +++ lib/Analysis/BasicAliasAnalysis.cpp (working copy) > @@ -633,6 +633,15 @@ > AliasAnalysis::AliasResult >
2014 Dec 11
2
[LLVMdev] Dereferencing null pointers
...Combine pass in InstCombiner::visitLoadInst(LoadInst &LI) I see that we replace load of null pointer by unreachable only for address space 0. But there is also code doing the following transformation for all the address spaces: // load (select (cond, null, P)) -> load P if(isa<ConstantPointerNull>(SI->getOperand(1)) && LI.getPointerAddressSpace() == 0) { LI.setOperand(0, SI->getOperand(2)); return &LI; } Is this a bug? Would the correct behavior be to check that the pointers' address space is 0? Cheers, Thomas -------------- next p...
2009 Sep 22
0
[LLVMdev] DebugFactory
...t;... without Target info..." > > // Calculate the size of the specified LLVM type. Constant * DebugInfoBuilder::getSize(const Type * type) { Constant * one = ConstantInt::get(Type::Int32Ty, 1); return ConstantExpr::getPtrToInt( ConstantExpr::getGetElementPtr( ConstantPointerNull::get(PointerType::getUnqual(type)), &one, 1), Type::Int32Ty); } Constant * DebugInfoBuilder::getAlignment(const Type * type) { // Calculates the alignment of T using "sizeof({i8, T}) - sizeof(T)" return ConstantExpr::getSub( getSize(StructType::get(Type::I...
2009 Jan 09
0
[LLVMdev] RFC: Store alignment should be LValue alignment, not source alignment
...unsigned Alignment = expr_align(Op) / 8; > + unsigned Alignment = LV.getAlignment(); This also looks like it was already ok. > if (errorcount || sorrycount) { > - const PointerType *Ty = > - PointerType::getUnqual(ConvertType(TREE_TYPE(exp))); > - return ConstantPointerNull::get(Ty); > + const Type *Ty = ConvertType(TREE_TYPE(exp)); > + const PointerType *PTy = PointerType::getUnqual(Ty); > + LValue LV(ConstantPointerNull::get(PTy), > TD.getABITypeAlignment(Ty)); > + return LV; If the type is opaque or abstract, won't this ass...
2020 Jan 14
2
sizeof implementation: how to get size as a constantInt?
I'm implementing c style "sizeof()", and I did as http://nondot.org/sabre/LLVMNotes/SizeOf-OffsetOf-VariableSizedStructs.txt illuarstrated, and it works find, here's an example of my implementation: auto *p = builder.CreateGEP(structTy, llvm::ConstantPointerNull::get(pointerTy), constint1); auto *size = builder.CreatePtrToInt(p, llvm::IntegerType::get(context, 64)); and type definitions: auto *constint1 = llvm::ConstantInt::get(context, llvm::APInt(64, 1)); auto *int64Ty = llvm::IntegerType::get(context, 64); auto *doubleT...
2009 Nov 04
5
[LLVMdev] BasicAliasAnalysis: Null pointers do not alias with anything
This is the first patch I've sent to this project. Please be gentle :) LLVM fails to remove the dead load in the following code when running $./llvm-as -o - test.ll | ./opt -O3 -o - | ./llvm-dis -o - %t = type { i32 } declare void @foo(i8*) define void @f(%t* noalias nocapture %stuff ) { %p = getelementptr inbounds %t* %stuff, i32 0, i32 0 %before = load i32* %p call void
2012 Jun 17
3
[LLVMdev] BlockAddress instruction is copied instead of cloned during module link?
...ast(Instruction::IntToPtr, const_int32_9, PointerTy_1); const_array_5_elems.push_back(const_ptr_8); Constant* const_array_5 = ConstantArray::get(ArrayTy_0, const_array_5_elems); ConstantInt* const_int32_10 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("0"), 10)); ConstantPointerNull* const_ptr_11 = ConstantPointerNull::get(PointerTy_1); // Global Variable Definitions gvar_array_switch_bbs->setInitializer(const_array_5); // Function Definitions // Function: my_func (func_my_func) { Function::arg_iterator args = func_my_func->arg_begin(); Value* int32_1...
2009 Sep 22
3
[LLVMdev] DebugFactory
On Tue, Sep 22, 2009 at 9:21 AM, Devang Patel <devang.patel at gmail.com> wrote: > On Tue, Sep 22, 2009 at 12:14 AM, Talin <viridia at gmail.com> wrote: >> So, one feature of the late, lamented DebugInfoBuilder that I am missing >> quite badly, and which is not available in the current DIFactory, is the >> ability to specify structure offsets abstractly. The
2007 May 11
2
[LLVMdev] identifing mallocs with constant sizes
...stantAggregateZero){ -- the malloc is for size 0 } else if(the array size is a ConstantFP){ -- I don't believe this case should happen but if it did, the array size could be obtained by calling getValue() } else if(the array size is a ConstantArray or ConstantPointerNull or ConstantStruct or ConstantVector or GlobalValue or UndefValue){ -- this should not happen! } } } in all other cases, the malloc is for a non-constant request size ============================================================= Regards, Ryan
2009 Mar 20
0
[LLVMdev] GC interface suggestions
Hello, I have a few suggestions for the GC interface. First, initialization of roots fails if the root isn't just a pointer. Some implementations require more data than just the pointer for handling references to the interior of an aggregate. On my end it just required changing ConstantPointerNull::get() to Constant::GetNullValue() to support fat pointers. The roots that were being initialized also weren't added to the InitedRoots set so the generated code would be multiply-initializing the same roots if they were rooted more than once. @@ -178,10 +180,10 @@ for (AllocaInst **I =...
2009 Sep 23
0
[LLVMdev] DebugFactory
...gt; // Calculate the size of the specified LLVM type. >> Constant * DebugInfoBuilder::getSize(const Type * type) { >> Constant * one = ConstantInt::get(Type::Int32Ty, 1); >> return ConstantExpr::getPtrToInt( >> ConstantExpr::getGetElementPtr( >> ConstantPointerNull::get(PointerType::getUnqual(type)), >> &one, 1), Type::Int32Ty); >> } >> >> Constant * DebugInfoBuilder::getAlignment(const Type * type) { >> // Calculates the alignment of T using "sizeof({i8, T}) - sizeof(T)" >> return ConstantExp...
2014 Jun 27
2
[LLVMdev] how create a pointer to FILE*
Hi, all I want to create a function in LLVM IR, whose type is: void _to_prof( FILE* ptrF); I do it within LLVM, but I don't know how build the parameter type for FILE* ptrF. Best Regards. Eric Lu -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140627/c49bdb2a/attachment.html>