search for: gepoperator

Displaying 20 results from an estimated 32 matches for "gepoperator".

2019 Mar 09
2
Cast a function parameter to GEP
...; > The main practical difference between the two is that instances of > Constant don't live in a BasicBlock independently, but are referenced > directly by each user. When printing the IR this is shown by > "inlining" them into the parent Instruction. > > LLVM has a GEPOperator class to help deal with this issue; it can be > used to access the common features of Instructions and Constants. > There are similar Operators for other operations because this is quite > a common situation. > > > I think it does not work because str1 is a "private constant&...
2009 Nov 10
4
[LLVMdev] BasicAliasAnalysis: constant does not alias with noalias parameter
...lt;PointerType>(V2->getType())) >> return NoAlias; // Scalars cannot alias each other >> >> + // Constant ptr cannot alias with a noalias attribute >> + if (isa<Constant>(V1) && isa<PointerType>(V2->getType())) { >> + while (const GEPOperator *g = dyn_cast<GEPOperator>(V2)) >> + V2 = g->getOperand(0); >> + >> + if (const Argument *A = dyn_cast<Argument>(V2)) >> + if (A->hasNoAliasAttr()) >> + return NoAlias; >> + } else if (isa<Constant>(V2) && isa&...
2012 Nov 02
0
[LLVMdev] DependenceAnalysis and PR14241
...const Instruction *Dst, // make sure they are loads and stores, then const Value *SrcPtr = getPointerOperand(Src); // hides a little casting, then Src->getPointerOperand const Value *DstPtr = getPointerOperand(Dst); // ditto // see how underlying objects alias, then const GEPOperator *SrcGEP = dyn_cast<GEPOperator>(SrcPtr); const GEPOperator *DstGEP = dyn_cast<GEPOperator>(DstPtr); After that, most everything is done by disassembling the SrcGEP and DstGEP. The conservative approach would be to make sure SrcPtr and DstPtr are both loop invariant. I'm not su...
2009 Nov 05
0
[LLVMdev] BasicAliasAnalysis: constant does not alias with noalias parameter
...getType()) || !isa<PointerType>(V2->getType())) > return NoAlias; // Scalars cannot alias each other > > + // Constant ptr cannot alias with a noalias attribute > + if (isa<Constant>(V1) && isa<PointerType>(V2->getType())) { > + while (const GEPOperator *g = dyn_cast<GEPOperator>(V2)) > + V2 = g->getOperand(0); > + > + if (const Argument *A = dyn_cast<Argument>(V2)) > + if (A->hasNoAliasAttr()) > + return NoAlias; > + } else if (isa<Constant>(V2) && isa<PointerType>(V1-&g...
2009 Nov 04
2
[LLVMdev] BasicAliasAnalysis: constant does not alias with noalias parameter
Here is another change I'd like to suggest to the BasicAliasAnalysis. LLVM fails to remove the dead store in the following code: %t = type { i32 } define void @f(%t* noalias nocapture %stuff ) { %p = getelementptr inbounds %t* %stuff, i32 0, i32 0 store i32 1, i32* %p; <-- This store is dead %x = load i32* inttoptr (i32 12345 to i32*) store i32 %x, i32* %p ret
2009 Nov 12
0
[LLVMdev] BasicAliasAnalysis: constant does not alias with noalias parameter
...2->getType())) >>> return NoAlias; // Scalars cannot alias each other >>> >>> + // Constant ptr cannot alias with a noalias attribute >>> + if (isa<Constant>(V1) && isa<PointerType>(V2->getType())) { >>> + while (const GEPOperator *g = dyn_cast<GEPOperator>(V2)) >>> + V2 = g->getOperand(0); >>> + >>> + if (const Argument *A = dyn_cast<Argument>(V2)) >>> + if (A->hasNoAliasAttr()) >>> + return NoAlias; >>> + } else if (isa<Constant...
2012 Nov 02
2
[LLVMdev] DependenceAnalysis and PR14241
On 11/02/2012 11:02 AM, Hal Finkel wrote: > ----- Original Message ----- >> From: "Tobias Grosser" <tobias at grosser.es> >> To: "preston briggs" <preston.briggs at gmail.com> >> Cc: "Benjamin Kramer" <benny.kra at gmail.com>, "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu> >> Sent: Friday, November
2010 Jun 18
0
[LLVMdev] Question on Load and GetElementPtr instructions
Good evening, Tang. > What is the type of the first operand of the instruction (i.e., > getOperand(0))? It might be ConstantExpr. You may use dyn_cast<GEPOperator>(getPointerOperand()). Also GetElementPtrInst* can be casted to GEPOperator. ...Takumi 2010/6/18 Xiaolong Tang <xiaolong.snake at gmail.com>: > > Hey, > > Considering the following instruction: > >  %20 = load %struct.Node** getelementptr inbounds (%struct.Node* >...
2009 Nov 13
1
[LLVMdev] BasicAliasAnalysis: constant does not alias with noalias parameter
...t;>>> return NoAlias; // Scalars cannot alias each other >>>> >>>> + // Constant ptr cannot alias with a noalias attribute >>>> + if (isa<Constant>(V1) && isa<PointerType>(V2->getType())) { >>>> + while (const GEPOperator *g = dyn_cast<GEPOperator>(V2)) >>>> + V2 = g->getOperand(0); >>>> + >>>> + if (const Argument *A = dyn_cast<Argument>(V2)) >>>> + if (A->hasNoAliasAttr()) >>>> + return NoAlias; >>>> + }...
2010 Jun 18
3
[LLVMdev] Question on Load and GetElementPtr instructions
Hey, Considering the following instruction: %20 = load %struct.Node** getelementptr inbounds (%struct.Node* @head, i32 0, i32 0), align 16 ; <%struct.Node*> [#uses=1] What is the type of the first operand of the instruction (i.e., getOperand(0))? I thought the operand is a "GetElementPtr" instruction, however, the predicate "isa<Instruction>()" over
2015 Feb 22
2
[LLVMdev] Question about shouldMergeGEPs in InstructionCombining
Hello I am not sure I understand the logic for merging GEPs in InstructionCombining.cpp: static bool shouldMergeGEPs(GEPOperator &GEP, GEPOperator &Src) { // If this GEP has only 0 indices, it is the same pointer as // Src. If Src is not a trivial GEP too, don't combine // the indices. if (GEP.hasAllZeroIndices() && !Src.hasAllZeroIndices() && !Src.hasOneUse()) return false; re...
2013 Feb 05
3
[LLVMdev] Vectorizing global struct pointers
..., it's a conflict. However, the read is from Foo.bl / Foo.cl and the write to Foo.al, so why is GetUnderlyingObjects() returning the same objects/pointers? A quick look at it revealed me the problem: llvm::GetUnderlyingObject(Value *V, const DataLayout *TD, unsigned MaxLookup) yields: -> GEPOperator *GEP = dyn_cast<GEPOperator>(V) -> V = GEP->getPointerOperand(); -> GlobalAlias *GA = dyn_cast<GlobalAlias>(V) -> V = GA->getAliasee(); return V; In this case, V is a reference to the structure, not the element. It seems to me that assigning the pointer operand from GEP...
2013 Oct 01
3
[LLVMdev] ScalarEvolution::createNodeForPHI
...------------------------------------------------------// if (const AddOperator *OBO = dyn_cast<AddOperator>(BEValueV)) { if (OBO->hasNoUnsignedWrap()) Flags = setFlags(Flags, SCEV::FlagNUW); if (OBO->hasNoSignedWrap()) Flags = setFlags(Flags, SCEV::FlagNSW); } else if (const GEPOperator *GEP = dyn_cast<GEPOperator>(BEValueV)) { // If the increment is an inbounds GEP, then we know the address // space cannot be wrapped around. We cannot make any guarantee // about signed or unsigned overflow because pointers are // unsigned but we may have a negative inde...
2014 Nov 22
3
[LLVMdev] How to get the indices in an getelementptr Value?
...at playingwithpointers.com > wrote: > Hi Qiuping, > > If I'm reading the IR correctly, what you have is a > GetElementPtrConstantExpr [1]. It subclasses from llvm::Constant. > If you want the same code to handle GetElementPtrConstantExpr *and* GetElementPtrInst, you can use GEPOperator. > > Thanks, > -- Sanjoy > > [1]: > http://llvm.org/docs/doxygen/html/classllvm_1_1GetElementPtrConstantExpr.html > > On Sat, Nov 22, 2014 at 1:10 AM, Qiuping Yi <yiqiuping at gmail.com> wrote: > > Hi Michael, > > > > Thank you very much. > >...
2015 Feb 24
2
[LLVMdev] Question about shouldMergeGEPs in InstructionCombining
...ebruary 22, 2015 5:34:11 PM > > Subject: [LLVMdev] Question about shouldMergeGEPs in InstructionCombining > > > > Hello > > > > I am not sure I understand the logic for merging GEPs in > > InstructionCombining.cpp: > > > > static bool shouldMergeGEPs (GEPOperator &GEP, GEPOperator &Src) { > > // If this GEP has only 0 indices, it is the same pointer as > > // Src. If Src is not a trivial GEP too, don't combine > > // the indices. > > if (GEP.hasAllZeroIndices() && !Src.hasAllZeroIndices() && > > !Src...
2013 Feb 05
0
[LLVMdev] Vectorizing global struct pointers
...r, the read is from Foo.bl / Foo.cl and the write to Foo.al, so why is GetUnderlyingObjects() returning the same objects/pointers? > > A quick look at it revealed me the problem: > > llvm::GetUnderlyingObject(Value *V, const DataLayout *TD, unsigned MaxLookup) yields: > > -> GEPOperator *GEP = dyn_cast<GEPOperator>(V) > -> V = GEP->getPointerOperand(); > -> GlobalAlias *GA = dyn_cast<GlobalAlias>(V) > -> V = GA->getAliasee(); > return V; > > In this case, V is a reference to the structure, not the element. It seems to me that assigning...
2013 Oct 02
0
[LLVMdev] ScalarEvolution::createNodeForPHI
...----------------------------// > if (const AddOperator *OBO = dyn_cast<AddOperator>(BEValueV)) { > if (OBO->hasNoUnsignedWrap()) > Flags = setFlags(Flags, SCEV::FlagNUW); > if (OBO->hasNoSignedWrap()) > Flags = setFlags(Flags, SCEV::FlagNSW); > } else if (const GEPOperator *GEP = > dyn_cast<GEPOperator>(BEValueV)) { > // If the increment is an inbounds GEP, then we know the address > // space cannot be wrapped around. We cannot make any guarantee > // about signed or unsigned overflow because pointers are > // unsigned but we may...
2019 Mar 09
2
Cast a function parameter to GEP
Hi all, I'm still working on the Interpreter class and I would like to understand why an operand cannot be cast to GetElementPtrInst. My code is something like: void MyInterpreter::visitCallInst(CallInst& I) { for(int i = 0; i < I.getNumArgOperands(); i++) { operand = I.getOperand(i); if(GetElementPtrInst* CI = dyn_cast<GetElementPtrInst>(operand)) {
2013 Oct 02
1
[LLVMdev] ScalarEvolution::createNodeForPHI
...> > if (const AddOperator *OBO = dyn_cast<AddOperator>(BEValueV)) { > > if (OBO->hasNoUnsignedWrap()) > > Flags = setFlags(Flags, SCEV::FlagNUW); > > if (OBO->hasNoSignedWrap()) > > Flags = setFlags(Flags, SCEV::FlagNSW); > > } else if (const GEPOperator *GEP = > > dyn_cast<GEPOperator>(BEValueV)) { > > // If the increment is an inbounds GEP, then we know the address > > // space cannot be wrapped around. We cannot make any guarantee > > // about signed or unsigned overflow because pointers are > >...
2013 Feb 05
3
[LLVMdev] Vectorizing global struct pointers
...oo.cl and the write to Foo.al, so why is GetUnderlyingObjects() returning the same objects/pointers? > > > > A quick look at it revealed me the problem: > > > > llvm::GetUnderlyingObject(Value *V, const DataLayout *TD, unsigned MaxLookup) yields: > > > > -> GEPOperator *GEP = dyn_cast<GEPOperator>(V) > > -> V = GEP->getPointerOperand(); > > -> GlobalAlias *GA = dyn_cast<GlobalAlias>(V) > > -> V = GA->getAliasee(); > > return V; > > > > In this case, V is a reference to the structure, not the element....