Displaying 20 results from an estimated 6000 matches similar to: "[LLVMdev] converting an unconditional into a conditional branch"
2011 Jan 03
1
[LLVMdev] Erasing dead blocks
Dear LLVM developers,
I have a question regarding the IPSCCP class and the handling of dead blocks:
The file lib/Transforms/Scalar/SCCP.cpp of llvm 2.8 from contains some
code to deal with a dead block which could not be folded (line
1909ff). This happens when a user of this dead block is a branch or
switch with an undef condition. The action taken than is to replace
this terminator with an
2017 Jul 25
2
[Debug] Elide the unconditional branch instructions
This email is related with the code of commit: http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20120409/140650.html. This commit will let our unconditional branch instruction not be deleted when its successor is the nature layout and its basic block's instruction only one instruction.
However, I have some concerns about it, especially in the debug mode. Let me show you some
2015 Jun 12
2
[LLVMdev] How to insert basic block in a loop
Dear All
I'm making a transformation pass that inserts a new basic block at the start of a loop. However when I try to change predecessor/successor relations, it does not consider the new block in the loop at all. So I got that just inserting a loop in a function before another loop is not enough. So how exactly to do this job?
Regards,
Marwa Yusuf
Teaching Assistant - Computer Engineering
2015 Mar 18
5
[LLVMdev] casting Constant * to value *?
John, you are right.
I 'browsed' the doxygen's inheritance diagram.
Shouldn't I then be able to cast Constant * to Value*?
Plugging the retrieved Constant* (from ConstantExpr::getGetElementPtr)
into Instruction->setOperand compiles, but gives me an assertion failure at
runtime.
I have no access to the code at the moment. I will gather more information
possibly tomorrow.
2020 Mar 21
3
Multi-Threading Compilers
> On Mar 20, 2020, at 12:34 PM, Nicholas Krause <xerofoify at gmail.com> wrote:
>
>>
>> The problem isn’t constants or functions themselves, it is that they are instances of llvm::Value. Everything that walks a use/def list would have to run code that checks for this, and every call to inst->setOperand() would have to do locking or conditional locking. This would be
2020 Mar 20
2
Multi-Threading Compilers
> On Mar 19, 2020, at 2:31 PM, Johannes Doerfert <johannesdoerfert at gmail.com> wrote:
>
> I think addressing this issue first makes sense. I would however start
> by determining the actual impact of different design choices here. I
> mean, do we know locks will be heavily contented? If I had to guess I'd
> say most passes will not create or modify functions nor add
2009 Jun 08
1
[LLVMdev] Replacing unconditional branches with conditional ones
Hi all,
Somewhat of a newbie's question, hope you can help me out.
I'm trying to turn unconditional BranchInst's into conditional ones (with a condition I'm supplying) branching between the original target and a basic block of my choice.
Apparently the way to do that is to create a new conditional BranchInst and remove the unconditional one from its basic block. However when
2015 Mar 17
2
[LLVMdev] casting Constant * to value *?
Hi all,
extracting datafields of globals, the API code ends up in a Constant *
Constant* const_ptr_103 = ConstantExpr::getGetElementPtr(gvar_struct_foo,
const_ptr_103_indices);
it can be used to initialize e.g. a new instruction like:
StoreInst* void_119 = new StoreInst(const_float_102, const_ptr_103, false,
label_entry_113);
But how about replacing the operand of an already existing
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:
2014 Nov 06
2
[LLVMdev] Should the MachineVerifier accept a MBB with a single (landing pad) successor?
Hi all,
I've been investigating a machine verifier failure on the attached
testcase, and I'm tempted to say the verifier is wrong and should
accept it. Skip the description for the proposed change.
On AArch64, the verifier complains with:
*** Bad machine code: MBB exits via unconditional branch but
doesn't have exactly one CFG successor! ***
- function: t4
- basic
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 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 =
2011 Feb 01
0
[LLVMdev] Loop simplification
On Feb 1, 2011, at 1:08 PM, Andrew Clinton wrote:
> I have a (non-entry) basic block that contains only PHI nodes and an
> unconditional branch (that does not branch to itself). Is it always
> possible to merge this block with it's successor and produce a
> semantically equivalent program? I'm trying to undo some of the loop
> optimizations that LLVM has applied to my
2014 Dec 11
2
[LLVMdev] Dereferencing null pointers
Hi,
I would like to understand better the meaning of constant null pointer in LLVM IR.
Can the optimizer assume that dereferencing a null pointer is always unreachable? Or is it only the case for address space 0? Is it ok to have null pointer be a valid pointer for an address space other than 0?
In InstCombine pass in InstCombiner::visitLoadInst(LoadInst &LI) I see that we replace load of
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
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
2010 Jun 07
2
[LLVMdev] Modifing an operand of MDNode
I have a MDNode, and one of its operand is an int. I'd like to
assign a new int value to that operand during the llvm optimization.
What is the right way to do this ? (There is no setOperand() with
MDNode class.)
Junjie
2012 Jan 17
1
[LLVMdev] [LLVM] Modify ConstantArray object contents
Hi all. Is it allowed to modify ConstantArray object within setOperand
method, or it is better to leave old ConstantArray object and create new
one?
Thanks!
-Stepan.
2019 Sep 19
2
Type unmatched after replacing functions
Hi all,
I am trying to merge functions with the same debug location by
using replaceAllUsesWith().
However, this leads to type unmatched problems because the
functions with the same debug location can have different parameters.
An example is foo(struct A) can be compiled to foo.1(struct A.1) and
foo.2(struct A.2).
I have inserted CastInst to solve the problems of arguments and return
values type
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