Artur Pietrek
2009-Apr-06 14:01 UTC
[LLVMdev] Patch: MSIL backend global pointers initialization
Hi Anton, Anton Korobeynikov wrote:> Minor comments: >Thanks for your comments and your patience, I'll now check the style four times before I send anything ;)>> + Instruction *instr >> + const_cast<Instruction*>(dynamic_cast<const >> Instruction*>(*i)); >> > Sounds hacky. Why do you need to cast away const? Maybe you just need > use_iterator instead? >Ok, I've fixed this. I didn't attached the new patch because I found a bug in my code - in special cases I get doubled declarations. If I have two instructions like those: %1 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr ([16 x i8]* @.str, i32 0, i32 0), i32 %0) nounwind %10 = call i32 (i8*, ...)* @printf(i8* noalias getelementptr ([11 x i8]* @.str2, i32 0, i32 0), i32 5) nounwind Instruction::isSameOperationAs() returns false for those two. Is it a bug or I misunderstood something? In any case I wrote my custom isSame() operator for this but I'll appreciate any hints. Thanks! Artur
Anton Korobeynikov
2009-Apr-07 12:53 UTC
[LLVMdev] Patch: MSIL backend global pointers initialization
Hi, Artur> %1 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr ([16 x > i8]* @.str, i32 0, i32 0), i32 %0) nounwind > %10 = call i32 (i8*, ...)* @printf(i8* noalias getelementptr ([11 x i8]* > @.str2, i32 0, i32 0), i32 5) nounwind > > Instruction::isSameOperationAs() returns false for those two. Is it a > bug or I misunderstood something?These are two different instructions as you might see, thus - no bug :)> In any case I wrote my custom isSame() operator for this but I'll > appreciate any hints.Why do you need this? Won't be enough just to compare function types? -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
Artur Pietrek
2009-Apr-07 13:17 UTC
[LLVMdev] Patch: MSIL backend global pointers initialization
Hello Anton> %1 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr ([16 x > > i8]* @.str, i32 0, i32 0), i32 %0) nounwind > > %10 = call i32 (i8*, ...)* @printf(i8* noalias getelementptr ([11 x i8]* > > @.str2, i32 0, i32 0), i32 5) nounwind > > > > Instruction::isSameOperationAs() returns false for those two. Is it a > > bug or I misunderstood something? > These are two different instructions as you might see, thus - no bug :)OK, I just need the same signature for both of those instructions.> > > In any case I wrote my custom isSame() operator for this but I'll > > appreciate any hints. > Why do you need this? Won't be enough just to compare function types?I do something like this: static bool areSame(Instruction *A, Instruction *B) { if (A->getOpcode() != B->getOpcode()) return false; if (A->getType()->getTypeID() != B->getType()->getTypeID()) return false; unsigned int a = A->getNumOperands(); if (a != B->getNumOperands()) return false; for (unsigned int i = 0; i < a; ++i) if (A->getOperand(i)->getType()->getTypeID() != B->getOperand(i)->getType()->getTypeID()) return false; return true; } I'm not sure if it's too much. Thanks! Artur P.S. Sorry for that [Junk...] in few mails. It's our "great" antispammer, I will switch to gmail. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090407/becbfa88/attachment.html>
Possibly Parallel Threads
- [LLVMdev] Patch: MSIL backend global pointers initialization
- [LLVMdev] Patch: MSIL backend global pointers initialization
- [LLVMdev] Patch: MSIL backend global pointers initialization
- [LLVMdev] Patch: MSIL backend global pointers initialization
- [LLVMdev] Patch: MSIL backend global pointers initialization