From sabre at nondot.org Mon Jan 15 00:25:55 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Jan 2007 00:25:55 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/README.txt Message-ID: <200701150625.l0F6PtmK019671@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: README.txt updated: 1.151 -> 1.152 --- Log message: add some notes --- Diffs of the changes: (+68 -0) README.txt | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 68 insertions(+) Index: llvm/lib/Target/X86/README.txt diff -u llvm/lib/Target/X86/README.txt:1.151 llvm/lib/Target/X86/README.txt:1.152 --- llvm/lib/Target/X86/README.txt:1.151 Fri Jan 12 13:20:47 2007 +++ llvm/lib/Target/X86/README.txt Mon Jan 15 00:25:39 2007 @@ -762,3 +762,71 @@ We should inline lrintf and probably other libc functions. //===---------------------------------------------------------------------===// + +Start using the flags more. For example, compile: + +int add_zf(int *x, int y, int a, int b) { + if ((*x += y) == 0) + return a; + else + return b; +} + +to: + addl %esi, (%rdi) + movl %edx, %eax + cmovne %ecx, %eax + ret +instead of: + +_add_zf: + addl (%rdi), %esi + movl %esi, (%rdi) + testl %esi, %esi + cmove %edx, %ecx + movl %ecx, %eax + ret + +and: + +int add_zf(int *x, int y, int a, int b) { + if ((*x + y) < 0) + return a; + else + return b; +} + +to: + +add_zf: + addl (%rdi), %esi + movl %edx, %eax + cmovns %ecx, %eax + ret + +instead of: + +_add_zf: + addl (%rdi), %esi + testl %esi, %esi + cmovs %edx, %ecx + movl %ecx, %eax + ret + +//===---------------------------------------------------------------------===// + +This: +#include +int foo(double X) { return isnan(X); } + +compiles to (-m64): + +_foo: + pxor %xmm1, %xmm1 + ucomisd %xmm1, %xmm0 + setp %al + movzbl %al, %eax + ret + +the pxor is not needed, we could compare the value against itself. + From sabre at nondot.org Mon Jan 15 00:27:52 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Jan 2007 00:27:52 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/ConstantFolding.cpp Message-ID: <200701150627.l0F6Rq48019753@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: ConstantFolding.cpp updated: 1.9 -> 1.10 --- Log message: Constant fold llvm.powi.*. This speeds up tramp3d--v4 by 9.5% --- Diffs of the changes: (+12 -1) ConstantFolding.cpp | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletion(-) Index: llvm/lib/Analysis/ConstantFolding.cpp diff -u llvm/lib/Analysis/ConstantFolding.cpp:1.9 llvm/lib/Analysis/ConstantFolding.cpp:1.10 --- llvm/lib/Analysis/ConstantFolding.cpp:1.9 Sun Jan 7 02:19:47 2007 +++ llvm/lib/Analysis/ConstantFolding.cpp Mon Jan 15 00:27:37 2007 @@ -40,6 +40,8 @@ case Intrinsic::bswap_i16: case Intrinsic::bswap_i32: case Intrinsic::bswap_i64: + case Intrinsic::powi_f32: + case Intrinsic::powi_f64: // FIXME: these should be constant folded as well //case Intrinsic::ctpop_i8: //case Intrinsic::ctpop_i16: @@ -186,8 +188,17 @@ double V = fmod(Op1V, Op2V); if (errno == 0) return ConstantFP::get(Ty, V); - } else if (Name == "atan2") + } else if (Name == "atan2") { return ConstantFP::get(Ty, atan2(Op1V,Op2V)); + } + } else if (ConstantInt *Op2C = dyn_cast(Operands[1])) { + if (Name == "llvm.powi.f32") { + return ConstantFP::get(Ty, std::pow((float)Op1V, + (int)Op2C->getZExtValue())); + } else if (Name == "llvm.powi.f64") { + return ConstantFP::get(Ty, std::pow((double)Op1V, + (int)Op2C->getZExtValue())); + } } } } From sabre at nondot.org Mon Jan 15 00:51:40 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Jan 2007 00:51:40 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/alloca.ll Message-ID: <200701150651.l0F6peH4020147@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: alloca.ll updated: 1.2 -> 1.3 --- Log message: add a simple case where instcombine can detect and remove a dead alloca --- Diffs of the changes: (+13 -0) alloca.ll | 13 +++++++++++++ 1 files changed, 13 insertions(+) Index: llvm/test/Regression/Transforms/InstCombine/alloca.ll diff -u llvm/test/Regression/Transforms/InstCombine/alloca.ll:1.2 llvm/test/Regression/Transforms/InstCombine/alloca.ll:1.3 --- llvm/test/Regression/Transforms/InstCombine/alloca.ll:1.2 Fri Dec 1 22:23:09 2006 +++ llvm/test/Regression/Transforms/InstCombine/alloca.ll Mon Jan 15 00:51:25 2007 @@ -12,3 +12,16 @@ call void(...)* %use({}* %Z) ret void } + +void %test2() { + %A = alloca int ;; dead. + store int 123, int* %A + ret void +} + +void %test3() { + %A = alloca {int} ;; dead. + %B = getelementptr {int}* %A, int 0, uint 0 + store int 123, int* %B + ret void +} From sabre at nondot.org Mon Jan 15 00:52:12 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Jan 2007 00:52:12 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200701150652.l0F6qCTB020168@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.597 -> 1.598 --- Log message: delete stores to allocas with one use. This is a trivial form of DSE which often kicks in for ?: expressions. --- Diffs of the changes: (+18 -0) InstructionCombining.cpp | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.597 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.598 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.597 Sun Jan 14 20:27:26 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Jan 15 00:51:56 2007 @@ -8237,6 +8237,24 @@ ++NumCombined; return 0; } + + // If the RHS is an alloca with a single use, zapify the store, making the + // alloca dead. + if (Ptr->hasOneUse()) { + if (isa(Ptr)) { + EraseInstFromFunction(SI); + ++NumCombined; + return 0; + } + + if (GetElementPtrInst *GEP = dyn_cast(Ptr)) + if (isa(GEP->getOperand(0)) && + GEP->getOperand(0)->hasOneUse()) { + EraseInstFromFunction(SI); + ++NumCombined; + return 0; + } + } // Do really simple DSE, to catch cases where there are several consequtive // stores to the same location, separated by a few arithmetic operations. This From sabre at nondot.org Mon Jan 15 01:03:10 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Jan 2007 01:03:10 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200701150703.l0F73A4b020365@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.598 -> 1.599 --- Log message: simplify some code now that types are signless --- Diffs of the changes: (+12 -46) InstructionCombining.cpp | 58 +++++++++-------------------------------------- 1 files changed, 12 insertions(+), 46 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.598 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.599 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.598 Mon Jan 15 00:51:56 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Jan 15 01:02:54 2007 @@ -1927,21 +1927,6 @@ return (CI->getZExtValue() & (~0ULL >> (64-NumBits))) == (1ULL << (NumBits-1)); } -/// RemoveNoopCast - Strip off nonconverting casts from the value. -/// -static Value *RemoveNoopCast(Value *V) { - if (CastInst *CI = dyn_cast(V)) { - const Type *CTy = CI->getType(); - const Type *OpTy = CI->getOperand(0)->getType(); - if (CTy->isInteger() && OpTy->isInteger()) { - if (CTy->getPrimitiveSizeInBits() == OpTy->getPrimitiveSizeInBits()) - return RemoveNoopCast(CI->getOperand(0)); - } else if (isa(CTy) && isa(OpTy)) - return RemoveNoopCast(CI->getOperand(0)); - } - return V; -} - Instruction *InstCombiner::visitSub(BinaryOperator &I) { Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); @@ -1967,21 +1952,17 @@ if (match(Op1, m_Not(m_Value(X)))) return BinaryOperator::createAdd(X, ConstantExpr::getAdd(C, ConstantInt::get(I.getType(), 1))); - // -((uint)X >> 31) -> ((int)X >> 31) - // -((int)X >> 31) -> ((uint)X >> 31) + // -(X >>u 31) -> (X >>s 31) + // -(X >>s 31) -> (X >>u 31) if (C->isNullValue()) { - Value *NoopCastedRHS = RemoveNoopCast(Op1); - if (ShiftInst *SI = dyn_cast(NoopCastedRHS)) + if (ShiftInst *SI = dyn_cast(Op1)) if (SI->getOpcode() == Instruction::LShr) { if (ConstantInt *CU = dyn_cast(SI->getOperand(1))) { // Check to see if we are shifting out everything but the sign bit. if (CU->getZExtValue() == SI->getType()->getPrimitiveSizeInBits()-1) { // Ok, the transformation is safe. Insert AShr. - // FIXME: Once integer types are signless, this cast should be - // removed. - Value *ShiftOp = SI->getOperand(0); - return new ShiftInst(Instruction::AShr, ShiftOp, CU, + return new ShiftInst(Instruction::AShr, SI->getOperand(0), CU, SI->getName()); } } @@ -1991,7 +1972,6 @@ // Check to see if we are shifting out everything but the sign bit. if (CU->getZExtValue() == SI->getType()->getPrimitiveSizeInBits()-1) { - // Ok, the transformation is safe. Insert LShr. return new ShiftInst(Instruction::LShr, SI->getOperand(0), CU, SI->getName()); @@ -7664,28 +7644,14 @@ for (unsigned i = 1, e = GEP.getNumOperands(); i != e; ++i, ++GTI) if (isa(*GTI)) { if (CastInst *CI = dyn_cast(GEP.getOperand(i))) { - Value *Src = CI->getOperand(0); - const Type *SrcTy = Src->getType(); - const Type *DestTy = CI->getType(); - if (Src->getType()->isInteger()) { - if (SrcTy->getPrimitiveSizeInBits() == - DestTy->getPrimitiveSizeInBits()) { - // We can always eliminate a cast from ulong or long to the other. - // We can always eliminate a cast from uint to int or the other on - // 32-bit pointer platforms. - if (DestTy->getPrimitiveSizeInBits() >= TD->getPointerSizeInBits()){ - MadeChange = true; - GEP.setOperand(i, Src); - } - } else if (SrcTy->getPrimitiveSizeInBits() < - DestTy->getPrimitiveSizeInBits() && - SrcTy->getPrimitiveSizeInBits() == 32) { - // We can eliminate a cast from [u]int to [u]long iff the target - // is a 32-bit pointer target. - if (SrcTy->getPrimitiveSizeInBits() >= TD->getPointerSizeInBits()) { - MadeChange = true; - GEP.setOperand(i, Src); - } + if (CI->getOpcode() == Instruction::ZExt || + CI->getOpcode() == Instruction::SExt) { + const Type *SrcTy = CI->getOperand(0)->getType(); + // We can eliminate a cast from i32 to i64 iff the target + // is a 32-bit pointer target. + if (SrcTy->getPrimitiveSizeInBits() >= TD->getPointerSizeInBits()) { + MadeChange = true; + GEP.setOperand(i, CI->getOperand(0)); } } } From sabre at nondot.org Mon Jan 15 01:29:44 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Jan 2007 01:29:44 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/phi.ll Message-ID: <200701150729.l0F7Ti9k020785@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: phi.ll updated: 1.14 -> 1.15 --- Log message: new testcase --- Diffs of the changes: (+12 -0) phi.ll | 12 ++++++++++++ 1 files changed, 12 insertions(+) Index: llvm/test/Regression/Transforms/InstCombine/phi.ll diff -u llvm/test/Regression/Transforms/InstCombine/phi.ll:1.14 llvm/test/Regression/Transforms/InstCombine/phi.ll:1.15 --- llvm/test/Regression/Transforms/InstCombine/phi.ll:1.14 Fri Dec 1 22:23:09 2006 +++ llvm/test/Regression/Transforms/InstCombine/phi.ll Mon Jan 15 01:29:29 2007 @@ -1,6 +1,7 @@ ; This test makes sure that these instructions are properly eliminated. ; +; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output && ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep phi implementation @@ -65,3 +66,14 @@ ret uint %B } +int %test7(int %A, bool %b) { +BB0: br label %Loop + +Loop: + %B = phi int [%A, %BB0], [%C, %Loop] ; PHI is dead. + %C = add int %B, 123 + br bool %b, label %Loop, label %Exit +Exit: + ret int 0 +} + From sabre at nondot.org Mon Jan 15 01:30:21 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Jan 2007 01:30:21 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200701150730.l0F7UL5G020813@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.599 -> 1.600 --- Log message: Implement InstCombine/phi.ll:test7, deletion of trivial value loops for induction variables. --- Diffs of the changes: (+16 -2) InstructionCombining.cpp | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.599 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.600 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.599 Mon Jan 15 01:02:54 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Jan 15 01:30:06 2007 @@ -7595,13 +7595,27 @@ // If this is a trivial cycle in the PHI node graph, remove it. Basically, if // this PHI only has a single use (a PHI), and if that PHI only has one use (a // PHI)... break the cycle. - if (PN.hasOneUse()) - if (PHINode *PU = dyn_cast(PN.use_back())) { + if (PN.hasOneUse()) { + Instruction *PHIUser = cast(PN.use_back()); + if (PHINode *PU = dyn_cast(PHIUser)) { std::set PotentiallyDeadPHIs; PotentiallyDeadPHIs.insert(&PN); if (DeadPHICycle(PU, PotentiallyDeadPHIs)) return ReplaceInstUsesWith(PN, UndefValue::get(PN.getType())); } + + // If this phi has a single use, and if that use just computes a value for + // the next iteration of a loop, delete the phi. This occurs with unused + // induction variables, e.g. "for (int j = 0; ; ++j);". Detecting this + // common case here is good because the only other things that catch this + // are induction variable analysis (sometimes) and ADCE, which is only run + // late. + if (PHIUser->hasOneUse() && + (isa(PHIUser) || isa(PHIUser)) && + PHIUser->use_back() == &PN) { + return ReplaceInstUsesWith(PN, UndefValue::get(PN.getType())); + } + } return 0; } From sabre at nondot.org Mon Jan 15 01:42:06 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Jan 2007 01:42:06 -0600 Subject: [llvm-commits] CVS: llvm/tools/gccas/gccas.cpp Message-ID: <200701150742.l0F7g65Z021028@zion.cs.uiuc.edu> Changes in directory llvm/tools/gccas: gccas.cpp updated: 1.123 -> 1.124 --- Log message: Run an instcombine pass after inlining but before scalarrepl. This allows instcombine to clean up the code, which makes more code suitable for SRoA. This helps C++ code in particular, e.g. speeding up tramp3d by 31%. --- Diffs of the changes: (+1 -0) gccas.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/tools/gccas/gccas.cpp diff -u llvm/tools/gccas/gccas.cpp:1.123 llvm/tools/gccas/gccas.cpp:1.124 --- llvm/tools/gccas/gccas.cpp:1.123 Wed Dec 6 19:30:31 2006 +++ llvm/tools/gccas/gccas.cpp Mon Jan 15 01:41:51 2007 @@ -102,6 +102,7 @@ addPass(PM, createRaisePointerReferencesPass());// Recover type information addPass(PM, createTailDuplicationPass()); // Simplify cfg by copying code + addPass(PM, createInstructionCombiningPass()); // Cleanup for scalarrepl. addPass(PM, createCFGSimplificationPass()); // Merge & remove BBs addPass(PM, createScalarReplAggregatesPass()); // Break up aggregate allocas addPass(PM, createInstructionCombiningPass()); // Combine silly seq's From clattner at apple.com Mon Jan 15 01:42:40 2007 From: clattner at apple.com (Chris Lattner) Date: Sun, 14 Jan 2007 23:42:40 -0800 Subject: [llvm-commits] match gccas pass ordering change Message-ID: <2A9EE0C7-C9A5-456A-B5F0-E102AB731A72@apple.com> Run an instcombine pass after inlining but before scalarrepl. This allows instcombine to clean up the code, which makes more code suitable for SRoA.This helps C++ code in particular, e.g. speeding up tramp3d by 31%. Index: llvm-backend.cpp =================================================================== --- llvm-backend.cpp (revision 122440) +++ llvm-backend.cpp (working copy) @@ -245,6 +245,7 @@ } PM->add(createTailDuplicationPass()); // Simplify cfg by copying code + PM->add(createInstructionCombiningPass()); // Cleanup for scalarrepl. PM->add(createCFGSimplificationPass()); // Merge & remove BBs PM->add(createScalarReplAggregatesPass()); // Break up aggregate allocas PM->add(createInstructionCombiningPass()); // Combine silly seq's From nicholas at mxc.ca Mon Jan 15 08:30:22 2007 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 15 Jan 2007 08:30:22 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Message-ID: <200701151430.l0FEUMSZ008323@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: PredicateSimplifier.cpp updated: 1.47 -> 1.48 --- Log message: Don't print address of ETNode. Print the DFSNumIn which uniquely identifies the basic block and is stable across runs in gdb or valgrind. Make Node::update handle edges which dominate and are tighter than existing edges. Replace makeEqual's "squeeze theorem" code. Fixes miscompilation. Gate the calls to defToOps and opsToDef. Before this, we were getting IG edges about values which weren't even defined in the dominated area. This reduces the size of the IG by about half. --- Diffs of the changes: (+65 -34) PredicateSimplifier.cpp | 99 +++++++++++++++++++++++++++++++----------------- 1 files changed, 65 insertions(+), 34 deletions(-) Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.47 llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.48 --- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.47 Fri Jan 12 20:05:28 2007 +++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Mon Jan 15 08:30:07 2007 @@ -263,7 +263,7 @@ "000024", "000025", " u>", " u>=", " u<", " u<=", " !=", "000031" }; os << " " << names[NI->LV] << " " << NI->To - << "(" << NI->Subtree << ")\n"; + << " (" << NI->Subtree->getDFSNumIn() << ")\n"; } } #endif @@ -313,15 +313,24 @@ LatticeVal LV = static_cast(I->LV & R); assert(validPredicate(LV) && "Invalid union of lattice values."); if (LV != I->LV) { - if (Subtree == I->Subtree) - I->LV = LV; - else { + if (Subtree != I->Subtree) { assert(Subtree->DominatedBy(I->Subtree) && "Find returned subtree that doesn't apply."); Edge edge(n, R, Subtree); iterator Insert = std::lower_bound(begin(), end(), edge); - Relations.insert(Insert, edge); + Relations.insert(Insert, edge); // invalidates I + I = find(n, Subtree); + } + + // Also, we have to tighten any edge that Subtree dominates. + for (iterator B = begin(); I->To == n; --I) { + if (I->Subtree->DominatedBy(Subtree)) { + LatticeVal LV = static_cast(I->LV & R); + assert(validPredicate(LV) && "Invalid union of lattice values."); + I->LV = LV; + } + if (I == B) break; } } } @@ -646,7 +655,8 @@ for (NodeMapType::const_iterator I = NodeMap.begin(), E = NodeMap.end(); I != E; ++I) { Node *N = node(I->index); - os << *I->V << " == " << I->index << "(" << I->Subtree << ")\n"; + os << *I->V << " == " << I->index + << "(" << I->Subtree->getDFSNumIn() << ")\n"; if (VisitedNodes.insert(N).second) { os << I->index << ". "; if (!N->getValue()) os << "(deleted node)\n"; @@ -819,27 +829,28 @@ // We can't just merge %x and %y because the relationship with %z would // be EQ and that's invalid. What we're doing is looking for any nodes // %z such that %x <= %z and %y >= %z, and vice versa. - // - // Also handle %a <= %b and %c <= %a when adding %b <= %c. Node *N1 = IG.node(n1); - Node::iterator end = N1->end(); - for (unsigned i = 0; i < Remove.size(); ++i) { - Node *N = IG.node(Remove[i]); - Value *V = N->getValue(); - for (Node::iterator I = N->begin(), E = N->end(); I != E; ++I) { - if (I->LV & EQ_BIT) { - if (Top == I->Subtree || Top->DominatedBy(I->Subtree)) { - Node::iterator NI = N1->find(I->To, Top); - if (NI != end) { - if (!(NI->LV & EQ_BIT)) return false; - if (isRelatedBy(V, IG.node(NI->To)->getValue(), - ICmpInst::ICMP_NE)) - return false; - Remove.insert(NI->To); - } - } - } + Node *N2 = IG.node(n2); + Node::iterator end = N2->end(); + + // Find the intersection between N1 and N2 which is dominated by + // Top. If we find %x where N1 <= %x <= N2 (or >=) then add %x to + // Remove. + for (Node::iterator I = N1->begin(), E = N1->end(); I != E; ++I) { + if (!(I->LV & EQ_BIT) || !Top->DominatedBy(I->Subtree)) continue; + + unsigned ILV_s = I->LV & (SLT_BIT|SGT_BIT); + unsigned ILV_u = I->LV & (ULT_BIT|UGT_BIT); + Node::iterator NI = N2->find(I->To, Top); + if (NI != end) { + LatticeVal NILV = reversePredicate(NI->LV); + unsigned NILV_s = NILV & (SLT_BIT|SGT_BIT); + unsigned NILV_u = NILV & (ULT_BIT|UGT_BIT); + + if ((ILV_s != (SLT_BIT|SGT_BIT) && ILV_s == NILV_s) || + (ILV_u != (ULT_BIT|UGT_BIT) && ILV_u == NILV_u)) + Remove.insert(I->To); } } @@ -973,13 +984,19 @@ for (Value *R = V2; i == 0 || i < Remove.size(); ++i) { if (i) R = IG.node(Remove[i])->getValue(); // skip n2. - if (Instruction *I2 = dyn_cast(R)) defToOps(I2); + if (Instruction *I2 = dyn_cast(R)) { + if (below(I2) || + Top->DominatedBy(Forest->getNodeForBlock(I2->getParent()))) + defToOps(I2); + } for (Value::use_iterator UI = V2->use_begin(), UE = V2->use_end(); UI != UE;) { Use &TheUse = UI.getUse(); ++UI; if (Instruction *I = dyn_cast(TheUse.getUser())) { - opsToDef(I); + if (below(I) || + Top->DominatedBy(Forest->getNodeForBlock(I->getParent()))) + opsToDef(I); } } } @@ -1367,25 +1384,38 @@ IG.addInequality(n1, n2, Top, LV); - if (Instruction *I1 = dyn_cast(O.LHS)) defToOps(I1); + if (Instruction *I1 = dyn_cast(O.LHS)) { + if (below(I1) || + Top->DominatedBy(Forest->getNodeForBlock(I1->getParent()))) + defToOps(I1); + } if (isa(O.LHS) || isa(O.LHS)) { for (Value::use_iterator UI = O.LHS->use_begin(), UE = O.LHS->use_end(); UI != UE;) { Use &TheUse = UI.getUse(); ++UI; if (Instruction *I = dyn_cast(TheUse.getUser())) { - opsToDef(I); + if (below(I) || + Top->DominatedBy(Forest->getNodeForBlock(I->getParent()))) + opsToDef(I); } } } - if (Instruction *I2 = dyn_cast(O.RHS)) defToOps(I2); + if (Instruction *I2 = dyn_cast(O.RHS)) { + if (below(I2) || + Top->DominatedBy(Forest->getNodeForBlock(I2->getParent()))) + defToOps(I2); + } if (isa(O.RHS) || isa(O.RHS)) { for (Value::use_iterator UI = O.RHS->use_begin(), UE = O.RHS->use_end(); UI != UE;) { Use &TheUse = UI.getUse(); ++UI; if (Instruction *I = dyn_cast(TheUse.getUser())) { - opsToDef(I); + if (below(I) || + Top->DominatedBy(Forest->getNodeForBlock(I->getParent()))) + + opsToDef(I); } } } @@ -1466,7 +1496,8 @@ void visitBasicBlock(DominatorTree::Node *Node) { BasicBlock *BB = Node->getBlock(); ETNode *ET = Forest->getNodeForBlock(BB); - DOUT << "Entering Basic Block: " << BB->getName() << " (" << ET << ")\n"; + DOUT << "Entering Basic Block: " << BB->getName() + << " (" << ET->getDFSNumIn() << ")\n"; for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E;) { visitInstruction(I++, Node, ET); } @@ -1572,7 +1603,7 @@ I != E; ++I) { BasicBlock *Dest = (*I)->getBlock(); DOUT << "Branch thinking about %" << Dest->getName() - << "(" << PS->Forest->getNodeForBlock(Dest) << ")\n"; + << "(" << PS->Forest->getNodeForBlock(Dest)->getDFSNumIn() << ")\n"; if (Dest == TrueDest) { DOUT << "(" << DTNode->getBlock()->getName() << ") true set:\n"; @@ -1602,7 +1633,7 @@ I != E; ++I) { BasicBlock *BB = (*I)->getBlock(); DOUT << "Switch thinking about BB %" << BB->getName() - << "(" << PS->Forest->getNodeForBlock(BB) << ")\n"; + << "(" << PS->Forest->getNodeForBlock(BB)->getDFSNumIn() << ")\n"; VRPSolver VRP(IG, UB, PS->Forest, PS->modified, BB); if (BB == SI.getDefaultDest()) { From baldrick at free.fr Mon Jan 15 09:03:05 2007 From: baldrick at free.fr (Duncan Sands) Date: Mon, 15 Jan 2007 16:03:05 +0100 Subject: [llvm-commits] llvm-convert.cpp compile fix Message-ID: <200701151603.12612.baldrick@free.fr> Something like this is needed to get current llvm-gcc4 to compile. Index: gcc/llvm-convert.cpp =================================================================== --- gcc/llvm-convert.cpp (revision 248) +++ gcc/llvm-convert.cpp (working copy) @@ -221,7 +221,7 @@ // If this is just a mismatch between integer types, this is due // to K&R prototypes, where the forward proto defines the arg as int // and the actual impls is a short or char. - assert(ArgVal->getType() == Type::Int32Ty && LLVMTy->isIntegral() && + assert(ArgVal->getType() == Type::Int32Ty && LLVMTy->isInteger() && "Lowerings don't match?"); ArgVal = new TruncInst(ArgVal, LLVMTy, NameStack.back(), CurBB); } From baldrick at free.fr Mon Jan 15 09:06:20 2007 From: baldrick at free.fr (Duncan Sands) Date: Mon, 15 Jan 2007 16:06:20 +0100 Subject: [llvm-commits] llvm-convert.cpp: abort on unhandled expression Message-ID: <200701151606.21629.baldrick@free.fr> Neater than just segfaulting, which in my experience is what happens a bit later without this. Index: gcc/llvm-convert.cpp =================================================================== --- gcc/llvm-convert.cpp (revision 248) +++ gcc/llvm-convert.cpp (working copy) @@ -496,7 +496,7 @@ default: std::cerr << "Unhandled expression!\n"; debug_tree(exp); - break; + abort(); case EH_FILTER_EXPR: case CATCH_EXPR: { static bool PrintedWarning = false; From baldrick at free.fr Mon Jan 15 09:07:46 2007 From: baldrick at free.fr (Duncan Sands) Date: Mon, 15 Jan 2007 16:07:46 +0100 Subject: [llvm-commits] Fix obvious thinko/typo in EmitMinMaxExpr Message-ID: <200701151607.46719.baldrick@free.fr> Index: gcc/llvm-convert.cpp =================================================================== --- gcc/llvm-convert.cpp (revision 248) +++ gcc/llvm-convert.cpp (working copy) @@ -2568,7 +2574,7 @@ Instruction::CastOps opcode = CastInst::getCastOpcode(LHS, LHSIsSigned, Ty, TyIsSigned); LHS = CastToType(opcode, LHS, Ty); - opcode = CastInst::getCastOpcode(LHS, LHSIsSigned, Ty, TyIsSigned); + opcode = CastInst::getCastOpcode(RHS, RHSIsSigned, Ty, TyIsSigned); RHS = CastToType(opcode, RHS, Ty); Value *Compare; From baldrick at free.fr Mon Jan 15 09:11:08 2007 From: baldrick at free.fr (Duncan Sands) Date: Mon, 15 Jan 2007 16:11:08 +0100 Subject: [llvm-commits] Support VIEW_CONVERT_EXPR in TreeConstantToLLVM::Convert Message-ID: <200701151611.09042.baldrick@free.fr> Ignore the type change - constants don't care. Index: gcc/llvm-convert.cpp =================================================================== --- gcc/llvm-convert.cpp (revision 248) +++ gcc/llvm-convert.cpp (working copy) @@ -4260,6 +4380,7 @@ case PLUS_EXPR: case MINUS_EXPR: return ConvertBinOp_CST(exp); case CONSTRUCTOR: return ConvertCONSTRUCTOR(exp); + case VIEW_CONVERT_EXPR: return Convert(TREE_OPERAND(exp, 0)); case ADDR_EXPR: return ConstantExpr::getBitCast(EmitLV(TREE_OPERAND(exp, 0)), ConvertType(TREE_TYPE(exp))); From baldrick at free.fr Mon Jan 15 11:09:20 2007 From: baldrick at free.fr (Duncan Sands) Date: Mon, 15 Jan 2007 18:09:20 +0100 Subject: [llvm-commits] llvm-gcc: sign matters for EXACT_DIV_EXPR Message-ID: <200701151809.21614.baldrick@free.fr> EXACT_DIV_EXPR can be used on signed operands, so it is wrong to always turn it into UDiv. Since EXACT_DIV_EXPR always gives the same result as TRUNC_DIV_EXPR (it exists in gcc because it might give that result faster on some targets, not because it gives a different result), it is pointless to distinguish between the two in LLVM. Index: gcc/llvm-convert.cpp =================================================================== --- gcc/llvm-convert.cpp (revision 248) +++ gcc/llvm-convert.cpp (working copy) @@ -591,14 +591,12 @@ case MINUS_EXPR:Result = EmitBinOp(exp, DestLoc, Instruction::Sub);break; case MULT_EXPR: Result = EmitBinOp(exp, DestLoc, Instruction::Mul);break; case TRUNC_DIV_EXPR: + case EXACT_DIV_EXPR: if (TYPE_UNSIGNED(TREE_TYPE(exp))) Result = EmitBinOp(exp, DestLoc, Instruction::UDiv); else Result = EmitBinOp(exp, DestLoc, Instruction::SDiv); break; - case EXACT_DIV_EXPR: - Result = EmitBinOp(exp, DestLoc, Instruction::UDiv); - break; case RDIV_EXPR: Result = EmitBinOp(exp, DestLoc, Instruction::FDiv); break; From clattner at apple.com Mon Jan 15 11:31:43 2007 From: clattner at apple.com (Chris Lattner) Date: Mon, 15 Jan 2007 09:31:43 -0800 Subject: [llvm-commits] Fix obvious thinko/typo in EmitMinMaxExpr In-Reply-To: <200701151607.46719.baldrick@free.fr> References: <200701151607.46719.baldrick@free.fr> Message-ID: <96FDA38A-5272-4DB3-AA78-41833E47261C@apple.com> Applied, thanks! On Jan 15, 2007, at 7:07 AM, Duncan Sands wrote: > Index: gcc/llvm-convert.cpp > =================================================================== > --- gcc/llvm-convert.cpp (revision 248) > +++ gcc/llvm-convert.cpp (working copy) > @@ -2568,7 +2574,7 @@ > Instruction::CastOps opcode = CastInst::getCastOpcode(LHS, > LHSIsSigned, Ty, > TyIsSigned); > LHS = CastToType(opcode, LHS, Ty); > - opcode = CastInst::getCastOpcode(LHS, LHSIsSigned, Ty, TyIsSigned); > + opcode = CastInst::getCastOpcode(RHS, RHSIsSigned, Ty, TyIsSigned); > RHS = CastToType(opcode, RHS, Ty); > > Value *Compare; > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Mon Jan 15 11:32:13 2007 From: clattner at apple.com (Chris Lattner) Date: Mon, 15 Jan 2007 09:32:13 -0800 Subject: [llvm-commits] llvm-convert.cpp compile fix In-Reply-To: <200701151603.12612.baldrick@free.fr> References: <200701151603.12612.baldrick@free.fr> Message-ID: <6702EB6D-843F-4CBE-ABBE-DDF8678EB2A8@apple.com> This is already in the repository, but must not have hit the mirror yet. -Chris On Jan 15, 2007, at 7:03 AM, Duncan Sands wrote: > Something like this is needed to get current llvm-gcc4 to compile. > > Index: gcc/llvm-convert.cpp > =================================================================== > --- gcc/llvm-convert.cpp (revision 248) > +++ gcc/llvm-convert.cpp (working copy) > @@ -221,7 +221,7 @@ > // If this is just a mismatch between integer types, > this is due > // to K&R prototypes, where the forward proto defines > the arg as int > // and the actual impls is a short or char. > - assert(ArgVal->getType() == Type::Int32Ty && LLVMTy- > >isIntegral() && > + assert(ArgVal->getType() == Type::Int32Ty && LLVMTy- > >isInteger() && > "Lowerings don't match?"); > ArgVal = new TruncInst(ArgVal, LLVMTy, NameStack.back(), > CurBB); > } > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Mon Jan 15 11:34:27 2007 From: clattner at apple.com (Chris Lattner) Date: Mon, 15 Jan 2007 09:34:27 -0800 Subject: [llvm-commits] Support VIEW_CONVERT_EXPR in TreeConstantToLLVM::Convert In-Reply-To: <200701151611.09042.baldrick@free.fr> References: <200701151611.09042.baldrick@free.fr> Message-ID: Applied, thanks! -Chris On Jan 15, 2007, at 7:11 AM, Duncan Sands wrote: > Ignore the type change - constants don't care. > > Index: gcc/llvm-convert.cpp > =================================================================== > --- gcc/llvm-convert.cpp (revision 248) > +++ gcc/llvm-convert.cpp (working copy) > @@ -4260,6 +4380,7 @@ > case PLUS_EXPR: > case MINUS_EXPR: return ConvertBinOp_CST(exp); > case CONSTRUCTOR: return ConvertCONSTRUCTOR(exp); > + case VIEW_CONVERT_EXPR: return Convert(TREE_OPERAND(exp, 0)); > case ADDR_EXPR: > return ConstantExpr::getBitCast(EmitLV(TREE_OPERAND(exp, 0)), > ConvertType(TREE_TYPE(exp))); > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Mon Jan 15 11:36:10 2007 From: clattner at apple.com (Chris Lattner) Date: Mon, 15 Jan 2007 09:36:10 -0800 Subject: [llvm-commits] llvm-gcc: sign matters for EXACT_DIV_EXPR In-Reply-To: <200701151809.21614.baldrick@free.fr> References: <200701151809.21614.baldrick@free.fr> Message-ID: Applied, thanks! On Jan 15, 2007, at 9:09 AM, Duncan Sands wrote: > EXACT_DIV_EXPR can be used on signed operands, so it is wrong to > always > turn it into UDiv. Since EXACT_DIV_EXPR always gives the same > result as > TRUNC_DIV_EXPR (it exists in gcc because it might give that result > faster > on some targets, not because it gives a different result), it is > pointless > to distinguish between the two in LLVM. From sabre at nondot.org Mon Jan 15 11:55:38 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Jan 2007 11:55:38 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200701151755.l0FHtcqO013499@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.600 -> 1.601 --- Log message: Fix a regression in my isIntegral patch that broke 471.omnetpp. This is because TargetData::getTypeSize() returns the same for i1 and i8. This fix is not right for the full generality of bitwise types, but it fixes the regression. --- Diffs of the changes: (+8 -6) InstructionCombining.cpp | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.600 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.601 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.600 Mon Jan 15 01:30:06 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Jan 15 11:55:20 2007 @@ -7978,8 +7978,8 @@ if (const PointerType *SrcTy = dyn_cast(CastOp->getType())) { const Type *SrcPTy = SrcTy->getElementType(); - if (DestPTy->isInteger() || isa(DestPTy) || - isa(DestPTy)) { + if ((DestPTy->isInteger() && DestPTy != Type::Int1Ty) || + isa(DestPTy) || isa(DestPTy)) { // If the source is an array, the code below will not succeed. Check to // see if a trivial 'gep P, 0, 0' will help matters. Only do this for // constants. @@ -7992,8 +7992,8 @@ SrcPTy = SrcTy->getElementType(); } - if ((SrcPTy->isInteger() || isa(SrcPTy) || - isa(SrcPTy)) && + if (((SrcPTy->isInteger() && SrcPTy != Type::Int1Ty) || + isa(SrcPTy) || isa(SrcPTy)) && // Do not allow turning this into a load of an integer, which is then // casted to a pointer, this pessimizes pointer analysis a lot. (isa(SrcPTy) == isa(LI.getType())) && @@ -8166,7 +8166,8 @@ if (const PointerType *SrcTy = dyn_cast(CastOp->getType())) { const Type *SrcPTy = SrcTy->getElementType(); - if (DestPTy->isInteger() || isa(DestPTy)) { + if ((DestPTy->isInteger() && DestPTy != Type::Int1Ty) || + isa(DestPTy)) { // If the source is an array, the code below will not succeed. Check to // see if a trivial 'gep P, 0, 0' will help matters. Only do this for // constants. @@ -8179,7 +8180,8 @@ SrcPTy = SrcTy->getElementType(); } - if ((SrcPTy->isInteger() || isa(SrcPTy)) && + if (((SrcPTy->isInteger() && SrcPTy != Type::Int1Ty) || + isa(SrcPTy)) && IC.getTargetData().getTypeSize(SrcPTy) == IC.getTargetData().getTypeSize(DestPTy)) { From clattner at apple.com Mon Jan 15 12:24:14 2007 From: clattner at apple.com (Chris Lattner) Date: Mon, 15 Jan 2007 10:24:14 -0800 Subject: [llvm-commits] CVS: llvm/docs/BytecodeFormat.html LangRef.html In-Reply-To: <200701121921.l0CJLJax012321@zion.cs.uiuc.edu> References: <200701121921.l0CJLJax012321@zion.cs.uiuc.edu> Message-ID: <13BF1963-8D97-4E90-9935-228E840EB3DF@apple.com> Nice work Anton, some comments below: > @@ -1082,7 +1081,11 @@ > If this bit is set, a SectionID follows > this vbr. > > > - bit(10-31) > + bit(10-12) > + Visibility style: 0=Default, 1=Hidden. > + > + > + bit(13-31) > Currently unassigned. > > Why reserve 3 bits for visibility? > + > + > +
> + > + > + > + > + > + > + > + > + > + > + > + > + > + Why reserve 16 bits for visibility? :) Also, please add some info to LangRef.html about visibility. Thanks! -Chris From reid at x10sys.com Mon Jan 15 12:27:55 2007 From: reid at x10sys.com (Reid Spencer) Date: Mon, 15 Jan 2007 12:27:55 -0600 Subject: [llvm-commits] CVS: llvm/docs/LangRef.html Message-ID: <200701151827.l0FIRtA9014087@zion.cs.uiuc.edu> Changes in directory llvm/docs: LangRef.html updated: 1.198 -> 1.199 --- Log message: Update documentation for parameter attributes for the syntax change. --- Diffs of the changes: (+11 -9) LangRef.html | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.198 llvm/docs/LangRef.html:1.199 --- llvm/docs/LangRef.html:1.198 Sun Jan 14 19:54:13 2007 +++ llvm/docs/LangRef.html Mon Jan 15 12:27:39 2007 @@ -687,27 +687,29 @@ type so two functions types that differ only by the parameter attributes are different function types.

-

Parameter attributes consist of an at sign (@) followed by either a single - keyword or a comma separate list of keywords enclosed in parentheses. For +

Parameter attributes are simple keywords that follow the type specified. If + multiple parameter attributes are needed, they are space separated. For example:

-    %someFunc = i16 @zext (i8 @(sext) %someParam)
-    %someFunc = i16 @zext (i8 @zext %someParam)
+ %someFunc = i16 (i8 sext %someParam) zext + %someFunc = i16 (i8 zext %someParam) zext

Note that the two function types above are unique because the parameter has - a different attribute (@sext in the first one, @zext in the second).

+ a different attribute (sext in the first one, zext in the second). Also note + that the attribute for the function result (zext) comes immediately after the + argument list.

Currently, only the following parameter attributes are defined:

-
@zext
+
zext
This indicates that the parameter should be zero extended just before a call to this function.
-
@sext
+
sext
This indicates that the parameter should be sign extended just before a call to this function.

The current motivation for parameter attributes is to enable the sign and zero extend information necessary for the C calling convention to be passed - from the front end to LLVM. The @zext and @sext attributes + from the front end to LLVM. The zext and sext attributes are used by the code generator to perform the required extension. However, parameter attributes are an orthogonal feature to calling conventions and may be used for other purposes in the future.

@@ -4485,7 +4487,7 @@ Chris Lattner
The LLVM Compiler Infrastructure
- Last modified: $Date: 2007/01/15 01:54:13 $ + Last modified: $Date: 2007/01/15 18:27:39 $ From sabre at nondot.org Mon Jan 15 12:28:34 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Jan 2007 12:28:34 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp Message-ID: <200701151828.l0FISYEF014147@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: AsmWriter.cpp updated: 1.253 -> 1.254 --- Log message: make this more efficient in release builds (time and space) --- Diffs of the changes: (+2 -6) AsmWriter.cpp | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-) Index: llvm/lib/VMCore/AsmWriter.cpp diff -u llvm/lib/VMCore/AsmWriter.cpp:1.253 llvm/lib/VMCore/AsmWriter.cpp:1.254 --- llvm/lib/VMCore/AsmWriter.cpp:1.253 Sun Jan 14 20:27:26 2007 +++ llvm/lib/VMCore/AsmWriter.cpp Mon Jan 15 12:28:18 2007 @@ -873,11 +873,9 @@ abort(); } switch (GV->getVisibility()) { + default: assert(0 && "Invalid visibility style!"); case GlobalValue::DefaultVisibility: break; case GlobalValue::HiddenVisibility: Out << "hidden "; break; - default: - cerr << "Invalid visibility style!\n"; - abort(); } } @@ -982,11 +980,9 @@ abort(); } switch (F->getVisibility()) { + default: assert(0 && "Invalid visibility style!"); case GlobalValue::DefaultVisibility: break; case GlobalValue::HiddenVisibility: Out << "hidden "; break; - default: - cerr << "Invalid visibility style!\n"; - abort(); } } From reid at x10sys.com Mon Jan 15 12:28:50 2007 From: reid at x10sys.com (Reid Spencer) Date: Mon, 15 Jan 2007 12:28:50 -0600 Subject: [llvm-commits] CVS: llvm/docs/LangRef.html Message-ID: <200701151828.l0FISobf014230@zion.cs.uiuc.edu> Changes in directory llvm/docs: LangRef.html updated: 1.199 -> 1.200 --- Log message: One more @ to remove. --- Diffs of the changes: (+2 -2) LangRef.html | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.199 llvm/docs/LangRef.html:1.200 --- llvm/docs/LangRef.html:1.199 Mon Jan 15 12:27:39 2007 +++ llvm/docs/LangRef.html Mon Jan 15 12:28:34 2007 @@ -928,7 +928,7 @@ -
TypeField Description
bit(0-15)The linkage type of the function: > 0=External, 1=Weak, > +2=Appending, 3=Internal, 4=LinkOnce, 5=DllImport, > 6=DllExport1
bit(16-31)Visibility style: 0=Default, 1=Hidden. function taking an i32, returning an i32
float (i16 @sext, i32 *) * + float (i16 sext, i32 *) * Pointer to a function that takes an i16 that should be sign extended and a @@ -4487,7 +4487,7 @@ Chris Lattner
The LLVM Compiler Infrastructure
- Last modified: $Date: 2007/01/15 18:27:39 $ + Last modified: $Date: 2007/01/15 18:28:34 $ From sabre at nondot.org Mon Jan 15 12:32:40 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Jan 2007 12:32:40 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/test-hidden.ll Message-ID: <200701151832.l0FIWeD7014466@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: test-hidden.ll updated: 1.1 -> 1.2 --- Log message: test darwin too! :) --- Diffs of the changes: (+2 -1) test-hidden.ll | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/test/Regression/CodeGen/X86/test-hidden.ll diff -u llvm/test/Regression/CodeGen/X86/test-hidden.ll:1.1 llvm/test/Regression/CodeGen/X86/test-hidden.ll:1.2 --- llvm/test/Regression/CodeGen/X86/test-hidden.ll:1.1 Fri Jan 12 13:20:47 2007 +++ llvm/test/Regression/CodeGen/X86/test-hidden.ll Mon Jan 15 12:32:24 2007 @@ -1,5 +1,6 @@ ; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu && -; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu | grep ".hidden" | wc -l | grep 2 +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu | grep ".hidden" | wc -l | grep 2 && +; RUN: llvm-as < %s | llc -mtriple=i686-apple-darwin8.8.0 | grep ".private_extern" | wc -l | grep 2 %struct.Person = type { i32 } %a = hidden global i32 0 From jeffc at jolt-lang.org Mon Jan 15 14:27:37 2007 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Mon, 15 Jan 2007 14:27:37 -0600 Subject: [llvm-commits] CVS: llvm/win32/CodeGen/CodeGen.vcproj Message-ID: <200701152027.l0FKRbDv016519@zion.cs.uiuc.edu> Changes in directory llvm/win32/CodeGen: CodeGen.vcproj updated: 1.25 -> 1.26 --- Log message: Unbreak VC++ build. --- Diffs of the changes: (+3 -0) CodeGen.vcproj | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/win32/CodeGen/CodeGen.vcproj diff -u llvm/win32/CodeGen/CodeGen.vcproj:1.25 llvm/win32/CodeGen/CodeGen.vcproj:1.26 --- llvm/win32/CodeGen/CodeGen.vcproj:1.25 Sun Nov 5 13:31:28 2006 +++ llvm/win32/CodeGen/CodeGen.vcproj Mon Jan 15 14:27:18 2007 @@ -292,6 +292,9 @@ RelativePath="..\..\include\llvm\CodeGen\RegAllocRegistry.h"> + + Changes in directory llvm/lib/Analysis: ScalarEvolution.cpp updated: 1.88 -> 1.89 --- Log message: Unbreak VC++ build. --- Diffs of the changes: (+1 -1) ScalarEvolution.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.88 llvm/lib/Analysis/ScalarEvolution.cpp:1.89 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.88 Sun Jan 14 20:27:26 2007 +++ llvm/lib/Analysis/ScalarEvolution.cpp Mon Jan 15 14:27:18 2007 @@ -1929,7 +1929,7 @@ // Couldn't symbolically evaluate. if (!CondVal) return UnknownValue; - if (CondVal->getZExtValue() == ExitWhen) { + if (CondVal->getZExtValue() == uint64_t(ExitWhen)) { ConstantEvolutionLoopExitValue[PN] = PHIVal; ++NumBruteForceTripCountsComputed; return SCEVConstant::get(ConstantInt::get(Type::Int32Ty, IterationNum)); From jeffc at jolt-lang.org Mon Jan 15 14:27:41 2007 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Mon, 15 Jan 2007 14:27:41 -0600 Subject: [llvm-commits] CVS: llvm/win32/VMCore/VMCore.vcproj Message-ID: <200701152027.l0FKRf0r016529@zion.cs.uiuc.edu> Changes in directory llvm/win32/VMCore: VMCore.vcproj updated: 1.25 -> 1.26 --- Log message: Unbreak VC++ build. --- Diffs of the changes: (+3 -0) VMCore.vcproj | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/win32/VMCore/VMCore.vcproj diff -u llvm/win32/VMCore/VMCore.vcproj:1.25 llvm/win32/VMCore/VMCore.vcproj:1.26 --- llvm/win32/VMCore/VMCore.vcproj:1.25 Mon Jan 8 14:17:17 2007 +++ llvm/win32/VMCore/VMCore.vcproj Mon Jan 15 14:27:18 2007 @@ -291,6 +291,9 @@ RelativePath="..\..\include\llvm\PassManager.h"> + + Changes in directory llvm/win32/llc: llc.vcproj updated: 1.9 -> 1.10 --- Log message: Unbreak VC++ build. --- Diffs of the changes: (+2 -2) llc.vcproj | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/win32/llc/llc.vcproj diff -u llvm/win32/llc/llc.vcproj:1.9 llvm/win32/llc/llc.vcproj:1.10 --- llvm/win32/llc/llc.vcproj:1.9 Sun Jan 29 22:07:07 2006 +++ llvm/win32/llc/llc.vcproj Mon Jan 15 14:27:18 2007 @@ -37,7 +37,7 @@ Name="VCCustomBuildTool"/> Changes in directory llvm/win32/CBackend: CBackend.vcproj updated: 1.5 -> 1.6 --- Log message: Unbreak VC++ build. --- Diffs of the changes: (+1 -1) CBackend.vcproj | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/win32/CBackend/CBackend.vcproj diff -u llvm/win32/CBackend/CBackend.vcproj:1.5 llvm/win32/CBackend/CBackend.vcproj:1.6 --- llvm/win32/CBackend/CBackend.vcproj:1.5 Sun Jan 29 22:07:07 2006 +++ llvm/win32/CBackend/CBackend.vcproj Mon Jan 15 14:27:18 2007 @@ -109,7 +109,7 @@ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> + RelativePath="..\..\lib\Target\CBackend\CBackend.cpp"> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.120 -> 1.121 --- Log message: Do not record last users of Pass Manager. --- Diffs of the changes: (+7 -2) PassManager.cpp | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.120 llvm/lib/VMCore/PassManager.cpp:1.121 --- llvm/lib/VMCore/PassManager.cpp:1.120 Fri Jan 12 14:07:16 2007 +++ llvm/lib/VMCore/PassManager.cpp Mon Jan 15 14:31:54 2007 @@ -594,8 +594,13 @@ } } - LastUses.push_back(P); - TPM->setLastUser(LastUses, P); + // Set P as P's last user until someone starts using P. + // However, if P is a Pass Manager then it does not need + // to record its last user. + if (!dynamic_cast(P)) { + LastUses.push_back(P); + TPM->setLastUser(LastUses, P); + } // Take a note of analysis required and made available by this pass. // Remove the analysis not preserved by this pass From clattner at apple.com Mon Jan 15 16:56:13 2007 From: clattner at apple.com (Chris Lattner) Date: Mon, 15 Jan 2007 14:56:13 -0800 Subject: [llvm-commits] Potential Patch for PR1095 In-Reply-To: References: Message-ID: <8B72A52A-C2EB-44A4-A9C9-A3A72C296046@apple.com> On Jan 9, 2007, at 12:25 AM, Bill Wendling wrote: > Hi all, Hey Bill, sorry for the delay. > I would like someone to review this patch for PR1095. This gives us > a "dialect" for the assembler code if we're given something like: > > __asm__("{cntlz|cntlzw} ... > > Before, we were defaulting to the first one. But there are some > platforms which need the second form. This patch is very close. Comments below: Please add a .ll file regression test to llvm/test/Regression/CodeGen/ PowerPC. --- include/llvm/Target/TargetAsmInfo.h 21 Dec 2006 21:24:35 -0000 1.18 +++ include/llvm/Target/TargetAsmInfo.h 9 Jan 2007 08:21:25 -0000 @@ -27,6 +27,11 @@ /// properties and features specific to the target. class TargetAsmInfo { protected: + enum AsmDialect { + ASM_ATT, + ASM_INTEL + }; + The meaning of the various dialects vary across the targets. This enum should move into the X86 backend. The PowerPC backend should use PPC_OLD_MNEMONICS = 0 and PPC_NEW_MNEMONICS = 1. Darwin should use new mnemonics of course. @@ -128,6 +133,11 @@ /// Otherwise, it emits ".align log2(N)", e.g. 3 to align to an 8 byte /// boundary. bool AlignmentIsInBytes; // Defaults to true + + //===--- Assembler Dialect Information --------------------------------===// + + /// AssemblerDialect - Which dialect of an assembler variant to use. + AsmDialect AssemblerDialect; // Defaults to ASM_ATT Please make this just an 'unsigned' and group it with InlineAsmStart/ InlineAsmEnd. You could make the group comment be "Inline Asm Directives" or something. Otherwise, the patch looks great. Please make these changes and apply it. Thanks Bill! -Chris From dpatel at apple.com Mon Jan 15 16:58:06 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 15 Jan 2007 14:58:06 -0800 Subject: [llvm-commits] [PATCH] delete ManagedStatics Message-ID: Right now, ManagedStatics are not deleted (through llvm_shutdown) by llvm-gcc. Here is the patch. OK to install? Thanks, - Devang Index: llvm-backend.cpp =================================================================== --- llvm-backend.cpp (revision 122487) +++ llvm-backend.cpp (working copy) @@ -45,6 +45,7 @@ Software Foundation, 59 Temple Place - S #include "llvm/Transforms/IPO.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/Streams.h" +#include "llvm/Support/ManagedStatic.h" #include #undef VISIBILITY_HIDDEN extern "C" { @@ -358,6 +359,7 @@ static void CreateStructorsList(std::vec // llvm_asm_file_end - Finish the .s file. void llvm_asm_file_end(void) { timevar_push(TV_LLVM_PERFILE); + llvm_shutdown_obj X; // Call llvm_shutdown() on exit. // Add an llvm.global_ctors global if needed. if (!StaticCtors.empty()) From clattner at apple.com Mon Jan 15 17:01:12 2007 From: clattner at apple.com (Chris Lattner) Date: Mon, 15 Jan 2007 15:01:12 -0800 Subject: [llvm-commits] [PATCH] delete ManagedStatics In-Reply-To: References: Message-ID: On Jan 15, 2007, at 2:58 PM, Devang Patel wrote: > Right now, ManagedStatics are not deleted (through llvm_shutdown) by > llvm-gcc. > Here is the patch. Ahhh, right. Yep, looks good. Nice detective work, -Chris > OK to install? > Thanks, > - > Devang > > Index: llvm-backend.cpp > =================================================================== > --- llvm-backend.cpp (revision 122487) > +++ llvm-backend.cpp (working copy) > @@ -45,6 +45,7 @@ Software Foundation, 59 Temple Place - S > #include "llvm/Transforms/IPO.h" > #include "llvm/ADT/StringExtras.h" > #include "llvm/Support/Streams.h" > +#include "llvm/Support/ManagedStatic.h" > #include > #undef VISIBILITY_HIDDEN > extern "C" { > @@ -358,6 +359,7 @@ static void CreateStructorsList(std::vec > // llvm_asm_file_end - Finish the .s file. > void llvm_asm_file_end(void) { > timevar_push(TV_LLVM_PERFILE); > + llvm_shutdown_obj X; // Call llvm_shutdown() on exit. > > // Add an llvm.global_ctors global if needed. > if (!StaticCtors.empty()) > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dpatel at apple.com Mon Jan 15 17:07:15 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 15 Jan 2007 17:07:15 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/PassManagers.h Message-ID: <200701152307.l0FN7Fgt019407@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: PassManagers.h updated: 1.2 -> 1.3 --- Log message: Remove extra white spaces. Fix comments. --- Diffs of the changes: (+2 -2) PassManagers.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/include/llvm/PassManagers.h diff -u llvm/include/llvm/PassManagers.h:1.2 llvm/include/llvm/PassManagers.h:1.3 --- llvm/include/llvm/PassManagers.h:1.2 Fri Jan 12 14:07:16 2007 +++ llvm/include/llvm/PassManagers.h Mon Jan 15 17:06:56 2007 @@ -1,4 +1,4 @@ -//===- PassManager.cpp - LLVM Pass Infrastructure Implementation ----------===// +//===- llvm/PassManager.h - Pass Inftrastructre classes --------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// // -// This file implements the LLVM Pass Manager infrastructure. +// This file declares the LLVM Pass Manager infrastructure. // //===----------------------------------------------------------------------===// From dpatel at apple.com Mon Jan 15 17:07:15 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 15 Jan 2007 17:07:15 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200701152307.l0FN7FGn019412@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.121 -> 1.122 --- Log message: Remove extra white spaces. Fix comments. --- Diffs of the changes: (+1 -1) PassManager.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.121 llvm/lib/VMCore/PassManager.cpp:1.122 --- llvm/lib/VMCore/PassManager.cpp:1.121 Mon Jan 15 14:31:54 2007 +++ llvm/lib/VMCore/PassManager.cpp Mon Jan 15 17:06:56 2007 @@ -559,7 +559,7 @@ /// Add pass P into the PassVector. Update /// AvailableAnalysis appropriately if ProcessAnalysis is true. void PMDataManager::add(Pass *P, - bool ProcessAnalysis) { + bool ProcessAnalysis) { // This manager is going to manage pass P. Set up analysis resolver // to connect them. From isanbard at gmail.com Mon Jan 15 17:58:57 2007 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 15 Jan 2007 15:58:57 -0800 Subject: [llvm-commits] Potential Patch for PR1095 In-Reply-To: <8B72A52A-C2EB-44A4-A9C9-A3A72C296046@apple.com> References: <8B72A52A-C2EB-44A4-A9C9-A3A72C296046@apple.com> Message-ID: <16e5fdf90701151558t71fa367cma48297a37cac6626@mail.gmail.com> On 1/15/07, Chris Lattner wrote: > On Jan 9, 2007, at 12:25 AM, Bill Wendling wrote: > > Hi all, > > Hey Bill, sorry for the delay. > Not a prob :-) > > I would like someone to review this patch for PR1095. This gives us > > a "dialect" for the assembler code if we're given something like: > > > > __asm__("{cntlz|cntlzw} ... > > > > Before, we were defaulting to the first one. But there are some > > platforms which need the second form. > > This patch is very close. Comments below: > > Please add a .ll file regression test to llvm/test/Regression/CodeGen/ > PowerPC. > Will do. > > --- include/llvm/Target/TargetAsmInfo.h 21 Dec 2006 21:24:35 -0000 1.18 > +++ include/llvm/Target/TargetAsmInfo.h 9 Jan 2007 08:21:25 -0000 > @@ -27,6 +27,11 @@ > /// properties and features specific to the target. > class TargetAsmInfo { > protected: > + enum AsmDialect { > + ASM_ATT, > + ASM_INTEL > + }; > + > > The meaning of the various dialects vary across the targets. This > enum should move into the X86 backend. The PowerPC backend should > use PPC_OLD_MNEMONICS = 0 and PPC_NEW_MNEMONICS = 1. Darwin should > use new mnemonics of course. > Ah! This makes more sense now. I was worried that just having "ATT" and "INTEL" was wrong. > > @@ -128,6 +133,11 @@ > /// Otherwise, it emits ".align log2(N)", e.g. 3 to align to an > 8 byte > /// boundary. > bool AlignmentIsInBytes; // Defaults to true > + > + //===--- Assembler Dialect Information > --------------------------------===// > + > + /// AssemblerDialect - Which dialect of an assembler variant to > use. > + AsmDialect AssemblerDialect; // Defaults to ASM_ATT > > Please make this just an 'unsigned' and group it with InlineAsmStart/ > InlineAsmEnd. You could make the group comment be "Inline Asm > Directives" or something. > Okay. > Otherwise, the patch looks great. Please make these changes and > apply it. > Will do! It'll probably be later today/tonight. > Thanks Bill! > Thanks for the review! :-) -bw From dpatel at apple.com Mon Jan 15 20:00:54 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 15 Jan 2007 20:00:54 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/PassManagers.h Message-ID: <200701160200.l0G20sUm022638@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: PassManagers.h updated: 1.3 -> 1.4 --- Log message: Code refactoring. --- Diffs of the changes: (+8 -0) PassManagers.h | 8 ++++++++ 1 files changed, 8 insertions(+) Index: llvm/include/llvm/PassManagers.h diff -u llvm/include/llvm/PassManagers.h:1.3 llvm/include/llvm/PassManagers.h:1.4 --- llvm/include/llvm/PassManagers.h:1.3 Mon Jan 15 17:06:56 2007 +++ llvm/include/llvm/PassManagers.h Mon Jan 15 20:00:38 2007 @@ -86,6 +86,13 @@ namespace llvm { +/// FunctionPassManager and PassManager, two top level managers, serve +/// as the public interface of pass manager infrastructure. +enum TopLevelManagerType { + TLM_Function, // FunctionPassManager + TLM_Pass // PassManager +}; + //===----------------------------------------------------------------------===// // PMTopLevelManager // @@ -118,6 +125,7 @@ /// then return NULL. Pass *findAnalysisPass(AnalysisID AID); + PMTopLevelManager(enum TopLevelManagerType t); virtual ~PMTopLevelManager(); /// Add immutable pass and initialize it. From dpatel at apple.com Mon Jan 15 20:00:55 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 15 Jan 2007 20:00:55 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200701160200.l0G20tLw022643@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.122 -> 1.123 --- Log message: Code refactoring. --- Diffs of the changes: (+21 -18) PassManager.cpp | 39 +++++++++++++++++++++------------------ 1 files changed, 21 insertions(+), 18 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.122 llvm/lib/VMCore/PassManager.cpp:1.123 --- llvm/lib/VMCore/PassManager.cpp:1.122 Mon Jan 15 17:06:56 2007 +++ llvm/lib/VMCore/PassManager.cpp Mon Jan 15 20:00:38 2007 @@ -112,7 +112,8 @@ public PMTopLevelManager { public: - FunctionPassManagerImpl(int Depth) : PMDataManager(Depth) { } + FunctionPassManagerImpl(int Depth) : PMDataManager(Depth), + PMTopLevelManager(TLM_Function) { } /// add - Add a pass to the queue of passes to run. This passes ownership of /// the Pass to the PassManager. When the PassManager is destroyed, the pass @@ -151,13 +152,6 @@ addImmutablePass(IP); recordAvailableAnalysis(IP); } else { - // Assign manager - if (activeStack.empty()) { - FPPassManager *FPP = new FPPassManager(getDepth() + 1); - FPP->setTopLevelManager(this->getTopLevelManager()); - addPassManager(FPP); - activeStack.push(FPP); - } P->assignPassManager(activeStack); } @@ -220,7 +214,8 @@ public: - PassManagerImpl(int Depth) : PMDataManager(Depth) { } + PassManagerImpl(int Depth) : PMDataManager(Depth), + PMTopLevelManager(TLM_Pass) { } /// add - Add a pass to the queue of passes to run. This passes ownership of /// the Pass to the PassManager. When the PassManager is destroyed, the pass @@ -251,15 +246,6 @@ addImmutablePass(IP); recordAvailableAnalysis(IP); } else { - - // Assign manager - if (activeStack.empty()) { - MPPassManager *MPP = new MPPassManager(getDepth() + 1); - MPP->setTopLevelManager(this->getTopLevelManager()); - addPassManager(MPP); - activeStack.push(MPP); - } - P->assignPassManager(activeStack); } @@ -331,6 +317,23 @@ //===----------------------------------------------------------------------===// // PMTopLevelManager implementation +/// Initialize top level manager. Create first pass manager. +PMTopLevelManager::PMTopLevelManager (enum TopLevelManagerType t) { + + if (t == TLM_Pass) { + MPPassManager *MPP = new MPPassManager(1); + MPP->setTopLevelManager(this); + addPassManager(MPP); + activeStack.push(MPP); + } + else if (t == TLM_Function) { + FPPassManager *FPP = new FPPassManager(1); + FPP->setTopLevelManager(this); + addPassManager(FPP); + activeStack.push(FPP); + } +} + /// Set pass P as the last user of the given analysis passes. void PMTopLevelManager::setLastUser(std::vector &AnalysisPasses, Pass *P) { From rspencer at reidspencer.com Mon Jan 15 21:32:28 2007 From: rspencer at reidspencer.com (Reid Spencer) Date: Tue, 16 Jan 2007 03:32:28 +0000 Subject: [llvm-commits] [llvm-gcc] Potential bug in iasm_extra_clobbers ?? Message-ID: <1168918348.7860.233.camel@bashful.x10sys.com> Applites, While I've been perusing c-common.c, I have found a warning that you might not be seeing because of compiler differences: ../../src-2/gcc/c-common.c: In function ?iasm_extra_clobbers?: ../../src-2/gcc/c-common.c:7017: warning: comparison of unsigned expression < 0 is always false This comes from this function: > static void > iasm_extra_clobbers (const char *opcode, tree *clobbersp) > { > struct iasm_op_clobber db[] = { IASM_EXTRA_CLOBBERS }; Note number of elements of db is 1. > struct iasm_op_clobber key; > struct iasm_op_clobber *r; > const char **clobbers; > int num; > > /* APPLE LOCAL LLVM */ > #if defined(TARGET_IASM_EXTRA_CLOBBERS) && defined(ENABLE_CHECKING) > /* Ensure that the table is sorted. */ > static int once; > if (once == 0) > { > size_t i; > once = 1; > for (i=0; i < sizeof (db) / sizeof(db[0]) - 1; ++i) Are you sure you want to subtract one from the size computation? Perhaps at one time this was null terminated? In any event (sizeof(db) / sizeof(db[0])) == 1, which if you subtract 1 from it is causing the unsigned range warning on the comparison with i. Not sure if this matters, but thought I'd point it out. > gcc_assert (iasm_op_clobber_comp (&db[i+1], &db[i]) >= 0); > } > #endif > From isanbard at gmail.com Mon Jan 15 21:42:23 2007 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 15 Jan 2007 21:42:23 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp Message-ID: <200701160342.l0G3gNbJ024565@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.135 -> 1.136 --- Log message: Fix for PR1095: http://llvm.org/PR1095 : LLVM would miscompile ASM dialects when compiling for PPC. Added dialects for the X86 and PPC backends. It defaults to "0", the first variant of a compound inline asm expression. --- Diffs of the changes: (+3 -3) AsmPrinter.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.135 llvm/lib/CodeGen/AsmPrinter.cpp:1.136 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.135 Sun Jan 14 20:27:26 2007 +++ llvm/lib/CodeGen/AsmPrinter.cpp Mon Jan 15 21:42:04 2007 @@ -698,9 +698,9 @@ O << TAI->getInlineAsmStart() << "\n\t"; - // The variant of the current asmprinter: FIXME: change. - int AsmPrinterVariant = 0; - + // The variant of the current asmprinter. + int AsmPrinterVariant = TAI->getAssemblerDialect(); + int CurVariant = -1; // The number of the {.|.|.} region we are in. const char *LastEmitted = AsmStr; // One past the last character emitted. From isanbard at gmail.com Mon Jan 15 21:42:27 2007 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 15 Jan 2007 21:42:27 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/2007-01-15-AsmDialect.ll Message-ID: <200701160342.l0G3gRUL024572@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/PowerPC: 2007-01-15-AsmDialect.ll added (r1.1) --- Log message: Fix for PR1095: http://llvm.org/PR1095 : LLVM would miscompile ASM dialects when compiling for PPC. Added dialects for the X86 and PPC backends. It defaults to "0", the first variant of a compound inline asm expression. --- Diffs of the changes: (+26 -0) 2007-01-15-AsmDialect.ll | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+) Index: llvm/test/Regression/CodeGen/PowerPC/2007-01-15-AsmDialect.ll diff -c /dev/null llvm/test/Regression/CodeGen/PowerPC/2007-01-15-AsmDialect.ll:1.1 *** /dev/null Mon Jan 15 21:42:14 2007 --- llvm/test/Regression/CodeGen/PowerPC/2007-01-15-AsmDialect.ll Mon Jan 15 21:42:04 2007 *************** *** 0 **** --- 1,26 ---- + ; RUN: llvm-as < %s | llc -march=ppc32 | grep cntlzw + + define i32 %foo() { + entry: + %retval = alloca i32, align 4 ; [#uses=2] + %tmp = alloca i32, align 4 ; [#uses=2] + %ctz_x = alloca i32, align 4 ; [#uses=3] + %ctz_c = alloca i32, align 4 ; [#uses=2] + "alloca point" = bitcast i32 0 to i32 ; [#uses=0] + store i32 61440, i32* %ctz_x + %tmp = load i32* %ctz_x ; [#uses=1] + %tmp1 = sub i32 0, %tmp ; [#uses=1] + %tmp2 = load i32* %ctz_x ; [#uses=1] + %tmp3 = and i32 %tmp1, %tmp2 ; [#uses=1] + %tmp4 = call i32 asm "$(cntlz$|cntlzw$) $0,$1", "=r,r,~{dirflag},~{fpsr},~{flags}"( i32 %tmp3 ) ; [#uses=1] + store i32 %tmp4, i32* %ctz_c + %tmp5 = load i32* %ctz_c ; [#uses=1] + store i32 %tmp5, i32* %tmp + %tmp6 = load i32* %tmp ; [#uses=1] + store i32 %tmp6, i32* %retval + br label %return + + return: ; preds = %entry + %retval = load i32* %retval ; [#uses=1] + ret i32 %retval + } From isanbard at gmail.com Mon Jan 15 21:42:30 2007 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 15 Jan 2007 21:42:30 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetAsmInfo.cpp Message-ID: <200701160342.l0G3gUte024577@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetAsmInfo.cpp updated: 1.12 -> 1.13 --- Log message: Fix for PR1095: http://llvm.org/PR1095 : LLVM would miscompile ASM dialects when compiling for PPC. Added dialects for the X86 and PPC backends. It defaults to "0", the first variant of a compound inline asm expression. --- Diffs of the changes: (+1 -0) TargetAsmInfo.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/TargetAsmInfo.cpp diff -u llvm/lib/Target/TargetAsmInfo.cpp:1.12 llvm/lib/Target/TargetAsmInfo.cpp:1.13 --- llvm/lib/Target/TargetAsmInfo.cpp:1.12 Sun Jan 14 00:27:21 2007 +++ llvm/lib/Target/TargetAsmInfo.cpp Mon Jan 15 21:42:04 2007 @@ -32,6 +32,7 @@ FunctionAddrSuffix(""), InlineAsmStart("#APP"), InlineAsmEnd("#NO_APP"), + AssemblerDialect(0), ZeroDirective("\t.zero\t"), ZeroDirectiveSuffix(0), AsciiDirective("\t.ascii\t"), From isanbard at gmail.com Mon Jan 15 21:42:30 2007 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 15 Jan 2007 21:42:30 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetAsmInfo.h Message-ID: <200701160342.l0G3gUAn024584@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetAsmInfo.h updated: 1.19 -> 1.20 --- Log message: Fix for PR1095: http://llvm.org/PR1095 : LLVM would miscompile ASM dialects when compiling for PPC. Added dialects for the X86 and PPC backends. It defaults to "0", the first variant of a compound inline asm expression. --- Diffs of the changes: (+8 -2) TargetAsmInfo.h | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Target/TargetAsmInfo.h diff -u llvm/include/llvm/Target/TargetAsmInfo.h:1.19 llvm/include/llvm/Target/TargetAsmInfo.h:1.20 --- llvm/include/llvm/Target/TargetAsmInfo.h:1.19 Sun Jan 14 00:27:21 2007 +++ llvm/include/llvm/Target/TargetAsmInfo.h Mon Jan 15 21:42:04 2007 @@ -89,7 +89,10 @@ /// emit before and after an inline assembly statement. const char *InlineAsmStart; // Defaults to "#APP\n" const char *InlineAsmEnd; // Defaults to "#NO_APP\n" - + + /// AssemblerDialect - Which dialect of an assembler variant to use. + unsigned AssemblerDialect; // Defaults to 0 + //===--- Data Emission Directives -------------------------------------===// /// ZeroDirective - this should be set to the directive used to get some @@ -128,7 +131,7 @@ /// Otherwise, it emits ".align log2(N)", e.g. 3 to align to an 8 byte /// boundary. bool AlignmentIsInBytes; // Defaults to true - + //===--- Section Switching Directives ---------------------------------===// /// SwitchToSectionDirective - This is the directive used when we want to @@ -343,6 +346,9 @@ const char *getInlineAsmEnd() const { return InlineAsmEnd; } + unsigned getAssemblerDialect() const { + return AssemblerDialect; + } const char *getZeroDirective() const { return ZeroDirective; } From isanbard at gmail.com Mon Jan 15 21:42:30 2007 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 15 Jan 2007 21:42:30 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86TargetAsmInfo.cpp X86TargetAsmInfo.h Message-ID: <200701160342.l0G3gU2G024591@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86TargetAsmInfo.cpp updated: 1.25 -> 1.26 X86TargetAsmInfo.h updated: 1.3 -> 1.4 --- Log message: Fix for PR1095: http://llvm.org/PR1095 : LLVM would miscompile ASM dialects when compiling for PPC. Added dialects for the X86 and PPC backends. It defaults to "0", the first variant of a compound inline asm expression. --- Diffs of the changes: (+8 -1) X86TargetAsmInfo.cpp | 7 +++++++ X86TargetAsmInfo.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) Index: llvm/lib/Target/X86/X86TargetAsmInfo.cpp diff -u llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.25 llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.26 --- llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.25 Sun Jan 14 20:27:26 2007 +++ llvm/lib/Target/X86/X86TargetAsmInfo.cpp Mon Jan 15 21:42:04 2007 @@ -21,6 +21,12 @@ #include "llvm/ADT/StringExtras.h" using namespace llvm; +// ASM variant to use. +enum { + X86_ATT = 0, + X86_INTEL = 1 +}; + static const char* x86_asm_table[] = {"{si}", "S", "{di}", "D", "{ax}", "a", @@ -38,6 +44,7 @@ // FIXME - Should be simplified. AsmTransCBE = x86_asm_table; + AssemblerDialect = X86_ATT; switch (Subtarget->TargetType) { case X86Subtarget::isDarwin: Index: llvm/lib/Target/X86/X86TargetAsmInfo.h diff -u llvm/lib/Target/X86/X86TargetAsmInfo.h:1.3 llvm/lib/Target/X86/X86TargetAsmInfo.h:1.4 --- llvm/lib/Target/X86/X86TargetAsmInfo.h:1.3 Tue Nov 28 19:14:06 2006 +++ llvm/lib/Target/X86/X86TargetAsmInfo.h Mon Jan 15 21:42:04 2007 @@ -17,7 +17,7 @@ #include "llvm/Target/TargetAsmInfo.h" namespace llvm { - + // Forward declaration. class X86TargetMachine; From isanbard at gmail.com Mon Jan 15 21:42:30 2007 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 15 Jan 2007 21:42:30 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Message-ID: <200701160342.l0G3gURu024594@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCTargetAsmInfo.cpp updated: 1.11 -> 1.12 --- Log message: Fix for PR1095: http://llvm.org/PR1095 : LLVM would miscompile ASM dialects when compiling for PPC. Added dialects for the X86 and PPC backends. It defaults to "0", the first variant of a compound inline asm expression. --- Diffs of the changes: (+8 -0) PPCTargetAsmInfo.cpp | 8 ++++++++ 1 files changed, 8 insertions(+) Index: llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp diff -u llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.11 llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.12 --- llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.11 Sun Jan 14 00:37:54 2007 +++ llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Mon Jan 15 21:42:04 2007 @@ -16,6 +16,12 @@ #include "llvm/Function.h" using namespace llvm; +// ASM variant to use. +enum { + PPC_OLD_MNEMONICS = 0, + PPC_NEW_MNEMONICS = 1 +}; + PPCTargetAsmInfo::PPCTargetAsmInfo(const PPCTargetMachine &TM) { bool isPPC64 = TM.getSubtargetImpl()->isPPC64(); @@ -26,6 +32,7 @@ LCOMMDirective = "\t.lcomm\t"; InlineAsmStart = "# InlineAsm Start"; InlineAsmEnd = "# InlineAsm End"; + AssemblerDialect = PPC_OLD_MNEMONICS; NeedsSet = true; AddressSize = isPPC64 ? 8 : 4; @@ -56,6 +63,7 @@ UsedDirective = "\t.no_dead_strip\t"; WeakRefDirective = "\t.weak_reference\t"; HiddenDirective = "\t.private_extern\t"; + AssemblerDialect = PPC_NEW_MNEMONICS; } LinuxTargetAsmInfo::LinuxTargetAsmInfo(const PPCTargetMachine &TM) From isanbard at gmail.com Mon Jan 15 22:13:19 2007 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 15 Jan 2007 22:13:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86TargetAsmInfo.cpp Message-ID: <200701160413.l0G4DJcD025155@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86TargetAsmInfo.cpp updated: 1.26 -> 1.27 --- Log message: Make inline ASM the INTEL one if it's in that emission mode. --- Diffs of the changes: (+4 -2) X86TargetAsmInfo.cpp | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/lib/Target/X86/X86TargetAsmInfo.cpp diff -u llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.26 llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.27 --- llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.26 Mon Jan 15 21:42:04 2007 +++ llvm/lib/Target/X86/X86TargetAsmInfo.cpp Mon Jan 15 22:13:03 2007 @@ -137,12 +137,12 @@ DwarfRangesSection = "\t.section\t.debug_ranges,\"dr\""; DwarfMacInfoSection = "\t.section\t.debug_macinfo,\"dr\""; break; - - break; + case X86Subtarget::isWindows: GlobalPrefix = "_"; HasDotTypeDotSizeDirective = false; break; + default: break; } @@ -169,6 +169,8 @@ TextSectionStartSuffix = "\tsegment 'CODE'"; DataSectionStartSuffix = "\tsegment 'DATA'"; SectionEndDirectiveSuffix = "\tends\n"; + + AssemblerDialect = X86_INTEL; } } From isanbard at gmail.com Mon Jan 15 22:15:36 2007 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 15 Jan 2007 22:15:36 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/2007-01-15-AsmDialect.ll Message-ID: <200701160415.l0G4FajU025207@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/PowerPC: 2007-01-15-AsmDialect.ll updated: 1.1 -> 1.2 --- Log message: Added a -mtriple flag to force darwin backend. --- Diffs of the changes: (+1 -1) 2007-01-15-AsmDialect.ll | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/CodeGen/PowerPC/2007-01-15-AsmDialect.ll diff -u llvm/test/Regression/CodeGen/PowerPC/2007-01-15-AsmDialect.ll:1.1 llvm/test/Regression/CodeGen/PowerPC/2007-01-15-AsmDialect.ll:1.2 --- llvm/test/Regression/CodeGen/PowerPC/2007-01-15-AsmDialect.ll:1.1 Mon Jan 15 21:42:04 2007 +++ llvm/test/Regression/CodeGen/PowerPC/2007-01-15-AsmDialect.ll Mon Jan 15 22:15:20 2007 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=ppc32 | grep cntlzw +; RUN: llvm-as < %s | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | grep cntlzw define i32 %foo() { entry: From rspencer at reidspencer.com Mon Jan 15 22:49:01 2007 From: rspencer at reidspencer.com (Reid Spencer) Date: Tue, 16 Jan 2007 04:49:01 +0000 Subject: [llvm-commits] [llvm-gcc] BITWIDTH.patch (for review only) Message-ID: <1168922941.7860.240.camel@bashful.x10sys.com> Here's a patch to give llvm-gcc the ability to specify arbitrary bit widths with a new "bitwidth" attribute. The attribute is used like this: int __attribute__((bitwidth(17))); int __attribute__((bitwidth(23))) My32BitInt; struct MyStruct { int __attribute__((bitwidth(5))) My5BitField; My32BitInt My32BitField; }; void func(int __attribute__((bitwidth(23))) ) {...} etc. Note that no LLVM backend can currently handle this. I will be working on making either the CBackEnd or LLI handle these correctly. Other targets may or may not get implemented. This patch has not been tested well (just Dejagnu) so please do not apply it. Reid. -------------- next part -------------- A non-text attachment was scrubbed... Name: BITWIDTH.patch Type: text/x-patch Size: 8061 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070116/a571ff5f/attachment.bin From sabre at nondot.org Mon Jan 15 22:55:41 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Jan 2007 22:55:41 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200701160455.l0G4tfdg026114@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.265 -> 1.266 --- Log message: add options to view the dags before the first or second pass of dag combine. --- Diffs of the changes: (+18 -0) DAGCombiner.cpp | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.265 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.266 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.265 Mon Jan 8 17:04:05 2007 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Jan 15 22:55:25 2007 @@ -46,6 +46,20 @@ STATISTIC(PostIndexedNodes, "Number of post-indexed nodes created"); namespace { +#ifndef NDEBUG + static cl::opt + ViewDAGCombine1("view-dag-combine1-dags", cl::Hidden, + cl::desc("Pop up a window to show dags before the first " + "dag combine pass")); + static cl::opt + ViewDAGCombine2("view-dag-combine2-dags", cl::Hidden, + cl::desc("Pop up a window to show dags before the second " + "dag combine pass")); +#else + static const bool ViewDAGCombine1 = false; + static const bool ViewDAGCombine2 = false; +#endif + static cl::opt CombinerAA("combiner-alias-analysis", cl::Hidden, cl::desc("Turn on alias analysis during testing")); @@ -4512,6 +4526,10 @@ // SelectionDAG::Combine - This is the entry point for the file. // void SelectionDAG::Combine(bool RunningAfterLegalize, AliasAnalysis &AA) { + if (!RunningAfterLegalize && ViewDAGCombine1) + viewGraph(); + if (RunningAfterLegalize && ViewDAGCombine2) + viewGraph(); /// run - This is the main entry point to this class. /// DAGCombiner(*this, AA).Run(RunningAfterLegalize); From sabre at nondot.org Mon Jan 15 23:59:06 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Jan 2007 23:59:06 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/2007-01-15-LoadSelectCycle.ll Message-ID: <200701160559.l0G5x6v1027405@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Generic: 2007-01-15-LoadSelectCycle.ll added (r1.1) --- Log message: new testcase for PR1114: http://llvm.org/PR1114 --- Diffs of the changes: (+12 -0) 2007-01-15-LoadSelectCycle.ll | 12 ++++++++++++ 1 files changed, 12 insertions(+) Index: llvm/test/Regression/CodeGen/Generic/2007-01-15-LoadSelectCycle.ll diff -c /dev/null llvm/test/Regression/CodeGen/Generic/2007-01-15-LoadSelectCycle.ll:1.1 *** /dev/null Mon Jan 15 23:59:00 2007 --- llvm/test/Regression/CodeGen/Generic/2007-01-15-LoadSelectCycle.ll Mon Jan 15 23:58:50 2007 *************** *** 0 **** --- 1,12 ---- + ; RUN: llvm-as < %s | llc + ; PR1114 + + declare i1 %foo() + + define i32 %test(i32* %A, i32* %B) { + %a = load i32* %A + %b = load i32* %B + %cond = call i1 %foo() + %c = select i1 %cond, i32 %a, i32 %b + ret i32 %c + } From sabre at nondot.org Tue Jan 16 00:00:15 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 16 Jan 2007 00:00:15 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200701160600.l0G60Fwr027455@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.266 -> 1.267 --- Log message: Fix PR1114: http://llvm.org/PR1114 and CodeGen/Generic/2007-01-15-LoadSelectCycle.ll by being careful when folding "c ? load p : load q" that C doesn't reach either load. If so, folding this into load (c ? p : q) will induce a cycle in the graph. --- Diffs of the changes: (+41 -25) DAGCombiner.cpp | 66 ++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 41 insertions(+), 25 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.266 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.267 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.266 Mon Jan 15 22:55:25 2007 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Jan 15 23:59:59 2007 @@ -3709,36 +3709,52 @@ // the right thing to do, but nothing uses srcvalues now. When they do, // turn SrcValue into a list of locations. SDOperand Addr; - if (TheSelect->getOpcode() == ISD::SELECT) - Addr = DAG.getNode(ISD::SELECT, LLD->getBasePtr().getValueType(), - TheSelect->getOperand(0), LLD->getBasePtr(), - RLD->getBasePtr()); - else - Addr = DAG.getNode(ISD::SELECT_CC, LLD->getBasePtr().getValueType(), + if (TheSelect->getOpcode() == ISD::SELECT) { + // Check that the condition doesn't reach either load. If so, folding + // this will induce a cycle into the DAG. + if (!LLD->isPredecessor(TheSelect->getOperand(0).Val) && + !RLD->isPredecessor(TheSelect->getOperand(0).Val)) { + Addr = DAG.getNode(ISD::SELECT, LLD->getBasePtr().getValueType(), + TheSelect->getOperand(0), LLD->getBasePtr(), + RLD->getBasePtr()); + } + } else { + // Check that the condition doesn't reach either load. If so, folding + // this will induce a cycle into the DAG. + if (!LLD->isPredecessor(TheSelect->getOperand(0).Val) && + !RLD->isPredecessor(TheSelect->getOperand(0).Val) && + !LLD->isPredecessor(TheSelect->getOperand(1).Val) && + !RLD->isPredecessor(TheSelect->getOperand(1).Val)) { + Addr = DAG.getNode(ISD::SELECT_CC, LLD->getBasePtr().getValueType(), TheSelect->getOperand(0), TheSelect->getOperand(1), LLD->getBasePtr(), RLD->getBasePtr(), TheSelect->getOperand(4)); - - SDOperand Load; - if (LLD->getExtensionType() == ISD::NON_EXTLOAD) - Load = DAG.getLoad(TheSelect->getValueType(0), LLD->getChain(), - Addr,LLD->getSrcValue(), LLD->getSrcValueOffset()); - else { - Load = DAG.getExtLoad(LLD->getExtensionType(), - TheSelect->getValueType(0), - LLD->getChain(), Addr, LLD->getSrcValue(), - LLD->getSrcValueOffset(), - LLD->getLoadedVT()); + } + } + + if (Addr.Val) { + SDOperand Load; + if (LLD->getExtensionType() == ISD::NON_EXTLOAD) + Load = DAG.getLoad(TheSelect->getValueType(0), LLD->getChain(), + Addr,LLD->getSrcValue(), + LLD->getSrcValueOffset()); + else { + Load = DAG.getExtLoad(LLD->getExtensionType(), + TheSelect->getValueType(0), + LLD->getChain(), Addr, LLD->getSrcValue(), + LLD->getSrcValueOffset(), + LLD->getLoadedVT()); + } + // Users of the select now use the result of the load. + CombineTo(TheSelect, Load); + + // Users of the old loads now use the new load's chain. We know the + // old-load value is dead now. + CombineTo(LHS.Val, Load.getValue(0), Load.getValue(1)); + CombineTo(RHS.Val, Load.getValue(0), Load.getValue(1)); + return true; } - // Users of the select now use the result of the load. - CombineTo(TheSelect, Load); - - // Users of the old loads now use the new load's chain. We know the - // old-load value is dead now. - CombineTo(LHS.Val, Load.getValue(0), Load.getValue(1)); - CombineTo(RHS.Val, Load.getValue(0), Load.getValue(1)); - return true; } } } From sabre at nondot.org Tue Jan 16 00:40:04 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 16 Jan 2007 00:40:04 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/README.txt Message-ID: <200701160640.l0G6e4rQ028299@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: README.txt updated: 1.53 -> 1.54 --- Log message: add a note: we need whole-function selectiondags :) --- Diffs of the changes: (+28 -0) README.txt | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+) Index: llvm/lib/Target/README.txt diff -u llvm/lib/Target/README.txt:1.53 llvm/lib/Target/README.txt:1.54 --- llvm/lib/Target/README.txt:1.53 Sat Dec 23 00:05:41 2006 +++ llvm/lib/Target/README.txt Tue Jan 16 00:39:48 2007 @@ -387,3 +387,31 @@ to enable further optimizations. //===---------------------------------------------------------------------===// + +Consider: + +typedef unsigned U32; +typedef unsigned long long U64; +int test (U32 *inst, U64 *regs) { + U64 effective_addr2; + U32 temp = *inst; + int r1 = (temp >> 20) & 0xf; + int b2 = (temp >> 16) & 0xf; + effective_addr2 = temp & 0xfff; + if (b2) effective_addr2 += regs[b2]; + b2 = (temp >> 12) & 0xf; + if (b2) effective_addr2 += regs[b2]; + effective_addr2 &= regs[4]; + if ((effective_addr2 & 3) == 0) + return 1; + return 0; +} + +Note that only the low 2 bits of effective_addr2 are used. On 32-bit systems, +we don't eliminate the computation of the top half of effective_addr2 because +we don't have whole-function selection dags. On x86, this means we use one +extra register for the function when effective_addr2 is declared as U64 than +when it is declared U32. + +//===---------------------------------------------------------------------===// + From gordonhenriksen at mac.com Tue Jan 16 00:48:49 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Tue, 16 Jan 2007 01:48:49 -0500 Subject: [llvm-commits] [patch] PR918 Message-ID: <6B56B8C9-B881-49C7-813B-D36BD8A3BDF9@mac.com> The attached patch fixes http://llvm.org/PR918 by preventing the C backend from emitting the problematic array typedefs. There's also a regression test. ? Gordon -------------- next part -------------- A non-text attachment was scrubbed... Name: PR918.tar.gz Type: application/x-gzip Size: 1042 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070116/ebdbab3f/attachment.gz From sabre at nondot.org Tue Jan 16 01:21:43 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 16 Jan 2007 01:21:43 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/CBackend/2007-01-15-NamedArrayType.ll Message-ID: <200701160721.l0G7Lh3u029208@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/CBackend: 2007-01-15-NamedArrayType.ll added (r1.1) --- Log message: testcase for PR918: http://llvm.org/PR918 --- Diffs of the changes: (+11 -0) 2007-01-15-NamedArrayType.ll | 11 +++++++++++ 1 files changed, 11 insertions(+) Index: llvm/test/Regression/CodeGen/CBackend/2007-01-15-NamedArrayType.ll diff -c /dev/null llvm/test/Regression/CodeGen/CBackend/2007-01-15-NamedArrayType.ll:1.1 *** /dev/null Tue Jan 16 01:21:38 2007 --- llvm/test/Regression/CodeGen/CBackend/2007-01-15-NamedArrayType.ll Tue Jan 16 01:21:28 2007 *************** *** 0 **** --- 1,11 ---- + ; RUN: llvm-as < %s | llc -march=c | not grep fixarray_array3 + ; PR918 + + %structtype_s = type { i32 } + %fixarray_array3 = type [3 x %structtype_s] + + define i32 %witness(%fixarray_array3* %p) { + %q = getelementptr %fixarray_array3* %p, i32 0, i32 0, i32 0 + %v = load i32* %q + ret i32 %v + } From sabre at nondot.org Tue Jan 16 01:22:39 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 16 Jan 2007 01:22:39 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/CBackend.cpp Message-ID: <200701160722.l0G7MdTh029263@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: CBackend.cpp updated: 1.317 -> 1.318 --- Log message: Fix PR918: http://llvm.org/PR918 by only using typedefs to name struct types. This makes the later type ordering stuff work better. This fixes PR918: http://llvm.org/PR918 and CodeGen/CBackend/2007-01-15-NamedArrayType.ll Patch by Gordon Henriksen. --- Diffs of the changes: (+15 -8) CBackend.cpp | 23 +++++++++++++++-------- 1 files changed, 15 insertions(+), 8 deletions(-) Index: llvm/lib/Target/CBackend/CBackend.cpp diff -u llvm/lib/Target/CBackend/CBackend.cpp:1.317 llvm/lib/Target/CBackend/CBackend.cpp:1.318 --- llvm/lib/Target/CBackend/CBackend.cpp:1.317 Sun Jan 14 20:27:26 2007 +++ llvm/lib/Target/CBackend/CBackend.cpp Tue Jan 16 01:22:23 2007 @@ -269,13 +269,19 @@ for (TypeSymbolTable::iterator TI = TST.begin(), TE = TST.end(); TI != TE; ) { TypeSymbolTable::iterator I = TI++; - - // If this is not used, remove it from the symbol table. - std::set::iterator UTI = UT.find(I->second); - if (UTI == UT.end()) + + // If this isn't a struct type, remove it from our set of types to name. + // This simplifies emission later. + if (!isa(I->second)) { TST.remove(I); - else - UT.erase(UTI); // Only keep one name for this type. + } else { + // If this is not used, remove it from the symbol table. + std::set::iterator UTI = UT.find(I->second); + if (UTI == UT.end()) + TST.remove(I); + else + UT.erase(UTI); // Only keep one name for this type. + } } // UT now contains types that are not named. Loop over it, naming @@ -1694,10 +1700,11 @@ Out << '\n'; - // Now we can print out typedefs... + // Now we can print out typedefs. Above, we guaranteed that this can only be + // for struct types. Out << "/* Typedefs */\n"; for (I = TST.begin(); I != End; ++I) { - const Type *Ty = cast(I->second); + const StructType *Ty = cast(I->second); std::string Name = "l_" + Mang->makeNameProper(I->first); Out << "typedef "; printType(Out, Ty, false, Name); From asl at math.spbu.ru Tue Jan 16 02:17:35 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 16 Jan 2007 11:17:35 +0300 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86TargetAsmInfo.cpp X86TargetAsmInfo.h In-Reply-To: <200701160342.l0G3gU2G024591.SS1897SS@zion.cs.uiuc.edu> References: <200701160342.l0G3gU2G024591.SS1897SS@zion.cs.uiuc.edu> Message-ID: <1168935455.14117.1.camel@asl.dorms.spbu.ru> Hello, Bill. > +// ASM variant to use. > +enum { > + X86_ATT = 0, > + X86_INTEL = 1 > +}; There is already assembler flavour defined in Subtarget. Why do you need some more? -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University. From isanbard at gmail.com Tue Jan 16 02:57:31 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 16 Jan 2007 00:57:31 -0800 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86TargetAsmInfo.cpp X86TargetAsmInfo.h In-Reply-To: <1168935455.14117.1.camel@asl.dorms.spbu.ru> References: <200701160342.l0G3gU2G024591.SS1897SS@zion.cs.uiuc.edu> <1168935455.14117.1.camel@asl.dorms.spbu.ru> Message-ID: On Jan 16, 2007, at 12:17 AM, Anton Korobeynikov wrote: > Hello, Bill. > >> +// ASM variant to use. >> +enum { >> + X86_ATT = 0, >> + X86_INTEL = 1 >> +}; > There is already assembler flavour defined in Subtarget. Why do you > need > some more? > Hmm...Good question. It should use this information to at least update the TargetAsmInfo structure. Thanks for catching this. -bw From isanbard at gmail.com Tue Jan 16 03:29:38 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 16 Jan 2007 03:29:38 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCSubtarget.cpp PPCSubtarget.h PPCTargetAsmInfo.cpp Message-ID: <200701160929.l0G9TcR3007633@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCSubtarget.cpp updated: 1.27 -> 1.28 PPCSubtarget.h updated: 1.20 -> 1.21 PPCTargetAsmInfo.cpp updated: 1.12 -> 1.13 --- Log message: Instead of yet another enum indicating the "assembly language flavor", just use the one that's in the subtarget. --- Diffs of the changes: (+16 -9) PPCSubtarget.cpp | 3 +++ PPCSubtarget.h | 13 ++++++++++++- PPCTargetAsmInfo.cpp | 9 +-------- 3 files changed, 16 insertions(+), 9 deletions(-) Index: llvm/lib/Target/PowerPC/PPCSubtarget.cpp diff -u llvm/lib/Target/PowerPC/PPCSubtarget.cpp:1.27 llvm/lib/Target/PowerPC/PPCSubtarget.cpp:1.28 --- llvm/lib/Target/PowerPC/PPCSubtarget.cpp:1.27 Mon Dec 11 17:22:45 2006 +++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp Tue Jan 16 03:29:16 2007 @@ -112,6 +112,9 @@ // Set up darwin-specific properties. if (IsDarwin) { HasLazyResolverStubs = true; + AsmFlavor = NewMnemonic; + } else { + AsmFlavor = OldMnemonic; } } Index: llvm/lib/Target/PowerPC/PPCSubtarget.h diff -u llvm/lib/Target/PowerPC/PPCSubtarget.h:1.20 llvm/lib/Target/PowerPC/PPCSubtarget.h:1.21 --- llvm/lib/Target/PowerPC/PPCSubtarget.h:1.20 Tue Dec 12 14:57:08 2006 +++ llvm/lib/Target/PowerPC/PPCSubtarget.h Tue Jan 16 03:29:16 2007 @@ -40,6 +40,10 @@ class TargetMachine; class PPCSubtarget : public TargetSubtarget { +public: + enum AsmWriterFlavorTy { + OldMnemonic, NewMnemonic, Unset + }; protected: const TargetMachine &TM; @@ -53,6 +57,9 @@ /// Which cpu directive was used. unsigned DarwinDirective; + /// AsmFlavor - Which PPC asm dialect to use. + AsmWriterFlavorTy AsmFlavor; + /// Used by the ISel to turn in optimizations for POWER4-derived architectures bool IsGigaProcessor; bool Has64BitSupport; @@ -120,8 +127,12 @@ bool hasSTFIWX() const { return HasSTFIWX; } bool hasAltivec() const { return HasAltivec; } bool isGigaProcessor() const { return IsGigaProcessor; } - + bool isDarwin() const { return IsDarwin; } + + unsigned getAsmFlavor() const { + return AsmFlavor != Unset ? unsigned(AsmFlavor) : 0; + } }; } // End llvm namespace Index: llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp diff -u llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.12 llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.13 --- llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.12 Mon Jan 15 21:42:04 2007 +++ llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Tue Jan 16 03:29:16 2007 @@ -16,12 +16,6 @@ #include "llvm/Function.h" using namespace llvm; -// ASM variant to use. -enum { - PPC_OLD_MNEMONICS = 0, - PPC_NEW_MNEMONICS = 1 -}; - PPCTargetAsmInfo::PPCTargetAsmInfo(const PPCTargetMachine &TM) { bool isPPC64 = TM.getSubtargetImpl()->isPPC64(); @@ -32,7 +26,7 @@ LCOMMDirective = "\t.lcomm\t"; InlineAsmStart = "# InlineAsm Start"; InlineAsmEnd = "# InlineAsm End"; - AssemblerDialect = PPC_OLD_MNEMONICS; + AssemblerDialect = TM.getSubtargetImpl()->getAsmFlavor(); NeedsSet = true; AddressSize = isPPC64 ? 8 : 4; @@ -63,7 +57,6 @@ UsedDirective = "\t.no_dead_strip\t"; WeakRefDirective = "\t.weak_reference\t"; HiddenDirective = "\t.private_extern\t"; - AssemblerDialect = PPC_NEW_MNEMONICS; } LinuxTargetAsmInfo::LinuxTargetAsmInfo(const PPCTargetMachine &TM) From isanbard at gmail.com Tue Jan 16 03:29:38 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 16 Jan 2007 03:29:38 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86Subtarget.h X86TargetAsmInfo.cpp Message-ID: <200701160929.l0G9Tci9007634@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86Subtarget.h updated: 1.26 -> 1.27 X86TargetAsmInfo.cpp updated: 1.27 -> 1.28 --- Log message: Instead of yet another enum indicating the "assembly language flavor", just use the one that's in the subtarget. --- Diffs of the changes: (+6 -9) X86Subtarget.h | 4 ++++ X86TargetAsmInfo.cpp | 11 ++--------- 2 files changed, 6 insertions(+), 9 deletions(-) Index: llvm/lib/Target/X86/X86Subtarget.h diff -u llvm/lib/Target/X86/X86Subtarget.h:1.26 llvm/lib/Target/X86/X86Subtarget.h:1.27 --- llvm/lib/Target/X86/X86Subtarget.h:1.26 Fri Jan 12 13:20:47 2007 +++ llvm/lib/Target/X86/X86Subtarget.h Tue Jan 16 03:29:17 2007 @@ -111,6 +111,10 @@ bool has3DNow() const { return X863DNowLevel >= ThreeDNow; } bool has3DNowA() const { return X863DNowLevel >= ThreeDNowA; } + unsigned getAsmFlavor() const { + return AsmFlavor != Unset ? unsigned(AsmFlavor) : 0; + } + bool isFlavorAtt() const { return AsmFlavor == ATT; } bool isFlavorIntel() const { return AsmFlavor == Intel; } Index: llvm/lib/Target/X86/X86TargetAsmInfo.cpp diff -u llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.27 llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.28 --- llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.27 Mon Jan 15 22:13:03 2007 +++ llvm/lib/Target/X86/X86TargetAsmInfo.cpp Tue Jan 16 03:29:17 2007 @@ -21,12 +21,6 @@ #include "llvm/ADT/StringExtras.h" using namespace llvm; -// ASM variant to use. -enum { - X86_ATT = 0, - X86_INTEL = 1 -}; - static const char* x86_asm_table[] = {"{si}", "S", "{di}", "D", "{ax}", "a", @@ -44,7 +38,6 @@ // FIXME - Should be simplified. AsmTransCBE = x86_asm_table; - AssemblerDialect = X86_ATT; switch (Subtarget->TargetType) { case X86Subtarget::isDarwin: @@ -169,9 +162,9 @@ TextSectionStartSuffix = "\tsegment 'CODE'"; DataSectionStartSuffix = "\tsegment 'DATA'"; SectionEndDirectiveSuffix = "\tends\n"; - - AssemblerDialect = X86_INTEL; } + + AssemblerDialect = Subtarget->getAsmFlavor(); } bool X86TargetAsmInfo::LowerToBSwap(CallInst *CI) const { From asl at math.spbu.ru Tue Jan 16 10:42:13 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 16 Jan 2007 10:42:13 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86COFF.h X86ATTAsmPrinter.cpp X86AsmPrinter.cpp Message-ID: <200701161642.l0GGgDFQ015379@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86COFF.h added (r1.1) X86ATTAsmPrinter.cpp updated: 1.89 -> 1.90 X86AsmPrinter.cpp updated: 1.227 -> 1.228 --- Log message: Emit symbol type information for ELF/COFF targets --- Diffs of the changes: (+128 -6) X86ATTAsmPrinter.cpp | 27 ++++++++++++--- X86AsmPrinter.cpp | 18 +++++++++- X86COFF.h | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 128 insertions(+), 6 deletions(-) Index: llvm/lib/Target/X86/X86COFF.h diff -c /dev/null llvm/lib/Target/X86/X86COFF.h:1.1 *** /dev/null Tue Jan 16 10:42:07 2007 --- llvm/lib/Target/X86/X86COFF.h Tue Jan 16 10:41:57 2007 *************** *** 0 **** --- 1,89 ---- + //===--- X86COFF.h - Some definitions from COFF documentations ------------===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the LLVM research group and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file just defines some symbols found in COFF documentation. They are + // used to emit function type information for COFF targets (Cygwin/Mingw32). + // + //===----------------------------------------------------------------------===// + + #ifndef X86COFF_H + #define X86COFF_H + + namespace COFF + { + enum StorageClass { + C_EFCN = -1, // physical end of function + C_NULL = 0, + C_AUTO = 1, // external definition + C_EXT = 2, // external symbol + C_STAT = 3, // static + C_REG = 4, // register variable + C_EXTDEF = 5, // external definition + C_LABEL = 6, // label + C_ULABEL = 7, // undefined label + C_MOS = 8, // member of structure + C_ARG = 9, // function argument + C_STRTAG = 10, // structure tag + C_MOU = 11, // member of union + C_UNTAG = 12, // union tag + C_TPDEF = 13, // type definition + C_USTATIC = 14, // undefined static + C_ENTAG = 15, // enumeration tag + C_MOE = 16, // member of enumeration + C_REGPARM = 17, // register parameter + C_FIELD = 18, // bit field + + C_BLOCK = 100, // ".bb" or ".eb" + C_FCN = 101, // ".bf" or ".ef" + C_EOS = 102, // end of structure + C_FILE = 103, // file name + C_LINE = 104, // dummy class for line number entry + C_ALIAS = 105, // duplicate tag + C_HIDDEN = 106 + }; + + enum SymbolType { + T_NULL = 0, // no type info + T_ARG = 1, // function argument (only used by compiler) + T_VOID = 1, + T_CHAR = 2, // character + T_SHORT = 3, // short integer + T_INT = 4, // integer + T_LONG = 5, // long integer + T_FLOAT = 6, // floating point + T_DOUBLE = 7, // double word + T_STRUCT = 8, // structure + T_UNION = 9, // union + T_ENUM = 10, // enumeration + T_MOE = 11, // member of enumeration + T_UCHAR = 12, // unsigned character + T_USHORT = 13, // unsigned short + T_UINT = 14, // unsigned integer + T_ULONG = 15 // unsigned long + }; + + enum SymbolDerivedType { + DT_NON = 0, // no derived type + DT_PTR = 1, // pointer + DT_FCN = 2, // function + DT_ARY = 3 // array + }; + + enum TypePacking { + N_BTMASK = 017, + N_TMASK = 060, + N_TMASK1 = 0300, + N_TMASK2 = 0360, + N_BTSHFT = 4, + N_TSHIFT = 2 + }; + + } + + #endif // X86COFF_H Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.89 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.90 --- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.89 Sun Jan 14 00:29:53 2007 +++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Tue Jan 16 10:41:57 2007 @@ -16,6 +16,7 @@ #define DEBUG_TYPE "asm-printer" #include "X86ATTAsmPrinter.h" #include "X86.h" +#include "X86COFF.h" #include "X86MachineFunctionInfo.h" #include "X86TargetMachine.h" #include "X86TargetAsmInfo.h" @@ -128,7 +129,17 @@ if (F->hasHiddenVisibility()) if (const char *Directive = TAI->getHiddenDirective()) O << Directive << CurrentFnName << "\n"; - + + if (Subtarget->isTargetELF()) + O << "\t.type " << CurrentFnName << ", at function\n"; + else if (Subtarget->isTargetCygMing()) { + O << "\t.def\t " << CurrentFnName + << ";\t.scl\t" << + (F->getLinkage() == Function::InternalLinkage ? COFF::C_STAT : COFF::C_EXT) + << ";\t.type\t" << (COFF::DT_FCN << COFF::N_BTSHFT) + << ";\t.endef\n"; + } + O << CurrentFnName << ":\n"; // Add some workaround for linkonce linkage on Cygwin\MinGW if (Subtarget->isTargetCygMing() && @@ -289,10 +300,16 @@ } O << Name; - if (Subtarget->isPICStyleGOT() && isCallOp && isa(GV)) { - // Assemble call via PLT for non-local symbols - if (!isHidden || isExt) - O << "@PLT"; + if (isCallOp && isa(GV)) { + if (Subtarget->isPICStyleGOT()) { + // Assemble call via PLT for non-local symbols + if (!isHidden || GV->isExternal()) + O << "@PLT"; + } + if (Subtarget->isTargetCygMing() && GV->isExternal()) { + // Save function name for later type emission + FnStubs.insert(Name); + } } } Index: llvm/lib/Target/X86/X86AsmPrinter.cpp diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.227 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.228 --- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.227 Sun Jan 14 00:29:53 2007 +++ llvm/lib/Target/X86/X86AsmPrinter.cpp Tue Jan 16 10:41:57 2007 @@ -16,6 +16,7 @@ #include "X86AsmPrinter.h" #include "X86ATTAsmPrinter.h" +#include "X86COFF.h" #include "X86IntelAsmPrinter.h" #include "X86MachineFunctionInfo.h" #include "X86Subtarget.h" @@ -249,6 +250,9 @@ if (I->hasHiddenVisibility()) if (const char *Directive = TAI->getHiddenDirective()) O << Directive << name << "\n"; + + if (Subtarget->isTargetELF()) + O << "\t.type " << name << ", at object\n"; } // Output linker support code for dllexported globals @@ -308,7 +312,19 @@ // linker can safely perform dead code stripping. Since LLVM never // generates code that does this, it is always safe to set. O << "\t.subsections_via_symbols\n"; - } else if (Subtarget->isTargetELF() || Subtarget->isTargetCygMing()) { + } else if (Subtarget->isTargetCygMing()) { + // Emit type information for external functions + for (std::set::iterator i = FnStubs.begin(), e = FnStubs.end(); + i != e; ++i) { + O << "\t.def\t " << *i + << ";\t.scl\t" << COFF::C_EXT + << ";\t.type\t" << (COFF::DT_FCN << COFF::N_BTSHFT) + << ";\t.endef\n"; + } + + // Emit final debug information. + DW.EndModule(); + } else if (Subtarget->isTargetELF()) { // Emit final debug information. DW.EndModule(); } From rspencer at reidspencer.com Tue Jan 16 10:52:42 2007 From: rspencer at reidspencer.com (Reid Spencer) Date: Tue, 16 Jan 2007 08:52:42 -0800 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86COFF.h X86ATTAsmPrinter.cpp X86AsmPrinter.cpp In-Reply-To: <200701161642.l0GGgDFQ015379@zion.cs.uiuc.edu> References: <200701161642.l0GGgDFQ015379@zion.cs.uiuc.edu> Message-ID: <1168966362.12773.5.camel@bashful.x10sys.com> On Tue, 2007-01-16 at 10:42 -0600, Anton Korobeynikov wrote: > > Changes in directory llvm/lib/Target/X86: > > X86COFF.h added (r1.1) > X86ATTAsmPrinter.cpp updated: 1.89 -> 1.90 > X86AsmPrinter.cpp updated: 1.227 -> 1.228 > --- > Log message: > > Emit symbol type information for ELF/COFF targets Anton, a few comments. > > > --- > Diffs of the changes: (+128 -6) > > X86ATTAsmPrinter.cpp | 27 ++++++++++++--- > X86AsmPrinter.cpp | 18 +++++++++- > X86COFF.h | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 128 insertions(+), 6 deletions(-) > > > Index: llvm/lib/Target/X86/X86COFF.h > diff -c /dev/null llvm/lib/Target/X86/X86COFF.h:1.1 > *** /dev/null Tue Jan 16 10:42:07 2007 > --- llvm/lib/Target/X86/X86COFF.h Tue Jan 16 10:41:57 2007 > *************** > *** 0 **** > --- 1,89 ---- > + //===--- X86COFF.h - Some definitions from COFF documentations ------------===// > + // > + // The LLVM Compiler Infrastructure > + // > + // This file was developed by the LLVM research group and is distributed under This was developed by you, not the LLVM research group :) > + // the University of Illinois Open Source License. See LICENSE.TXT for details. > + // > + //===----------------------------------------------------------------------===// > + // > + // This file just defines some symbols found in COFF documentation. They are > + // used to emit function type information for COFF targets (Cygwin/Mingw32). > + // > + //===----------------------------------------------------------------------===// > + > + #ifndef X86COFF_H > + #define X86COFF_H > + > + namespace COFF > + { Please provide a comment for StorageClass > + enum StorageClass { > + C_EFCN = -1, // physical end of function Please use ///< for comment so doxygen picks them up. Same for all those below. > + C_NULL = 0, Perhaps explain this one's usage in a comment > + C_AUTO = 1, // external definition > + C_EXT = 2, // external symbol > + C_STAT = 3, // static > + C_REG = 4, // register variable > + C_EXTDEF = 5, // external definition > + C_LABEL = 6, // label > + C_ULABEL = 7, // undefined label > + C_MOS = 8, // member of structure > + C_ARG = 9, // function argument > + C_STRTAG = 10, // structure tag > + C_MOU = 11, // member of union > + C_UNTAG = 12, // union tag > + C_TPDEF = 13, // type definition > + C_USTATIC = 14, // undefined static > + C_ENTAG = 15, // enumeration tag > + C_MOE = 16, // member of enumeration > + C_REGPARM = 17, // register parameter > + C_FIELD = 18, // bit field > + > + C_BLOCK = 100, // ".bb" or ".eb" > + C_FCN = 101, // ".bf" or ".ef" > + C_EOS = 102, // end of structure > + C_FILE = 103, // file name > + C_LINE = 104, // dummy class for line number entry > + C_ALIAS = 105, // duplicate tag > + C_HIDDEN = 106 > + }; > + > + enum SymbolType { Comment needed. > + T_NULL = 0, // no type info Again, ///< > + T_ARG = 1, // function argument (only used by compiler) > + T_VOID = 1, Comment needed. > + T_CHAR = 2, // character > + T_SHORT = 3, // short integer > + T_INT = 4, // integer > + T_LONG = 5, // long integer > + T_FLOAT = 6, // floating point > + T_DOUBLE = 7, // double word > + T_STRUCT = 8, // structure > + T_UNION = 9, // union > + T_ENUM = 10, // enumeration > + T_MOE = 11, // member of enumeration > + T_UCHAR = 12, // unsigned character > + T_USHORT = 13, // unsigned short > + T_UINT = 14, // unsigned integer > + T_ULONG = 15 // unsigned long > + }; > + > + enum SymbolDerivedType { Comments. > + DT_NON = 0, // no derived type > + DT_PTR = 1, // pointer > + DT_FCN = 2, // function > + DT_ARY = 3 // array > + }; > + > + enum TypePacking { > + N_BTMASK = 017, Please add comments for each of these. Also, are octal values the most appropriate here? Hex values are more understandable to most. > + N_TMASK = 060, > + N_TMASK1 = 0300, > + N_TMASK2 = 0360, > + N_BTSHFT = 4, > + N_TSHIFT = 2 > + }; > + > + } > + > + #endif // X86COFF_H > > > Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp > diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.89 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.90 > --- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.89 Sun Jan 14 00:29:53 2007 > +++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Tue Jan 16 10:41:57 2007 > @@ -16,6 +16,7 @@ > #define DEBUG_TYPE "asm-printer" > #include "X86ATTAsmPrinter.h" > #include "X86.h" > +#include "X86COFF.h" > #include "X86MachineFunctionInfo.h" > #include "X86TargetMachine.h" > #include "X86TargetAsmInfo.h" > @@ -128,7 +129,17 @@ > if (F->hasHiddenVisibility()) > if (const char *Directive = TAI->getHiddenDirective()) > O << Directive << CurrentFnName << "\n"; > - > + > + if (Subtarget->isTargetELF()) > + O << "\t.type " << CurrentFnName << ", at function\n"; > + else if (Subtarget->isTargetCygMing()) { > + O << "\t.def\t " << CurrentFnName > + << ";\t.scl\t" << > + (F->getLinkage() == Function::InternalLinkage ? COFF::C_STAT : COFF::C_EXT) > + << ";\t.type\t" << (COFF::DT_FCN << COFF::N_BTSHFT) > + << ";\t.endef\n"; > + } > + > O << CurrentFnName << ":\n"; > // Add some workaround for linkonce linkage on Cygwin\MinGW > if (Subtarget->isTargetCygMing() && > @@ -289,10 +300,16 @@ > } > O << Name; > > - if (Subtarget->isPICStyleGOT() && isCallOp && isa(GV)) { > - // Assemble call via PLT for non-local symbols > - if (!isHidden || isExt) > - O << "@PLT"; > + if (isCallOp && isa(GV)) { > + if (Subtarget->isPICStyleGOT()) { > + // Assemble call via PLT for non-local symbols Please define what PLT means in the comment. > + if (!isHidden || GV->isExternal()) > + O << "@PLT"; > + } > + if (Subtarget->isTargetCygMing() && GV->isExternal()) { > + // Save function name for later type emission > + FnStubs.insert(Name); > + } > } > } > > > > Index: llvm/lib/Target/X86/X86AsmPrinter.cpp > diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.227 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.228 > --- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.227 Sun Jan 14 00:29:53 2007 > +++ llvm/lib/Target/X86/X86AsmPrinter.cpp Tue Jan 16 10:41:57 2007 > @@ -16,6 +16,7 @@ > > #include "X86AsmPrinter.h" > #include "X86ATTAsmPrinter.h" > +#include "X86COFF.h" > #include "X86IntelAsmPrinter.h" > #include "X86MachineFunctionInfo.h" > #include "X86Subtarget.h" > @@ -249,6 +250,9 @@ > if (I->hasHiddenVisibility()) > if (const char *Directive = TAI->getHiddenDirective()) > O << Directive << name << "\n"; > + > + if (Subtarget->isTargetELF()) > + O << "\t.type " << name << ", at object\n"; > } > > // Output linker support code for dllexported globals > @@ -308,7 +312,19 @@ > // linker can safely perform dead code stripping. Since LLVM never > // generates code that does this, it is always safe to set. > O << "\t.subsections_via_symbols\n"; > - } else if (Subtarget->isTargetELF() || Subtarget->isTargetCygMing()) { > + } else if (Subtarget->isTargetCygMing()) { > + // Emit type information for external functions > + for (std::set::iterator i = FnStubs.begin(), e = FnStubs.end(); > + i != e; ++i) { > + O << "\t.def\t " << *i > + << ";\t.scl\t" << COFF::C_EXT > + << ";\t.type\t" << (COFF::DT_FCN << COFF::N_BTSHFT) > + << ";\t.endef\n"; > + } > + > + // Emit final debug information. > + DW.EndModule(); > + } else if (Subtarget->isTargetELF()) { > // Emit final debug information. > DW.EndModule(); > } > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Tue Jan 16 11:51:56 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 16 Jan 2007 11:51:56 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86Subtarget.h Message-ID: <200701161751.l0GHpusM016890@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86Subtarget.h updated: 1.27 -> 1.28 --- Log message: document some subtlety --- Diffs of the changes: (+3 -1) X86Subtarget.h | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/lib/Target/X86/X86Subtarget.h diff -u llvm/lib/Target/X86/X86Subtarget.h:1.27 llvm/lib/Target/X86/X86Subtarget.h:1.28 --- llvm/lib/Target/X86/X86Subtarget.h:1.27 Tue Jan 16 03:29:17 2007 +++ llvm/lib/Target/X86/X86Subtarget.h Tue Jan 16 11:51:40 2007 @@ -32,7 +32,9 @@ class X86Subtarget : public TargetSubtarget { public: enum AsmWriterFlavorTy { - ATT, Intel, Unset + // Note: This numbering has to match the GCC assembler dialects for inline + // asm alternatives to work right. + ATT = 0, Intel = 1, Unset }; protected: enum X86SSEEnum { From llvm at cs.uiuc.edu Tue Jan 16 12:05:42 2007 From: llvm at cs.uiuc.edu (LLVM) Date: Tue, 16 Jan 2007 12:05:42 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Integer/ Message-ID: <200701161805.l0GI5g7t017328@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Integer: --- Log message: Directory /var/cvs/llvm/llvm/test/Regression/Integer added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From sabre at nondot.org Tue Jan 16 12:03:00 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 16 Jan 2007 12:03:00 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/CBackend.cpp Message-ID: <200701161803.l0GI30IR017265@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: CBackend.cpp updated: 1.318 -> 1.319 --- Log message: Fix SMG2000 with the CBE: opaque types need names too. --- Diffs of the changes: (+8 -10) CBackend.cpp | 18 ++++++++---------- 1 files changed, 8 insertions(+), 10 deletions(-) Index: llvm/lib/Target/CBackend/CBackend.cpp diff -u llvm/lib/Target/CBackend/CBackend.cpp:1.318 llvm/lib/Target/CBackend/CBackend.cpp:1.319 --- llvm/lib/Target/CBackend/CBackend.cpp:1.318 Tue Jan 16 01:22:23 2007 +++ llvm/lib/Target/CBackend/CBackend.cpp Tue Jan 16 12:02:45 2007 @@ -272,7 +272,7 @@ // If this isn't a struct type, remove it from our set of types to name. // This simplifies emission later. - if (!isa(I->second)) { + if (!isa(I->second) && !isa(I->second)) { TST.remove(I); } else { // If this is not used, remove it from the symbol table. @@ -1691,23 +1691,21 @@ // Print out forward declarations for structure types before anything else! Out << "/* Structure forward decls */\n"; - for (; I != End; ++I) - if (const Type *STy = dyn_cast(I->second)) { - std::string Name = "struct l_" + Mang->makeNameProper(I->first); - Out << Name << ";\n"; - TypeNames.insert(std::make_pair(STy, Name)); - } + for (; I != End; ++I) { + std::string Name = "struct l_" + Mang->makeNameProper(I->first); + Out << Name << ";\n"; + TypeNames.insert(std::make_pair(I->second, Name)); + } Out << '\n'; // Now we can print out typedefs. Above, we guaranteed that this can only be - // for struct types. + // for struct or opaque types. Out << "/* Typedefs */\n"; for (I = TST.begin(); I != End; ++I) { - const StructType *Ty = cast(I->second); std::string Name = "l_" + Mang->makeNameProper(I->first); Out << "typedef "; - printType(Out, Ty, false, Name); + printType(Out, I->second, false, Name); Out << ";\n"; } From reid at x10sys.com Tue Jan 16 12:08:38 2007 From: reid at x10sys.com (Reid Spencer) Date: Tue, 16 Jan 2007 12:08:38 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Integer/.cvsignore BitArith.ll BitBit.ll BitCast.ll BitIcmp.ll BitMem.ll BitMisc.ll BitPacked.ll a15.ll a15.ll.out a17.ll a17.ll.out a31.ll a31.ll.out a33.ll a33.ll.out a63.ll a63.ll.out a7.ll a7.ll.out a9.ll a9.ll.out alignment_bt.ll basictest_bt.ll calltest_bt.ll cfgstructures_bt.ll constexpr_bt.ll constpointer_bt.ll dg.exp fold-fpcast_bt.ll forwardreftest_bt.ll globalredefinition_bt.ll globalvars_bt.ll indirectcall2_bt.ll indirectcall_bt.ll instructions_bt.ll newcasts_bt.ll opaquetypes_bt.ll packed_bt.ll packed_cmp_bt.ll packed_struct_bt.ll paramattrs_bt.ll properties_bt.ll prototype_bt.ll recursivetype_bt.ll simplecalltest_bt.ll small_bt.ll testalloca_bt.ll testarith_bt.ll testconstants_bt.ll testicmp_bt.ll testlogical_bt.ll testlogical_new_bt.ll testmemory_bt.ll testswitch_bt.ll testvarargs_bt.ll undefined_bt.ll unreachable_bt.ll varargs_bt.ll varargs_new_bt.ll Message-ID: <200701161808.l0GI8cMH017502@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Integer: .cvsignore added (r1.1) BitArith.ll added (r1.1) BitBit.ll added (r1.1) BitCast.ll added (r1.1) BitIcmp.ll added (r1.1) BitMem.ll added (r1.1) BitMisc.ll added (r1.1) BitPacked.ll added (r1.1) a15.ll added (r1.1) a15.ll.out added (r1.1) a17.ll added (r1.1) a17.ll.out added (r1.1) a31.ll added (r1.1) a31.ll.out added (r1.1) a33.ll added (r1.1) a33.ll.out added (r1.1) a63.ll added (r1.1) a63.ll.out added (r1.1) a7.ll added (r1.1) a7.ll.out added (r1.1) a9.ll added (r1.1) a9.ll.out added (r1.1) alignment_bt.ll added (r1.1) basictest_bt.ll added (r1.1) calltest_bt.ll added (r1.1) cfgstructures_bt.ll added (r1.1) constexpr_bt.ll added (r1.1) constpointer_bt.ll added (r1.1) dg.exp added (r1.1) fold-fpcast_bt.ll added (r1.1) forwardreftest_bt.ll added (r1.1) globalredefinition_bt.ll added (r1.1) globalvars_bt.ll added (r1.1) indirectcall2_bt.ll added (r1.1) indirectcall_bt.ll added (r1.1) instructions_bt.ll added (r1.1) newcasts_bt.ll added (r1.1) opaquetypes_bt.ll added (r1.1) packed_bt.ll added (r1.1) packed_cmp_bt.ll added (r1.1) packed_struct_bt.ll added (r1.1) paramattrs_bt.ll added (r1.1) properties_bt.ll added (r1.1) prototype_bt.ll added (r1.1) recursivetype_bt.ll added (r1.1) simplecalltest_bt.ll added (r1.1) small_bt.ll added (r1.1) testalloca_bt.ll added (r1.1) testarith_bt.ll added (r1.1) testconstants_bt.ll added (r1.1) testicmp_bt.ll added (r1.1) testlogical_bt.ll added (r1.1) testlogical_new_bt.ll added (r1.1) testmemory_bt.ll added (r1.1) testswitch_bt.ll added (r1.1) testvarargs_bt.ll added (r1.1) undefined_bt.ll added (r1.1) unreachable_bt.ll added (r1.1) varargs_bt.ll added (r1.1) varargs_new_bt.ll added (r1.1) --- Log message: New test cases for bit accurate integers developed by Guoling Han. --- Diffs of the changes: (+1669 -0) .cvsignore | 1 BitArith.ll | 26 +++++++++++ BitBit.ll | 26 +++++++++++ BitCast.ll | 28 ++++++++++++ BitIcmp.ll | 46 +++++++++++++++++++ BitMem.ll | 34 ++++++++++++++ BitMisc.ll | 25 ++++++++++ BitPacked.ll | 23 +++++++++ a15.ll | 23 +++++++++ a15.ll.out | 18 +++++++ a17.ll | 22 +++++++++ a17.ll.out | 18 +++++++ a31.ll | 22 +++++++++ a31.ll.out | 18 +++++++ a33.ll | 23 +++++++++ a33.ll.out | 18 +++++++ a63.ll | 22 +++++++++ a63.ll.out | 18 +++++++ a7.ll | 23 +++++++++ a7.ll.out | 18 +++++++ a9.ll | 23 +++++++++ a9.ll.out | 18 +++++++ alignment_bt.ll | 21 +++++++++ basictest_bt.ll | 34 ++++++++++++++ calltest_bt.ll | 35 +++++++++++++++ cfgstructures_bt.ll | 57 ++++++++++++++++++++++++ constexpr_bt.ll | 84 ++++++++++++++++++++++++++++++++++++ constpointer_bt.ll | 33 ++++++++++++++ dg.exp | 3 + fold-fpcast_bt.ll | 18 +++++++ forwardreftest_bt.ll | 34 ++++++++++++++ globalredefinition_bt.ll | 18 +++++++ globalvars_bt.ll | 27 +++++++++++ indirectcall2_bt.ll | 25 ++++++++++ indirectcall_bt.ll | 54 +++++++++++++++++++++++ instructions_bt.ll | 26 +++++++++++ newcasts_bt.ll | 28 ++++++++++++ opaquetypes_bt.ll | 61 ++++++++++++++++++++++++++ packed_bt.ll | 17 +++++++ packed_cmp_bt.ll | 58 +++++++++++++++++++++++++ packed_struct_bt.ll | 33 ++++++++++++++ paramattrs_bt.ll | 20 ++++++++ properties_bt.ll | 10 ++++ prototype_bt.ll | 14 ++++++ recursivetype_bt.ll | 109 +++++++++++++++++++++++++++++++++++++++++++++++ simplecalltest_bt.ll | 29 ++++++++++++ small_bt.ll | 14 ++++++ testalloca_bt.ll | 29 ++++++++++++ testarith_bt.ll | 19 ++++++++ testconstants_bt.ll | 33 ++++++++++++++ testicmp_bt.ll | 24 ++++++++++ testlogical_bt.ll | 14 ++++++ testlogical_new_bt.ll | 16 ++++++ testmemory_bt.ll | 46 +++++++++++++++++++ testswitch_bt.ll | 25 ++++++++++ testvarargs_bt.ll | 15 ++++++ undefined_bt.ll | 19 ++++++++ unreachable_bt.ll | 17 +++++++ varargs_bt.ll | 24 ++++++++++ varargs_new_bt.ll | 33 ++++++++++++++ 60 files changed, 1669 insertions(+) Index: llvm/test/Regression/Integer/.cvsignore diff -c /dev/null llvm/test/Regression/Integer/.cvsignore:1.1 *** /dev/null Tue Jan 16 12:08:32 2007 --- llvm/test/Regression/Integer/.cvsignore Tue Jan 16 12:08:22 2007 *************** *** 0 **** --- 1 ---- + Output Index: llvm/test/Regression/Integer/BitArith.ll diff -c /dev/null llvm/test/Regression/Integer/BitArith.ll:1.1 *** /dev/null Tue Jan 16 12:08:38 2007 --- llvm/test/Regression/Integer/BitArith.ll Tue Jan 16 12:08:22 2007 *************** *** 0 **** --- 1,26 ---- + ; RUN: llvm-as %s -o - | llvm-dis > %t1.ll + ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll + ; RUN: diff %t1.ll %t2.ll + + + declare void "foo"(i31 %i, i63 %j, i10 %k) + + implementation + + ; foo test basic arith operations + define void "foo"(i31 %i, i63 %j, i10 %k) + begin + %t1 = trunc i63 %j to i31 + %t2 = add i31 %t1, %i + %t20 = add i31 3, %t1 + %t3 = zext i31 %i to i63 + %t4 = sub i63 %t3, %j + %t40 = sub i63 %j, -100 + %t5 = mul i10 %k, 7 + %t6 = sdiv i63 %j, -2 + %t7 = udiv i63 %j, %t3 + %t8 = urem i10 %k, 10 + %t9 = srem i10 %k, -10 + ret void + end + Index: llvm/test/Regression/Integer/BitBit.ll diff -c /dev/null llvm/test/Regression/Integer/BitBit.ll:1.1 *** /dev/null Tue Jan 16 12:08:38 2007 --- llvm/test/Regression/Integer/BitBit.ll Tue Jan 16 12:08:22 2007 *************** *** 0 **** --- 1,26 ---- + ; RUN: llvm-as %s -o - | llvm-dis > %t1.ll + ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll + ; RUN: diff %t1.ll %t2.ll + + + + declare void "foo"(i31 %i, i17 %j) + + implementation + + ; foo test basic bitwise operations + define void "foo"(i31 %i, i33 %j) + begin + %t1 = trunc i33 %j to i31 + %t2 = and i31 %t1, %i + %t3 = sext i31 %i to i33 + %t4 = or i33 %t3, %j + %t5 = xor i31 %t2, 7 + %t6 = shl i31 %i, i8 2 + %t7 = trunc i31 %i to i8 + %t8 = shl i8 %t7, i8 3 + %t9 = lshr i33 %j, i8 31 + %t10 = ashr i33 %j, i8 %t7 + ret void + end + Index: llvm/test/Regression/Integer/BitCast.ll diff -c /dev/null llvm/test/Regression/Integer/BitCast.ll:1.1 *** /dev/null Tue Jan 16 12:08:38 2007 --- llvm/test/Regression/Integer/BitCast.ll Tue Jan 16 12:08:22 2007 *************** *** 0 **** --- 1,28 ---- + ; RUN: llvm-as %s -o - | llvm-dis > %t1.ll + ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll + ; RUN: diff %t1.ll %t2.ll + + + declare void "foo"(i31 %i, i1280 %j, i1 %k, float %f) + + implementation + + ; foo test basic arith operations + define void "foo"(i31 %i, i1280 %j, i1 %k, float %f) + begin + %t1 = trunc i1280 %j to i31 + %t2 = trunc i31 %t1 to i1 + + %t3 = zext i31 %i to i1280 + %t4 = sext i31 %i to i1280 + + %t5 = fptoui float 3.14159 to i31 + %t6 = uitofp i31 %t5 to double + + %t7 = fptosi double -1234.5678 to i28 + %t8 = sitofp i8 -1 to double + %t9 = uitofp i8 255 to double + + ret void + end + Index: llvm/test/Regression/Integer/BitIcmp.ll diff -c /dev/null llvm/test/Regression/Integer/BitIcmp.ll:1.1 *** /dev/null Tue Jan 16 12:08:38 2007 --- llvm/test/Regression/Integer/BitIcmp.ll Tue Jan 16 12:08:22 2007 *************** *** 0 **** --- 1,46 ---- + ; RUN: llvm-as %s -o - | llvm-dis > %t1.ll + ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll + ; RUN: diff %t1.ll %t2.ll + + + + implementation + + define i55 "simpleIcmp"(i55 %i0, i55 %j0) + begin + %t1 = icmp eq i55 %i0, %j0 + %t2 = icmp ne i55 %i0, %j0 + %t3 = icmp ult i55 %i0, %j0 + %t4 = icmp sgt i55 %i0, %j0 + %t5 = icmp ule i55 %i0, %j0 + %t6 = icmp sge i55 %i0, %j0 + + %t7 = icmp eq i55 %i0, 1098765432 + %t8 = icmp ne i55 %i0, -31415926 + + %t9 = icmp ult i55 10000, %j0 + %t10 = icmp sgt i55 -10000, %j0 + + ret i55 %i0 + end + + define i31 "phitest"(i12 %i) + begin + + HasArg: + %n1 = add i12 1, %i + br label %Continue + + Continue: + %n = phi i12 [%n1, %HasArg], [%next, %Continue] + %next = add i12 1, %n + br label %Continue + end + + define i18 "select"(i18 %i) + begin + %t = icmp sgt i18 %i, 100 + %k = select i1 %t, i18 %i, i18 999 + ret i18 %k + end + Index: llvm/test/Regression/Integer/BitMem.ll diff -c /dev/null llvm/test/Regression/Integer/BitMem.ll:1.1 *** /dev/null Tue Jan 16 12:08:38 2007 --- llvm/test/Regression/Integer/BitMem.ll Tue Jan 16 12:08:22 2007 *************** *** 0 **** --- 1,34 ---- + ; RUN: llvm-as %s -o - | llvm-dis > %t1.ll + ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll + ; RUN: diff %t1.ll %t2.ll + + + declare void "foo"() + + + implementation + + ; foo test basic arith operations + define void "foo"() + begin + %t1 = malloc i31, i32 4 + %t2 = malloc i31, i32 7, align 1024 + %t3 = malloc [4 x i15] + + + %idx = getelementptr [4 x i15]* %t3, i64 0, i64 2 + store i15 -123, i15* %idx + + free [4 x i15]* %t3 + free i31* %t2 + free i31* %t1 + + %t4 = alloca i12, i32 100 + free i12* %t4 + + %t5 = alloca i31 + store i31 -123, i31* %t5 + + free i31* %t5 + ret void + end Index: llvm/test/Regression/Integer/BitMisc.ll diff -c /dev/null llvm/test/Regression/Integer/BitMisc.ll:1.1 *** /dev/null Tue Jan 16 12:08:38 2007 --- llvm/test/Regression/Integer/BitMisc.ll Tue Jan 16 12:08:22 2007 *************** *** 0 **** --- 1,25 ---- + ; RUN: llvm-as %s -o - | llvm-dis > %t1.ll + ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll + ; RUN: diff %t1.ll %t2.ll + + + %MyVar = external global i19 + %MyIntList = external global { i39 *, i19 } + external global i19 ; i19*:0 + + %AConst = constant i19 -123 + + %AString = constant [4 x i8] c"test" + + %ZeroInit = global { [100 x i19 ], [40 x float ] } { [100 x i19] zeroinitializer, + [40 x float] zeroinitializer } + + implementation + + define i19 "foo"(i19 %blah) + begin + store i19 5, i19 *%MyVar + %idx = getelementptr { i39 *, i19 } * %MyIntList, i64 0, i32 1 + store i19 12, i19* %idx + ret i19 %blah + end Index: llvm/test/Regression/Integer/BitPacked.ll diff -c /dev/null llvm/test/Regression/Integer/BitPacked.ll:1.1 *** /dev/null Tue Jan 16 12:08:38 2007 --- llvm/test/Regression/Integer/BitPacked.ll Tue Jan 16 12:08:22 2007 *************** *** 0 **** --- 1,23 ---- + ; RUN: llvm-as %s -o - | llvm-dis > %t1.ll + ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll + ; RUN: diff %t1.ll %t2.ll + + + %foo1 = external global <4 x float>; + %foo2 = external global <2 x i10>; + + implementation ; Functions: + + define void %main() + { + store <4 x float> , <4 x float>* %foo1 + store <2 x i10> , <2 x i10>* %foo2 + %l1 = load <4 x float>* %foo1 + %l2 = load <2 x i10>* %foo2 + %r1 = extractelement <2 x i10> %l2, i32 1 + %r2 = extractelement <2 x i10> %l2, i32 0 + %t = mul i10 %r1, %r2 + %r3 = insertelement <2 x i10> %l2, i10 %t, i32 0 + store <2 x i10> %r3, <2 x i10>* %foo2 + ret void + } Index: llvm/test/Regression/Integer/a15.ll diff -c /dev/null llvm/test/Regression/Integer/a15.ll:1.1 *** /dev/null Tue Jan 16 12:08:38 2007 --- llvm/test/Regression/Integer/a15.ll Tue Jan 16 12:08:22 2007 *************** *** 0 **** --- 1,23 ---- + ; RUN: llvm-as %s -o - | llvm-dis > %t.ll + ; RUN: diff %t.ll %s.out + + ; test 15 bits + ; + %b = constant i15 add(i15 32767, i15 1) + %c = constant i15 add(i15 32767, i15 32767) + %d = constant i15 add(i15 32760, i15 8) + %e = constant i15 sub(i15 0 , i15 1) + %f = constant i15 sub(i15 0 , i15 32767) + %g = constant i15 sub(i15 2 , i15 32767) + + %h = constant i15 shl(i15 1 , i8 15) + %i = constant i15 shl(i15 1 , i8 14) + %j = constant i15 lshr(i15 32767 , i8 14) + %k = constant i15 lshr(i15 32767 , i8 15) + %l = constant i15 ashr(i15 32767 , i8 14) + %m = constant i15 ashr(i15 32767 , i8 15) + + %n = constant i15 mul(i15 32767, i15 2) + %o = constant i15 trunc( i16 32768 to i15 ) + %p = constant i15 trunc( i16 32767 to i15 ) + Index: llvm/test/Regression/Integer/a15.ll.out diff -c /dev/null llvm/test/Regression/Integer/a15.ll.out:1.1 *** /dev/null Tue Jan 16 12:08:38 2007 --- llvm/test/Regression/Integer/a15.ll.out Tue Jan 16 12:08:22 2007 *************** *** 0 **** --- 1,18 ---- + ; ModuleID = '' + %b = constant i15 0 ; [#uses=0] + %c = constant i15 -2 ; [#uses=0] + %d = constant i15 0 ; [#uses=0] + %e = constant i15 -1 ; [#uses=0] + %f = constant i15 1 ; [#uses=0] + %g = constant i15 3 ; [#uses=0] + %h = constant i15 0 ; [#uses=0] + %i = constant i15 -16384 ; [#uses=0] + %j = constant i15 1 ; [#uses=0] + %k = constant i15 0 ; [#uses=0] + %l = constant i15 -1 ; [#uses=0] + %m = constant i15 -1 ; [#uses=0] + %n = constant i15 -2 ; [#uses=0] + %o = constant i15 0 ; [#uses=0] + %p = constant i15 -1 ; [#uses=0] + + implementation ; Functions: Index: llvm/test/Regression/Integer/a17.ll diff -c /dev/null llvm/test/Regression/Integer/a17.ll:1.1 *** /dev/null Tue Jan 16 12:08:38 2007 --- llvm/test/Regression/Integer/a17.ll Tue Jan 16 12:08:22 2007 *************** *** 0 **** --- 1,22 ---- + ; RUN: llvm-as %s -o - | llvm-dis > %t.ll + ; RUN: diff %t.ll %s.out + + ; test 17 bits + ; + %b = constant i17 add(i17 131071, i17 1) + %c = constant i17 add(i17 131071, i17 131071) + %d = constant i17 add(i17 131064, i17 8) + %e = constant i17 sub(i17 0 , i17 1) + %f = constant i17 sub(i17 0 , i17 131071) + %g = constant i17 sub(i17 2 , i17 131071) + + %h = constant i17 shl(i17 1 , i8 17) + %i = constant i17 shl(i17 1 , i8 16) + %j = constant i17 lshr(i17 131071 , i8 16) + %k = constant i17 lshr(i17 131071 , i8 17) + %l = constant i17 ashr(i17 131071 , i8 16) + %m = constant i17 ashr(i17 131071 , i8 17) + + %n = constant i17 mul(i17 131071, i17 2) + %o = constant i17 trunc( i18 131072 to i17 ) + %p = constant i17 trunc( i18 131071 to i17 ) Index: llvm/test/Regression/Integer/a17.ll.out diff -c /dev/null llvm/test/Regression/Integer/a17.ll.out:1.1 *** /dev/null Tue Jan 16 12:08:38 2007 --- llvm/test/Regression/Integer/a17.ll.out Tue Jan 16 12:08:22 2007 *************** *** 0 **** --- 1,18 ---- + ; ModuleID = '' + %b = constant i17 0 ; [#uses=0] + %c = constant i17 -2 ; [#uses=0] + %d = constant i17 0 ; [#uses=0] + %e = constant i17 -1 ; [#uses=0] + %f = constant i17 1 ; [#uses=0] + %g = constant i17 3 ; [#uses=0] + %h = constant i17 0 ; [#uses=0] + %i = constant i17 -65536 ; [#uses=0] + %j = constant i17 1 ; [#uses=0] + %k = constant i17 0 ; [#uses=0] + %l = constant i17 -1 ; [#uses=0] + %m = constant i17 -1 ; [#uses=0] + %n = constant i17 -2 ; [#uses=0] + %o = constant i17 0 ; [#uses=0] + %p = constant i17 -1 ; [#uses=0] + + implementation ; Functions: Index: llvm/test/Regression/Integer/a31.ll diff -c /dev/null llvm/test/Regression/Integer/a31.ll:1.1 *** /dev/null Tue Jan 16 12:08:38 2007 --- llvm/test/Regression/Integer/a31.ll Tue Jan 16 12:08:22 2007 *************** *** 0 **** --- 1,22 ---- + ; RUN: llvm-as %s -o - | llvm-dis > %t.ll + ; RUN: diff %t.ll %s.out + + ; test 31 bits + ; + %b = constant i31 add(i31 2147483647, i31 1) + %c = constant i31 add(i31 2147483647, i31 2147483647) + %d = constant i31 add(i31 2147483640, i31 8) + %e = constant i31 sub(i31 0 , i31 1) + %f = constant i31 sub(i31 0 , i31 2147483647) + %g = constant i31 sub(i31 2 , i31 2147483647) + + %h = constant i31 shl(i31 1 , i8 31) + %i = constant i31 shl(i31 1 , i8 30) + %j = constant i31 lshr(i31 2147483647 , i8 30) + %k = constant i31 lshr(i31 2147483647 , i8 31) + %l = constant i31 ashr(i31 2147483647 , i8 30) + %m = constant i31 ashr(i31 2147483647 , i8 31) + + %n = constant i31 mul(i31 2147483647, i31 2) + %o = constant i31 trunc( i32 2147483648 to i31 ) + %p = constant i31 trunc( i32 2147483647 to i31 ) Index: llvm/test/Regression/Integer/a31.ll.out diff -c /dev/null llvm/test/Regression/Integer/a31.ll.out:1.1 *** /dev/null Tue Jan 16 12:08:38 2007 --- llvm/test/Regression/Integer/a31.ll.out Tue Jan 16 12:08:22 2007 *************** *** 0 **** --- 1,18 ---- + ; ModuleID = '' + %b = constant i31 0 ; [#uses=0] + %c = constant i31 -2 ; [#uses=0] + %d = constant i31 0 ; [#uses=0] + %e = constant i31 -1 ; [#uses=0] + %f = constant i31 1 ; [#uses=0] + %g = constant i31 3 ; [#uses=0] + %h = constant i31 0 ; [#uses=0] + %i = constant i31 -1073741824 ; [#uses=0] + %j = constant i31 1 ; [#uses=0] + %k = constant i31 0 ; [#uses=0] + %l = constant i31 -1 ; [#uses=0] + %m = constant i31 -1 ; [#uses=0] + %n = constant i31 -2 ; [#uses=0] + %o = constant i31 0 ; [#uses=0] + %p = constant i31 -1 ; [#uses=0] + + implementation ; Functions: Index: llvm/test/Regression/Integer/a33.ll diff -c /dev/null llvm/test/Regression/Integer/a33.ll:1.1 *** /dev/null Tue Jan 16 12:08:38 2007 --- llvm/test/Regression/Integer/a33.ll Tue Jan 16 12:08:22 2007 *************** *** 0 **** --- 1,23 ---- + ; RUN: llvm-as %s -o - | llvm-dis > %t.ll + ; RUN: diff %t.ll %s.out + + ; test 33 bits + ; + %b = constant i33 add(i33 8589934591, i33 1) + %c = constant i33 add(i33 8589934591, i33 8589934591) + %d = constant i33 add(i33 8589934584, i33 8) + %e = constant i33 sub(i33 0 , i33 1) + %f = constant i33 sub(i33 0 , i33 8589934591) + %g = constant i33 sub(i33 2 , i33 8589934591) + + %h = constant i33 shl(i33 1 , i8 33) + %i = constant i33 shl(i33 1 , i8 32) + %j = constant i33 lshr(i33 8589934591 , i8 32) + %k = constant i33 lshr(i33 8589934591 , i8 33) + %l = constant i33 ashr(i33 8589934591 , i8 32) + %m = constant i33 ashr(i33 8589934591 , i8 33) + + %n = constant i33 mul(i33 8589934591, i33 2) + %o = constant i33 trunc( i34 8589934592 to i33 ) + %p = constant i33 trunc( i34 8589934591 to i33 ) + Index: llvm/test/Regression/Integer/a33.ll.out diff -c /dev/null llvm/test/Regression/Integer/a33.ll.out:1.1 *** /dev/null Tue Jan 16 12:08:38 2007 --- llvm/test/Regression/Integer/a33.ll.out Tue Jan 16 12:08:22 2007 *************** *** 0 **** --- 1,18 ---- + ; ModuleID = '' + %b = constant i33 0 ; [#uses=0] + %c = constant i33 -2 ; [#uses=0] + %d = constant i33 0 ; [#uses=0] + %e = constant i33 -1 ; [#uses=0] + %f = constant i33 1 ; [#uses=0] + %g = constant i33 3 ; [#uses=0] + %h = constant i33 0 ; [#uses=0] + %i = constant i33 -4294967296 ; [#uses=0] + %j = constant i33 1 ; [#uses=0] + %k = constant i33 0 ; [#uses=0] + %l = constant i33 -1 ; [#uses=0] + %m = constant i33 -1 ; [#uses=0] + %n = constant i33 -2 ; [#uses=0] + %o = constant i33 0 ; [#uses=0] + %p = constant i33 -1 ; [#uses=0] + + implementation ; Functions: Index: llvm/test/Regression/Integer/a63.ll diff -c /dev/null llvm/test/Regression/Integer/a63.ll:1.1 *** /dev/null Tue Jan 16 12:08:38 2007 --- llvm/test/Regression/Integer/a63.ll Tue Jan 16 12:08:22 2007 *************** *** 0 **** --- 1,22 ---- + ; RUN: llvm-as %s -o - | llvm-dis > %t.ll + ; RUN: diff %t.ll %s.out + + ; test 63 bits + ; + %b = constant i63 add(i63 9223372036854775807, i63 1) + %c = constant i63 add(i63 9223372036854775807, i63 9223372036854775807) + %d = constant i63 add(i63 9223372036854775800, i63 8) + %e = constant i63 sub(i63 0 , i63 1) + %f = constant i63 sub(i63 0 , i63 9223372036854775807) + %g = constant i63 sub(i63 2 , i63 9223372036854775807) + + %h = constant i63 shl(i63 1 , i8 63) + %i = constant i63 shl(i63 1 , i8 62) + %j = constant i63 lshr(i63 9223372036854775807 , i8 62) + %k = constant i63 lshr(i63 9223372036854775807 , i8 63) + %l = constant i63 ashr(i63 9223372036854775807 , i8 62) + %m = constant i63 ashr(i63 9223372036854775807 , i8 63) + + %n = constant i63 mul(i63 9223372036854775807, i63 2) + %o = constant i63 trunc( i64 9223372036854775808 to i63 ) + %p = constant i63 trunc( i64 9223372036854775807 to i63 ) Index: llvm/test/Regression/Integer/a63.ll.out diff -c /dev/null llvm/test/Regression/Integer/a63.ll.out:1.1 *** /dev/null Tue Jan 16 12:08:38 2007 --- llvm/test/Regression/Integer/a63.ll.out Tue Jan 16 12:08:22 2007 *************** *** 0 **** --- 1,18 ---- + ; ModuleID = '' + %b = constant i63 0 ; [#uses=0] + %c = constant i63 -2 ; [#uses=0] + %d = constant i63 0 ; [#uses=0] + %e = constant i63 -1 ; [#uses=0] + %f = constant i63 1 ; [#uses=0] + %g = constant i63 3 ; [#uses=0] + %h = constant i63 0 ; [#uses=0] + %i = constant i63 -4611686018427387904 ; [#uses=0] + %j = constant i63 1 ; [#uses=0] + %k = constant i63 0 ; [#uses=0] + %l = constant i63 -1 ; [#uses=0] + %m = constant i63 -1 ; [#uses=0] + %n = constant i63 -2 ; [#uses=0] + %o = constant i63 0 ; [#uses=0] + %p = constant i63 -1 ; [#uses=0] + + implementation ; Functions: Index: llvm/test/Regression/Integer/a7.ll diff -c /dev/null llvm/test/Regression/Integer/a7.ll:1.1 *** /dev/null Tue Jan 16 12:08:38 2007 --- llvm/test/Regression/Integer/a7.ll Tue Jan 16 12:08:22 2007 *************** *** 0 **** --- 1,23 ---- + ; RUN: llvm-as %s -o - | llvm-dis > %t.ll + ; RUN: diff %t.ll %s.out + + ; test 7 bits + ; + %b = constant i7 add(i7 127, i7 1) + %c = constant i7 add(i7 127, i7 127) + %d = constant i7 add(i7 120, i7 8) + %e = constant i7 sub(i7 0 , i7 1) + %f = constant i7 sub(i7 0 , i7 127) + %g = constant i7 sub(i7 2 , i7 127) + + %h = constant i7 shl(i7 1 , i8 7) + %i = constant i7 shl(i7 1 , i8 6) + %j = constant i7 lshr(i7 127 , i8 6) + %k = constant i7 lshr(i7 127 , i8 7) + %l = constant i7 ashr(i7 127 , i8 6) + %m = constant i7 ashr(i7 127 , i8 7) + + %n = constant i7 mul(i7 127, i7 2) + %o = constant i7 trunc( i8 128 to i7 ) + %p = constant i7 trunc( i8 255 to i7 ) + Index: llvm/test/Regression/Integer/a7.ll.out diff -c /dev/null llvm/test/Regression/Integer/a7.ll.out:1.1 *** /dev/null Tue Jan 16 12:08:38 2007 --- llvm/test/Regression/Integer/a7.ll.out Tue Jan 16 12:08:22 2007 *************** *** 0 **** --- 1,18 ---- + ; ModuleID = '' + %b = constant i7 0 ; [#uses=0] + %c = constant i7 -2 ; [#uses=0] + %d = constant i7 0 ; [#uses=0] + %e = constant i7 -1 ; [#uses=0] + %f = constant i7 1 ; [#uses=0] + %g = constant i7 3 ; [#uses=0] + %h = constant i7 0 ; [#uses=0] + %i = constant i7 -64 ; [#uses=0] + %j = constant i7 1 ; [#uses=0] + %k = constant i7 0 ; [#uses=0] + %l = constant i7 -1 ; [#uses=0] + %m = constant i7 -1 ; [#uses=0] + %n = constant i7 -2 ; [#uses=0] + %o = constant i7 0 ; [#uses=0] + %p = constant i7 -1 ; [#uses=0] + + implementation ; Functions: Index: llvm/test/Regression/Integer/a9.ll diff -c /dev/null llvm/test/Regression/Integer/a9.ll:1.1 *** /dev/null Tue Jan 16 12:08:38 2007 --- llvm/test/Regression/Integer/a9.ll Tue Jan 16 12:08:22 2007 *************** *** 0 **** --- 1,23 ---- + ; RUN: llvm-as %s -o - | llvm-dis > %t.ll + ; RUN: diff %t.ll %s.out + + ; test 9 bits + ; + %b = constant i9 add(i9 511, i9 1) + %c = constant i9 add(i9 511, i9 511) + %d = constant i9 add(i9 504, i9 8) + %e = constant i9 sub(i9 0 , i9 1) + %f = constant i9 sub(i9 0 , i9 511) + %g = constant i9 sub(i9 2 , i9 511) + + %h = constant i9 shl(i9 1 , i8 9) + %i = constant i9 shl(i9 1 , i8 8) + %j = constant i9 lshr(i9 511 , i8 8) + %k = constant i9 lshr(i9 511 , i8 9) + %l = constant i9 ashr(i9 511 , i8 8) + %m = constant i9 ashr(i9 511 , i8 9) + + %n = constant i9 mul(i9 511, i9 2) + %o = constant i9 trunc( i10 512 to i9 ) + %p = constant i9 trunc( i10 511 to i9 ) + Index: llvm/test/Regression/Integer/a9.ll.out diff -c /dev/null llvm/test/Regression/Integer/a9.ll.out:1.1 *** /dev/null Tue Jan 16 12:08:38 2007 --- llvm/test/Regression/Integer/a9.ll.out Tue Jan 16 12:08:22 2007 *************** *** 0 **** --- 1,18 ---- + ; ModuleID = '' + %b = constant i9 0 ; [#uses=0] + %c = constant i9 -2 ; [#uses=0] + %d = constant i9 0 ; [#uses=0] + %e = constant i9 -1 ; [#uses=0] + %f = constant i9 1 ; [#uses=0] + %g = constant i9 3 ; [#uses=0] + %h = constant i9 0 ; [#uses=0] + %i = constant i9 -256 ; [#uses=0] + %j = constant i9 1 ; [#uses=0] + %k = constant i9 0 ; [#uses=0] + %l = constant i9 -1 ; [#uses=0] + %m = constant i9 -1 ; [#uses=0] + %n = constant i9 -2 ; [#uses=0] + %o = constant i9 0 ; [#uses=0] + %p = constant i9 -1 ; [#uses=0] + + implementation ; Functions: Index: llvm/test/Regression/Integer/alignment_bt.ll diff -c /dev/null llvm/test/Regression/Integer/alignment_bt.ll:1.1 *** /dev/null Tue Jan 16 12:08:38 2007 --- llvm/test/Regression/Integer/alignment_bt.ll Tue Jan 16 12:08:22 2007 *************** *** 0 **** --- 1,21 ---- + ; RUN: llvm-as %s -o - | llvm-dis > %t1.ll + ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll + ; RUN: diff %t1.ll %t2.ll + + %X = global i19 4, align 16 + + define i19 *%test() align 32 { + %X = alloca i19, align 4 + %Y = alloca i51, i32 42, align 16 + %Z = alloca i32, align 0 + ret i19 *%X + } + + define i19 *%test2() { + %X = malloc i19, align 4 + %Y = malloc i51, i32 42, align 16 + %Z = malloc i32, align 0 + ret i19 *%X + } + + Index: llvm/test/Regression/Integer/basictest_bt.ll diff -c /dev/null llvm/test/Regression/Integer/basictest_bt.ll:1.1 *** /dev/null Tue Jan 16 12:08:38 2007 --- llvm/test/Regression/Integer/basictest_bt.ll Tue Jan 16 12:08:22 2007 *************** *** 0 **** --- 1,34 ---- + ; RUN: llvm-as %s -o - | llvm-dis > %t1.ll + ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll + ; RUN: diff %t1.ll %t2.ll + + implementation + + ; Test "stripped" format where nothing is symbolic... this is how the bytecode + ; format looks anyways (except for negative vs positive offsets)... + ; + define void "void"(i39, i39) ; Def %0, %1 + begin + add i39 0, 0 ; Def 2 + sub i39 0, 4 ; Def 3 + br label %1 + + ;