Displaying 20 results from an estimated 6000 matches similar to: "[LLVMdev] Dereferencing null pointers"
2014 Dec 11
2
[LLVMdev] Dereferencing null pointers
Sorry for the confusion, I pasted the code I fixed locally...
Here is the code at top of the trunk:
// load (select (cond, null, P)) -> load P
if (Constant *C = dyn_cast<Constant>(SI->getOperand(1)))
if (C->isNullValue()) {
LI.setOperand(0, SI->getOperand(2));
return &LI;
}
So it is a bug?
-----Original Message-----
From:
2018 Aug 07
2
Error Calling eraseFromParent()
Hi.
This is part of my code:
...
if (auto* op = dyn_cast<BinaryOperator>(&I)) {
Value* lhs = op->getOperand(0);
Value* rhs = op->getOperand(1);
Value* mul = builder.CreateMul(lhs, rhs);
for (auto& U : op->uses()) {
User* user = U.getUser();
user->setOperand(U.getOperandNo(), mul);
}
I.eraseFromParent();
}
...
This leads to the following
2014 Dec 09
2
[LLVMdev] Question on equivalence of pointer types
> On Dec 8, 2014, at 5:12 PM, Sanjoy Das <sanjoy at playingwithpointers.com> wrote:
>
> Partially answering my own question, in general these are not
> equivalent because LLVM allows for pointers in different address
> spaces to have different sizes. However, are they equivalent if
> pointers in addrspace(1) have the same size as pointers in
> addrspace(0)?
>
>
2018 Aug 07
2
Error Calling eraseFromParent()
The code is really simple. But I can not the reason for the segmentation
fault. I only know that the eraseFromParent() function leads to it. The
whole code is:
...
bool runOnFunction(Function &F) override {
for (auto &I : instructions(F)) {
if (auto* op = dyn_cast<BinaryOperator>(&I)) {
IRBuilder<> builder(op);
Value* lhs = op->getOperand(0);
Value* rhs =
2014 Dec 05
3
[LLVMdev] Question on equivalence of pointer types
Is copy.0 semantically equivalent to copy.1 in the following example?
define void @copy.0(i8 addrspace(1)* addrspace(1)* %src, i8
addrspace(1)* addrspace(1)* %dst) {
entry:
%val = load i8 addrspace(1)* addrspace(1)* %src
store i8 addrspace(1)* %val, i8 addrspace(1)* addrspace(1)* %dst
ret void
}
define void @copy.1(i8 addrspace(1)* addrspace(1)* %src, i8
addrspace(1)* addrspace(1)* %dst)
2012 May 09
4
[LLVMdev] How can I get the destination operand of an instruction?
I am able to access the source operands of an instruction using either
getOperand() or op_iterator, However, I can't find any method available for
destination operand. Someone suggests that instruction itself can represent
the destination operand.
http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-January/037518.html
The getOperand() returns an unsigned value like 0x9063498, while I can't
2009 May 21
3
[LLVMdev] Passing a pointer to a function
I recently began hacking around with my first LLVM pass. The big
picture is that I would like to insert function calls for each
instruction type, and pass some parameters based on the instruction
type. Then I will link the output to some C file that implements those
functions.
Things were going well until I started trying to make function calls
with a pointer as a parameter. For example, I would
2018 Aug 08
2
Error Calling eraseFromParent()
Hi. Thanks. I changed the code but the problem exists. This is my new code
which is again very simple:
...
bool runOnFunction(Function &F) override {
vector<Instruction *> dels;
dels.clear();
for (inst_iterator It = inst_begin(&F), Ie = inst_end(&F); It != Ie;) {
Instruction *I = &*(It++);
if (auto* op = dyn_cast<BinaryOperator>(I)) {
IRBuilder<NoFolder>
2018 Aug 08
3
Error Calling eraseFromParent()
LLVM is built in Release mode. The version is 6.0.0. I think that a similar
code worked on verison 3.9.0. It is probably a null pointer dereference
occurring in eraseFromParent(). I checked and reconfirmed that the
instruction had no uses. Perhaps I should rebuild LLVM. Thanks.
On Wed, Aug 8, 2018 at 9:03 PM, mayuyu.io <admin at mayuyu.io> wrote:
> Hmmmm that’s strange. Do you get an
2018 Aug 07
2
Error Calling eraseFromParent()
Thanks Bjorn! But The problem is still there.
On Wed, Aug 8, 2018 at 2:04 AM, Björn Pettersson A <
bjorn.a.pettersson at ericsson.com> wrote:
> It looks quite dangerous to erase the instruction I inside the loop when
> iterating over all instructions in the function.
> I guess it depends on how the range based iterator is implemented if that
> works or not.
>
> I think
2009 Mar 31
2
[LLVMdev] Mutating the elements of a ConstantArray
Hello,
I need to append something to the global "llvm.global_ctors". This
variable may or may not already be declared within the current module.
If I lookup the global variable, I see that it supports a
getOperand(i) and setOperand(i,c), but does not support any way that I
can enlarge that array to add a new record.
Any suggestions?
--
Nick Johnson
2020 Feb 13
3
setOperands(int, Value*)
Hello,
I am trying to reset the operands of instructions. What I am doing is, I am
finding all Uses of a specific operand in an Instruction and resetting it
with a new value using "setOperands(int, Value*)". I am doing as:
for (auto vmitr=vm.begin(), vsitr=vs.begin(); vmitr!=vm.end() &&
vsitr!=vs.end(); vmitr++, vsitr++){
// I have two *Value ( operands)
for ( auto myitr
2013 Nov 07
2
[LLVMdev] Should remove calling NULL pointer or not
Hi John,
It seems the dereferencing a NULL pointer is undefined behavior but
Calling a function through a null pointer seems o.k.
If so , for this place, we need comment out the check.
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#232
look at Notes from the October 2003 meeting.
Yin
From: John Criswell [mailto:criswell at illinois.edu]
Sent: Wednesday,
2012 May 09
0
[LLVMdev] How can I get the destination operand of an instruction?
Launcher <st.liucheng at gmail.com> writes:
> I am able to access the source operands of an instruction using either
> getOperand() or op_iterator, However, I can't find any method available for
> destination operand. Someone suggests that instruction itself can represent
> the destination operand.
> http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-January/037518.html
2010 Jun 30
4
[LLVMdev] [HEADSUP] Another attempt at CallInst operand rotation
Hi all,
I am almost ready for the last step with landing my long-standing patch.
I have converted (almost) all low-level interface users of CallInst to
respective high-level interfaces. What remains is a handful of hunks
to flip the switch.
But before I do the final commit I'd like to coerce all external users
to code against the high-level interface too. This will (almost, but
see below)
2005 Jul 28
2
[LLVMdev] help with pointer-to-array conversion
I now understand that IndVarSimplify.cpp is capable of reproducing array
references when the pointer initialization from the array address is found
inside the immediately enclosing loop, such that in the following code:
int A[20000], B[100], Z;
int main()
{
int i, j, *a, *b;
for ( a = &A[0], i = 0; i != 200; i++ )
for ( b = &B[0], j = 0; j != 100; j++
2018 Feb 06
1
6 separate instances of static getPointerOperand(). Time to consolidate?
What LoopVectorize.cpp has are the following. Each function may have to have a separate consolidation discussion.
I'm bringing up getpointerOperand() since I actually found multiple instances defined/used.
DependenceAnalysis.cpp has isLoadOrStore(). LoopAccessAnalysis.cpp has getAddressSpaceOperand().
I'm sure there are others that might be worth discussing within this thread or a follow
2009 Nov 06
2
[LLVMdev] BasicAliasAnalysis: Null pointers do not alias with anything
Dan Gohman wrote:
> 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
2018 Feb 06
0
6 separate instances of static getPointerOperand(). Time to consolidate?
"Saito, Hideki via llvm-dev" <llvm-dev at lists.llvm.org> writes:
> LLVM friends,
>
> I'm currently trying to make LoopVectorizationLegality class in
> Transform/Vectorize/LoopVectorize.cpp more modular and eventually move
> it to Analysis directory tree. It uses several file scope helper
> functions that do not really belong to LoopVectorize. Let me start
2013 Nov 07
4
[LLVMdev] Should remove calling NULL pointer or not
Hi,
For a small case, that calls NULL pointer function. LLVM explicitly converts
It to a store because it thinks it is not reachable 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.