Displaying 20 results from an estimated 108 matches for "undefvalue".
2013 Apr 02
1
[LLVMdev] cyclical dependence between caller and callee in JIT
2013/3/27 Nick Lewycky <nicholas at mxc.ca>:
>The common idiom to delete any Value* is:
>
> V->replaceAllUsesWith(UndefValue::get(V->getType());
> V->eraseFromParent();
>
> Does that work for functions? You may need to make sure the 'undef' has a
> pointer to function type instead of the function type.
>
I tried this code sample, passing the type returned by
llvm::Function::getType(), but i...
2010 Jul 06
2
[LLVMdev] ConstantFold 'undef xor undef'
Hi,
At line 2292, lib/VMCore/ConstantFold.cpp (llvm2.7 release)
Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
Constant *C1, Constant *C2) {
...
// Handle UndefValue up front.
if (isa<UndefValue>(C1) || isa<UndefValue>(C2)) {
switch (Opcode) {
case Instruction::Xor:
if (isa<UndefValue>(C1) && isa<UndefValue>(C2))
// Handle undef ^ undef -> 0 special case. This is a common
// idiom (misuse)....
2012 Apr 21
0
[LLVMdev] Remove function from module
......
> }
> int f2 (int y) {
> ...
> b = f1(smth);
> ...
> }
>
> I need delete from module both f1 and f2. They haven't uses in other
> part of module, but I can't delete them with eraseFromParent, because
> they are use each other.
Call X->replaceAllUsesWith(UndefValue::get(X->getType)) before calling
X->eraseFromParent().
Nick
2012 Apr 21
3
[LLVMdev] Remove function from module
How correctly remove function from module?
For example:
int f1(int x) {
...
a = f2(smth);
...
}
int f2 (int y) {
...
b = f1(smth);
...
}
I need delete from module both f1 and f2. They haven't uses in other part of module, but I can't delete them with eraseFromParent, because they are use each other.
Yours sincerely,
Kadysev Mikhail
-------------- next part
2020 Jun 17
2
InstCombine doesn't delete instructions with token
...while (EndInst != BB->begin()) {
// Delete the next to last instruction.
Instruction *Inst = &*--EndInst->getIterator();
- if (!Inst->use_empty())
+ if (!Inst->use_empty() && !Inst->getType()->isTokenTy())
Inst->replaceAllUsesWith(UndefValue::get(Inst->getType()));
- if (Inst->isEHPad()) {
+ if (Inst->isEHPad() || Inst->getType()->isTokenTy()) {
EndInst = Inst;
@@ -3022,7 +3022,8 @@ static bool prepareICWorklistFromFunction(Function
&F, const DataLayout &DL,
++NumDeadInst;
Mad...
2006 Mar 15
0
[LLVMdev] RE: Port to Solaris' Sun Studio 8
...e linked with line 364 in LoadValueNumbering.cpp,
The error above suggests that "isa<AllocationInst>(whatever)" was invoked,
and in current CVS, the only use of AllocationInst in
LoadValueNumbering.cpp is on line 305:
if (isa<AllocationInst>(I))
RetVals.push_back(UndefValue::get(LI->getType()));
I think changing this to
if (isa<AllocationInst>(*I))
RetVals.push_back(UndefValue::get(LI->getType()));
should work, and be more robust anyway then relying on implicit
interator->value conversion anyway. If you'd want to debug this, try
compi...
2008 Apr 04
2
[LLVMdev] InstCombine Question
...== 0) {
09794 // Insert a new store to null instruction before the load to
indicate
09795 // that this code is not reachable. We do this instead of
inserting
09796 // an unreachable instruction directly because we cannot modify
the
09797 // CFG.
09798 new StoreInst(UndefValue::get(LI.getType()),
09799 Constant::getNullValue(Op->getType()), &LI);
09800 return ReplaceInstUsesWith(LI, UndefValue::get(LI.getType()));
09801 }
09802 }
First, what happens to the StoreInst? It looks like it is not attached
anywhere.
Second, I am seein...
2006 Mar 14
2
[LLVMdev] Port to Solaris' Sun Studio 8
Well, line 364 wasn't actually what was holding me up, so it's a bad
example, but the problem's still relevant. Using cast<...>(iter),
dyn_cast<...>(iter), or isa<...>(iter) results in the error messages
mentioned below.
________________________________
When compiling LoadValueNumbering.cpp, I get the following errors:
2012 Apr 21
4
[LLVMdev] Remove function from module
.....
>> b = f1(smth);
>> ...
>> }
>>
>> I need delete from module both f1 and f2. They haven't uses in other
>> part of module, but I can't delete them with eraseFromParent, because
>> they are use each other.
>
> Call X->replaceAllUsesWith(UndefValue::get(X->getType)) before calling X->eraseFromParent().
>
> Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120422/a1ef5335/attachment.html>
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.
So we need remove the case if (isa<ConstantPointerNull>(...
2020 May 07
2
Cast between struct
> On May 6, 2020, at 21:53, Krzysztof Parzyszek <kparzysz at quicinc.com> wrote:
>
> You can
> 1. extract individual elements of {i8*, i64},
> 2. bitcast the first to some_struct*,
> 3. insert them into a new struct of type {some_struct*, i64}.
Thanks for the help. I’m thinking the same way. Now I’m stuck with
how to create a struct; I know how to create a
2020 Jun 17
2
InstCombine doesn't delete instructions with token
...gt;begin()) {
> // Delete the next to last instruction.
> Instruction *Inst = &*--EndInst->getIterator();
> - if (!Inst->use_empty())
> + if (!Inst->use_empty() && !Inst->getType()->isTokenTy())
> Inst->replaceAllUsesWith(UndefValue::get(Inst->getType()));
> - if (Inst->isEHPad()) {
>
> + if (Inst->isEHPad() || Inst->getType()->isTokenTy()) {
> EndInst = Inst;
> @@ -3022,7 +3022,8 @@ static bool prepareICWorklistFromFunction(Function
> &F, const DataLayout &DL,
>...
2015 Apr 16
3
[LLVMdev] double* to <2 x double>*
...<2 x double>*
%2 = load <2 x double>* %1, align 4
what I right now doing is:
*Assume pInst is *%1 = load double* %arrayidx1, align 4, !tbaa !0
Value *loadValue = pInst->getOperand(0);
Type *vecTy = VectorType::get(Type::getDoublePtrTy(currF->getContext()), 2);
Value *emptyVec = UndefValue::get(vecTy);
Type* u32Ty = Type::getInt32Ty(currF->getContext());
Value *index0 = ConstantInt::get(u32Ty, 0);
Value *index1 = ConstantInt::get(u32Ty, 1);
Instruction *InsertVal = InsertElementInst::Create(emptyVec, loadValue,
index0, "");
InsertVal = InsertElementInst::Create(emptyV...
2016 Dec 31
0
SCCP is not always correct in presence of undef (+ proposed fix)
...908,18 @@ void SCCPSolver::visitBinaryOperator(Instruction &I) {
}
// If something is undef, wait for it to resolve.
- if (!V1State.isOverdefined() && !V2State.isOverdefined())
- return;
+ if (!V1State.isOverdefined() && !V2State.isOverdefined()) {
+ Constant *L = UndefValue::get(I.getOperand(0)->getType());
+ if (V1State.isConstant())
+ L = V1State.getConstant();
+ Constant *R = UndefValue::get(I.getOperand(0)->getType());
+ if (V2State.isConstant())
+ R = V2State.getConstant();
+ Constant *C = ConstantExpr::get(I.getOpcode(), L, R);
+ i...
2014 Dec 09
2
[LLVMdev] Question on equivalence of pointer types
...GEPI->getPointerAddressSpace() == 0){
// Insert a new store to null instruction before the load to indicate
// that this code is not reachable. We do this instead of inserting
// an unreachable instruction directly because we cannot modify the
// CFG.
new StoreInst(UndefValue::get(LI.getType()),
Constant::getNullValue(Op->getType()), &LI);
return ReplaceInstUsesWith(LI, UndefValue::get(LI.getType()));
}
}
>
> Thanks,
> -- Sanjoy
>
> On Thu, Dec 4, 2014 at 10:09 PM, Sanjoy Das
> <sanjoy at playingwithpointers....
2012 Apr 22
2
[LLVMdev] Remove function from module
...}
>>>>
>>>> I need delete from module both f1 and f2. They haven't uses in other
>>>> part of module, but I can't delete them with eraseFromParent, because
>>>> they are use each other.
>>>
>>> Call X->replaceAllUsesWith(UndefValue::get(X->getType)) before calling
>>> X->eraseFromParent().
>>>
>>> Nick
>>
>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>...
2006 May 10
2
[LLVMdev] SCCP
Chris Lattner wrote:
> On Wed, 10 May 2006, Nick Lewycky wrote:
>
>>> Then just run the SCCP pass, and check to see if any operands satisfy
>>> the predicate "isa<UndefValue>(V)". LLVM explicitly represents
>>> undefined values.
>>
>>
>> I have a case where it doesn't, but perhaps the SCCP pass isn't to blame:
>>
>> extern void write_char(int);
>>
>> const char foo[4] = "foo";
>>
>...
2016 Dec 31
4
SCCP is not always correct in presence of undef (+ proposed fix)
...naryOperator(Instruction &I) {
> }
>
> // If something is undef, wait for it to resolve.
> - if (!V1State.isOverdefined() && !V2State.isOverdefined())
> - return;
> + if (!V1State.isOverdefined() && !V2State.isOverdefined()) {
> + Constant *L = UndefValue::get(I.getOperand(0)->getType());
> + if (V1State.isConstant())
> + L = V1State.getConstant();
> + Constant *R = UndefValue::get(I.getOperand(0)->getType());
> + if (V2State.isConstant())
> + R = V2State.getConstant();
> + Constant *C = ConstantExpr::ge...
2020 Jun 17
2
InstCombine doesn't delete instructions with token
...gt;begin()) {
> // Delete the next to last instruction.
> Instruction *Inst = &*--EndInst->getIterator();
> - if (!Inst->use_empty())
> + if (!Inst->use_empty() && !Inst->getType()->isTokenTy())
> Inst->replaceAllUsesWith(UndefValue::get(Inst->getType()));
> - if (Inst->isEHPad()) {
>
> + if (Inst->isEHPad() || Inst->getType()->isTokenTy()) {
> EndInst = Inst;
> @@ -3022,7 +3022,8 @@ static bool prepareICWorklistFromFunction(Function
> &F, const DataLayout &DL,
>...
2013 May 31
2
[LLVMdev] Dead Code Elimination and undef values
...e resulting code after my pass. I just have some questions about
LLVM's dce implementation.
Well, my transformation is a function pass, and, after the changes are
made, some instructions are not needed anymore. In order to easily get rid
of those instructions, I'm setting all their uses to UndefValue. This is
necessary because some of the instructions I want to erase are inside
loops, and, therefore, there might be a circular dependence between the
instruction I want to delete and a PHINode, for example, when both of them
are not useful anymore.
Ok, the problem is: I've always had explicit...