From sabre at nondot.org Mon Sep 18 00:17:26 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 18 Sep 2006 00:17:26 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/PatternMatch.h Message-ID: <200609180517.k8I5HQbx023888@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: PatternMatch.h updated: 1.8 -> 1.9 --- Log message: Add support for pattern matching cast operations --- Diffs of the changes: (+33 -0) PatternMatch.h | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+) Index: llvm/include/llvm/Support/PatternMatch.h diff -u llvm/include/llvm/Support/PatternMatch.h:1.8 llvm/include/llvm/Support/PatternMatch.h:1.9 --- llvm/include/llvm/Support/PatternMatch.h:1.8 Thu Jun 15 14:25:28 2006 +++ llvm/include/llvm/Support/PatternMatch.h Mon Sep 18 00:17:11 2006 @@ -271,6 +271,39 @@ template inline not_match m_Not(const LHS &L) { return L; } + +template +struct cast_match { + Op_t Op; + const Type **DestTy; + + cast_match(const Op_t &op, const Type **destTy) : Op(op), DestTy(destTy) {} + + template + bool match(OpTy *V) { + if (CastInst *I = dyn_cast(V)) { + if (DestTy) *DestTy = I->getType(); + return Op.match(I->getOperand(0)); + } else if (ConstantExpr *CE = dyn_cast(V)) { + if (CE->getOpcode() == Instruction::Cast) { + if (DestTy) *DestTy = I->getType(); + return Op.match(CE->getOperand(0)); + } + } + return false; + } +}; + +template +inline cast_match m_Cast(const Op_t &Op, const Type *&Ty) { + return cast_match(Op, &Ty); +} +template +inline cast_match m_Cast(const Op_t &Op) { + return cast_match(Op, 0); +} + + //===----------------------------------------------------------------------===// // Matchers for control flow // From sabre at nondot.org Mon Sep 18 00:25:24 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 18 Sep 2006 00:25:24 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/cast.ll Message-ID: <200609180525.k8I5PO3k024086@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: cast.ll updated: 1.29 -> 1.30 --- Log message: new testcase --- Diffs of the changes: (+6 -1) cast.ll | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletion(-) Index: llvm/test/Regression/Transforms/InstCombine/cast.ll diff -u llvm/test/Regression/Transforms/InstCombine/cast.ll:1.29 llvm/test/Regression/Transforms/InstCombine/cast.ll:1.30 --- llvm/test/Regression/Transforms/InstCombine/cast.ll:1.29 Fri May 12 21:00:07 2006 +++ llvm/test/Regression/Transforms/InstCombine/cast.ll Mon Sep 18 00:25:10 2006 @@ -192,5 +192,10 @@ ret uint %c4 } - +bool %test31(ulong %A) { + %B = cast ulong %A to int + %C = and int %B, 42 + %D = seteq int %C, 10 + ret bool %D +} From sabre at nondot.org Mon Sep 18 00:27:57 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 18 Sep 2006 00:27:57 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200609180527.k8I5Rviw024169@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.507 -> 1.508 --- Log message: Implement InstCombine/cast.ll:test31. This speeds up 462.libquantum by 26%. --- Diffs of the changes: (+39 -4) InstructionCombining.cpp | 43 +++++++++++++++++++++++++++++++++++++++---- 1 files changed, 39 insertions(+), 4 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.507 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.508 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.507 Sun Sep 17 23:31:40 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Sep 18 00:27:43 2006 @@ -3871,12 +3871,46 @@ case Instruction::And: if (LHSI->hasOneUse() && isa(LHSI->getOperand(1)) && LHSI->getOperand(0)->hasOneUse()) { + ConstantInt *AndCST = cast(LHSI->getOperand(1)); + + // If an operand is an AND of a truncating cast, we can widen the + // and/compare to be the input width without changing the value + // produced, eliminating a cast. + if (CastInst *Cast = dyn_cast(LHSI->getOperand(0))) { + // We can do this transformation if either the AND constant does not + // have its sign bit set or if it is an equality comparison. + // Extending a relational comparison when we're checking the sign + // bit would not work. + if (Cast->hasOneUse() && Cast->isTruncIntCast() && + (I.isEquality() || + (AndCST->getZExtValue() == (uint64_t)AndCST->getSExtValue()) && + (CI->getZExtValue() == (uint64_t)CI->getSExtValue()))) { + ConstantInt *NewCST; + ConstantInt *NewCI; + if (Cast->getOperand(0)->getType()->isSigned()) { + NewCST = ConstantSInt::get(Cast->getOperand(0)->getType(), + AndCST->getZExtValue()); + NewCI = ConstantSInt::get(Cast->getOperand(0)->getType(), + CI->getZExtValue()); + } else { + NewCST = ConstantUInt::get(Cast->getOperand(0)->getType(), + AndCST->getZExtValue()); + NewCI = ConstantUInt::get(Cast->getOperand(0)->getType(), + CI->getZExtValue()); + } + Instruction *NewAnd = + BinaryOperator::createAnd(Cast->getOperand(0), NewCST, + LHSI->getName()); + InsertNewInstBefore(NewAnd, I); + return new SetCondInst(I.getOpcode(), NewAnd, NewCI); + } + } + // If this is: (X >> C1) & C2 != C3 (where any shift and any compare // could exist), turn it into (X & (C2 << C1)) != (C3 << C1). This // happens a LOT in code produced by the C front-end, for bitfield // access. ShiftInst *Shift = dyn_cast(LHSI->getOperand(0)); - Constant *AndCST = cast(LHSI->getOperand(1)); // Check to see if there is a noop-cast between the shift and the and. if (!Shift) { @@ -3962,11 +3996,12 @@ "tmp"); } else { // Make sure we insert a logical shift. + Constant *NewAndCST = AndCST; if (AndCST->getType()->isSigned()) - AndCST = ConstantExpr::getCast(AndCST, + NewAndCST = ConstantExpr::getCast(AndCST, AndCST->getType()->getUnsignedVersion()); - NS = new ShiftInst(Instruction::Shr, AndCST, Shift->getOperand(1), - "tmp"); + NS = new ShiftInst(Instruction::Shr, NewAndCST, + Shift->getOperand(1), "tmp"); } InsertNewInstBefore(cast(NS), I); From sabre at nondot.org Mon Sep 18 00:37:08 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 18 Sep 2006 00:37:08 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/README.txt Message-ID: <200609180537.k8I5b8JN024410@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: README.txt updated: 1.135 -> 1.136 --- Log message: add a note. Our 64-bit shifts are ~30% slower than gcc's --- Diffs of the changes: (+2 -1) README.txt | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/Target/X86/README.txt diff -u llvm/lib/Target/X86/README.txt:1.135 llvm/lib/Target/X86/README.txt:1.136 --- llvm/lib/Target/X86/README.txt:1.135 Sun Sep 17 15:25:45 2006 +++ llvm/lib/Target/X86/README.txt Mon Sep 18 00:36:54 2006 @@ -59,7 +59,8 @@ But that requires good 8-bit subreg support. - +64-bit shifts (in general) expand to really bad code. Instead of using +cmovs, we should expand to a conditional branch like GCC produces. //===---------------------------------------------------------------------===// From sabre at nondot.org Mon Sep 18 02:01:53 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 18 Sep 2006 02:01:53 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/DeadArgElim/dead_vaargs.ll Message-ID: <200609180701.k8I71rCE025819@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/DeadArgElim: dead_vaargs.ll added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+13 -0) dead_vaargs.ll | 13 +++++++++++++ 1 files changed, 13 insertions(+) Index: llvm/test/Regression/Transforms/DeadArgElim/dead_vaargs.ll diff -c /dev/null llvm/test/Regression/Transforms/DeadArgElim/dead_vaargs.ll:1.1 *** /dev/null Mon Sep 18 02:01:49 2006 --- llvm/test/Regression/Transforms/DeadArgElim/dead_vaargs.ll Mon Sep 18 02:01:39 2006 *************** *** 0 **** --- 1,13 ---- + ; RUN: llvm-as < %s | opt -deadargelim -disable-output && + ; RUN: llvm-as < %s | opt -deadargelim | llvm-dis | not grep 47 && + ; RUN: llvm-as < %s | opt -deadargelim | llvm-dis | not grep 1.0 + + int %bar(int %A) { + %tmp4 = tail call int (int, ...)* %foo( int %A, int %A, int %A, int %A, ulong 47, double 1.000000e+00 ) + ret int %tmp4 + } + + internal int %foo(int %X, ...) { + ret int %X + } + From sabre at nondot.org Mon Sep 18 02:02:45 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 18 Sep 2006 02:02:45 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp Message-ID: <200609180702.k8I72j65025859@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: DeadArgumentElimination.cpp updated: 1.28 -> 1.29 --- Log message: Implement a trivial optzn: of vastart is never called in a function that takes ... args, remove the '...'. This is Transforms/DeadArgElim/dead_vaargs.ll --- Diffs of the changes: (+113 -2) DeadArgumentElimination.cpp | 115 +++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 113 insertions(+), 2 deletions(-) Index: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp diff -u llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.28 llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.29 --- llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.28 Sun Aug 27 17:42:52 2006 +++ llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp Mon Sep 18 02:02:31 2006 @@ -23,6 +23,7 @@ #include "llvm/Constant.h" #include "llvm/DerivedTypes.h" #include "llvm/Instructions.h" +#include "llvm/IntrinsicInst.h" #include "llvm/Module.h" #include "llvm/Pass.h" #include "llvm/Support/CallSite.h" @@ -85,6 +86,7 @@ Liveness getArgumentLiveness(const Argument &A); bool isMaybeLiveArgumentNowLive(Argument *Arg); + bool DeleteDeadVarargs(Function &Fn); void SurveyFunction(Function &Fn); void MarkArgumentLive(Argument *Arg); @@ -111,6 +113,109 @@ ModulePass *llvm::createDeadArgEliminationPass() { return new DAE(); } ModulePass *llvm::createDeadArgHackingPass() { return new DAH(); } +/// DeleteDeadVarargs - If this is an function that takes a ... list, and if +/// llvm.vastart is never called, the varargs list is dead for the function. +bool DAE::DeleteDeadVarargs(Function &Fn) { + assert(Fn.getFunctionType()->isVarArg() && "Function isn't varargs!"); + if (Fn.isExternal() || !Fn.hasInternalLinkage()) return false; + + // Ensure that the function is only directly called. + for (Value::use_iterator I = Fn.use_begin(), E = Fn.use_end(); I != E; ++I) { + // If this use is anything other than a call site, give up. + CallSite CS = CallSite::get(*I); + Instruction *TheCall = CS.getInstruction(); + if (!TheCall) return false; // Not a direct call site? + + // The addr of this function is passed to the call. + if (I.getOperandNo() != 0) return false; + } + + // Okay, we know we can transform this function if safe. Scan its body + // looking for calls to llvm.vastart. + for (Function::iterator BB = Fn.begin(), E = Fn.end(); BB != E; ++BB) { + for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) { + if (IntrinsicInst *II = dyn_cast(I)) { + if (II->getIntrinsicID() == Intrinsic::vastart) + return false; + } + } + } + + // If we get here, there are no calls to llvm.vastart in the function body, + // remove the "..." and adjust all the calls. + + // Start by computing a new prototype for the function, which is the same as + // the old function, but has fewer arguments. + const FunctionType *FTy = Fn.getFunctionType(); + std::vector Params(FTy->param_begin(), FTy->param_end()); + FunctionType *NFTy = FunctionType::get(FTy->getReturnType(), Params, false); + unsigned NumArgs = Params.size(); + + // Create the new function body and insert it into the module... + Function *NF = new Function(NFTy, Fn.getLinkage(), Fn.getName()); + NF->setCallingConv(Fn.getCallingConv()); + Fn.getParent()->getFunctionList().insert(&Fn, NF); + + // Loop over all of the callers of the function, transforming the call sites + // to pass in a smaller number of arguments into the new function. + // + std::vector Args; + while (!Fn.use_empty()) { + CallSite CS = CallSite::get(Fn.use_back()); + Instruction *Call = CS.getInstruction(); + + // Loop over the operands, dropping extraneous ones at the end of the list. + Args.assign(CS.arg_begin(), CS.arg_begin()+NumArgs); + + Instruction *New; + if (InvokeInst *II = dyn_cast(Call)) { + New = new InvokeInst(NF, II->getNormalDest(), II->getUnwindDest(), + Args, "", Call); + cast(New)->setCallingConv(CS.getCallingConv()); + } else { + New = new CallInst(NF, Args, "", Call); + cast(New)->setCallingConv(CS.getCallingConv()); + if (cast(Call)->isTailCall()) + cast(New)->setTailCall(); + } + Args.clear(); + + if (!Call->use_empty()) + Call->replaceAllUsesWith(Constant::getNullValue(Call->getType())); + + if (Call->hasName()) { + std::string Name = Call->getName(); + Call->setName(""); + New->setName(Name); + } + + // Finally, remove the old call from the program, reducing the use-count of + // F. + Call->getParent()->getInstList().erase(Call); + } + + // Since we have now created the new function, splice the body of the old + // function right into the new function, leaving the old rotting hulk of the + // function empty. + NF->getBasicBlockList().splice(NF->begin(), Fn.getBasicBlockList()); + + // Loop over the argument list, transfering uses of the old arguments over to + // the new arguments, also transfering over the names as well. While we're at + // it, remove the dead arguments from the DeadArguments list. + // + for (Function::arg_iterator I = Fn.arg_begin(), E = Fn.arg_end(), + I2 = NF->arg_begin(); I != E; ++I, ++I2) { + // Move the name and users over to the new version. + I->replaceAllUsesWith(I2); + I2->setName(I->getName()); + } + + // Finally, nuke the old function. + Fn.eraseFromParent(); + return true; +} + + static inline bool CallPassesValueThoughVararg(Instruction *Call, const Value *Arg) { CallSite CS = CallSite::get(Call); @@ -507,8 +612,14 @@ // determine that dead arguments passed into recursive functions are dead). // DEBUG(std::cerr << "DAE - Determining liveness\n"); - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - SurveyFunction(*I); + for (Module::iterator I = M.begin(), E = M.end(); I != E; ) { + Function &F = *I++; + if (F.getFunctionType()->isVarArg()) + if (DeleteDeadVarargs(F)) + continue; + + SurveyFunction(F); + } // Loop over the instructions to inspect, propagating liveness among arguments // and return values which are MaybeLive. From jlaskey at apple.com Mon Sep 18 09:47:44 2006 From: jlaskey at apple.com (Jim Laskey) Date: Mon, 18 Sep 2006 09:47:44 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineDebugInfo.h Message-ID: <200609181447.k8IElibl011011@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineDebugInfo.h updated: 1.38 -> 1.39 --- Log message: Sort out mangled names for globals --- Diffs of the changes: (+3 -0) MachineDebugInfo.h | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/include/llvm/CodeGen/MachineDebugInfo.h diff -u llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.38 llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.39 --- llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.38 Tue Jul 11 10:58:09 2006 +++ llvm/include/llvm/CodeGen/MachineDebugInfo.h Mon Sep 18 09:47:26 2006 @@ -622,6 +622,9 @@ } void setIsStatic(bool IS) { IsStatic = IS; } void setIsDefinition(bool ID) { IsDefinition = ID; } + bool hasMangledName() const { + return !DisplayName.empty(); + } /// ApplyToFields - Target the visitor to the fields of the GlobalDesc. /// From jlaskey at apple.com Mon Sep 18 09:47:44 2006 From: jlaskey at apple.com (Jim Laskey) Date: Mon, 18 Sep 2006 09:47:44 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp Message-ID: <200609181447.k8IEliY2011012@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: DwarfWriter.cpp updated: 1.75 -> 1.76 --- Log message: Sort out mangled names for globals --- Diffs of the changes: (+23 -13) DwarfWriter.cpp | 36 +++++++++++++++++++++++------------- 1 files changed, 23 insertions(+), 13 deletions(-) Index: llvm/lib/CodeGen/DwarfWriter.cpp diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.75 llvm/lib/CodeGen/DwarfWriter.cpp:1.76 --- llvm/lib/CodeGen/DwarfWriter.cpp:1.75 Thu Sep 7 17:06:40 2006 +++ llvm/lib/CodeGen/DwarfWriter.cpp Mon Sep 18 09:47:26 2006 @@ -1592,20 +1592,23 @@ // Get the global variable itself. GlobalVariable *GV = GVD->getGlobalVariable(); - // Generate the mangled name. - std::string MangledName = Asm->Mang->getValueName(GV); - // Gather the details (simplify add attribute code.) - const std::string &Name = GVD->getName(); - + const std::string &Name = GVD->hasMangledName() ? GVD->getDisplayName() + : GVD->getName(); + const std::string &MangledName = GVD->hasMangledName() ? GVD->getName() + : ""; // Get the global's type. DIE *Type = NewType(Unit->getDie(), GVD->getType(), Unit); // Create the globale variable DIE. DIE *VariableDie = new DIE(DW_TAG_variable); - VariableDie->AddString (DW_AT_name, DW_FORM_string, Name); - VariableDie->AddDIEntry (DW_AT_type, DW_FORM_ref4, Type); - VariableDie->AddUInt (DW_AT_external, DW_FORM_flag, 1); + VariableDie->AddString(DW_AT_name, DW_FORM_string, Name); + if (!MangledName.empty()) { + VariableDie->AddString(DW_AT_MIPS_linkage_name, DW_FORM_string, + MangledName); + } + VariableDie->AddDIEntry(DW_AT_type, DW_FORM_ref4, Type); + VariableDie->AddUInt(DW_AT_external, DW_FORM_flag, 1); // Add source line info if available. AddSourceLine(VariableDie, UnitDesc, GVD->getLine()); @@ -1642,17 +1645,24 @@ if (Slot) return Slot; // Gather the details (simplify add attribute code.) - const std::string &Name = SPD->getName(); + const std::string &Name = SPD->hasMangledName() ? SPD->getDisplayName() + : SPD->getName(); + const std::string &MangledName = SPD->hasMangledName() ? SPD->getName() + : ""; DIE *Type = NewType(Unit->getDie(), SPD->getType(), Unit); unsigned IsExternal = SPD->isStatic() ? 0 : 1; DIE *SubprogramDie = new DIE(DW_TAG_subprogram); - SubprogramDie->AddString (DW_AT_name, DW_FORM_string, Name); + SubprogramDie->AddString(DW_AT_name, DW_FORM_string, Name); + if (!MangledName.empty()) { + SubprogramDie->AddString(DW_AT_MIPS_linkage_name, DW_FORM_string, + MangledName); + } if (Type) { - SubprogramDie->AddDIEntry (DW_AT_type, DW_FORM_ref4, Type); + SubprogramDie->AddDIEntry(DW_AT_type, DW_FORM_ref4, Type); } - SubprogramDie->AddUInt (DW_AT_external, DW_FORM_flag, IsExternal); - SubprogramDie->AddUInt (DW_AT_prototyped, DW_FORM_flag, 1); + SubprogramDie->AddUInt(DW_AT_external, DW_FORM_flag, IsExternal); + SubprogramDie->AddUInt(DW_AT_prototyped, DW_FORM_flag, 1); // Add source line info if available. AddSourceLine(SubprogramDie, UnitDesc, SPD->getLine()); From alenhar2 at cs.uiuc.edu Mon Sep 18 12:59:51 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Mon, 18 Sep 2006 12:59:51 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp Message-ID: <200609181759.k8IHxpq8014744@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.95 -> 1.96 --- Log message: absolute addresses must match pointer size --- Diffs of the changes: (+1 -0) AsmPrinter.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.95 llvm/lib/CodeGen/AsmPrinter.cpp:1.96 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.95 Thu Sep 14 02:35:00 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Mon Sep 18 12:59:35 2006 @@ -714,6 +714,7 @@ if (OpNo >= MI->getNumOperands()) { Error = true; + std::cerr << "Too many operands\n"; } else { unsigned OpFlags = MI->getOperand(OpNo).getImmedValue(); ++OpNo; // Skip over the ID number. From alenhar2 at cs.uiuc.edu Mon Sep 18 13:00:32 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Mon, 18 Sep 2006 13:00:32 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp Message-ID: <200609181800.k8II0Wl9014796@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.96 -> 1.97 --- Log message: oops --- Diffs of the changes: (+0 -1) AsmPrinter.cpp | 1 - 1 files changed, 1 deletion(-) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.96 llvm/lib/CodeGen/AsmPrinter.cpp:1.97 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.96 Mon Sep 18 12:59:35 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Mon Sep 18 13:00:18 2006 @@ -714,7 +714,6 @@ if (OpNo >= MI->getNumOperands()) { Error = true; - std::cerr << "Too many operands\n"; } else { unsigned OpFlags = MI->getOperand(OpNo).getImmedValue(); ++OpNo; // Skip over the ID number. From alenhar2 at cs.uiuc.edu Mon Sep 18 12:59:52 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Mon, 18 Sep 2006 12:59:52 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200609181759.k8IHxqbD014749@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.276 -> 1.277 --- Log message: absolute addresses must match pointer size --- Diffs of the changes: (+1 -1) SelectionDAGISel.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.276 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.277 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.276 Wed Sep 13 01:02:42 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Sep 18 12:59:35 2006 @@ -866,7 +866,7 @@ DAG.getConstant(EntrySize, PTy)); SDOperand TAB = DAG.getJumpTable(JT.JTI,PTy); SDOperand ADD = DAG.getNode(ISD::ADD, PTy, IDX, TAB); - SDOperand LD = DAG.getLoad(MVT::i32, Copy.getValue(1), ADD, + SDOperand LD = DAG.getLoad(PTy, Copy.getValue(1), ADD, DAG.getSrcValue(0)); if (TLI.getTargetMachine().getRelocationModel() == Reloc::PIC_) { ADD = DAG.getNode(ISD::ADD, PTy, From alenhar2 at cs.uiuc.edu Mon Sep 18 13:01:18 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Mon, 18 Sep 2006 13:01:18 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp AlphaISelLowering.cpp AlphaInstrInfo.td Message-ID: <200609181801.k8II1Ij7014850@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaAsmPrinter.cpp updated: 1.49 -> 1.50 AlphaISelLowering.cpp updated: 1.60 -> 1.61 AlphaInstrInfo.td updated: 1.123 -> 1.124 --- Log message: Jump tables on Alpha --- Diffs of the changes: (+38 -2) AlphaAsmPrinter.cpp | 8 ++++++++ AlphaISelLowering.cpp | 20 +++++++++++++++++++- AlphaInstrInfo.td | 12 +++++++++++- 3 files changed, 38 insertions(+), 2 deletions(-) Index: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp diff -u llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.49 llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.50 --- llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.49 Thu Sep 14 13:23:26 2006 +++ llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp Mon Sep 18 13:01:03 2006 @@ -126,6 +126,11 @@ O << Mang->getValueName(MO.getGlobal()); return; + case MachineOperand::MO_JumpTableIndex: + O << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() + << '_' << MO.getJumpTableIndex(); + return; + default: O << ""; return; @@ -156,6 +161,9 @@ // Print out constants referenced by the function EmitConstantPool(MF.getConstantPool()); + // Print out jump tables referenced by the function + EmitJumpTableInfo(MF.getJumpTableInfo()); + // Print out labels for the function. const Function *F = MF.getFunction(); SwitchToTextSection(".text", F); Index: llvm/lib/Target/Alpha/AlphaISelLowering.cpp diff -u llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.60 llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.61 --- llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.60 Tue Sep 12 16:02:05 2006 +++ llvm/lib/Target/Alpha/AlphaISelLowering.cpp Mon Sep 18 13:01:03 2006 @@ -48,7 +48,7 @@ addRegisterClass(MVT::f64, Alpha::F8RCRegisterClass); addRegisterClass(MVT::f32, Alpha::F4RCRegisterClass); - setOperationAction(ISD::BRIND, MVT::i64, Expand); + // setOperationAction(ISD::BRIND, MVT::i64, Expand); setOperationAction(ISD::BR_CC, MVT::Other, Expand); setOperationAction(ISD::SELECT_CC, MVT::Other, Expand); @@ -128,6 +128,8 @@ setOperationAction(ISD::RET, MVT::Other, Custom); + setOperationAction(ISD::JumpTable, MVT::i64, Custom); + setStackPointerRegisterToSaveRestore(Alpha::R30); setOperationAction(ISD::ConstantFP, MVT::f64, Expand); @@ -162,6 +164,20 @@ } } +static SDOperand LowerJumpTable(SDOperand Op, SelectionDAG &DAG) { + MVT::ValueType PtrVT = Op.getValueType(); + JumpTableSDNode *JT = cast(Op); + SDOperand JTI = DAG.getTargetJumpTable(JT->getIndex(), PtrVT); + SDOperand Zero = DAG.getConstant(0, PtrVT); + + const TargetMachine &TM = DAG.getTarget(); + + SDOperand Hi = DAG.getNode(AlphaISD::GPRelHi, MVT::i64, JTI, + DAG.getNode(AlphaISD::GlobalBaseReg, MVT::i64)); + SDOperand Lo = DAG.getNode(AlphaISD::GPRelLo, MVT::i64, JTI, Hi); + return Lo; +} + //http://www.cs.arizona.edu/computer.help/policy/DIGITAL_unix/ //AA-PY8AC-TET1_html/callCH3.html#BLOCK21 @@ -395,6 +411,8 @@ VarArgsOffset, GP, RA); case ISD::RET: return LowerRET(Op,DAG, getVRegRA()); + case ISD::JumpTable: return LowerJumpTable(Op, DAG); + case ISD::SINT_TO_FP: { assert(MVT::i64 == Op.getOperand(0).getValueType() && "Unhandled SINT_TO_FP type in custom expander!"); Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.123 llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.124 --- llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.123 Fri Aug 11 04:01:43 2006 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.td Mon Sep 18 13:01:03 2006 @@ -435,7 +435,11 @@ def RETDAGp : MbrpForm< 0x1A, 0x02, (ops), "ret $$31,($$26),1", [(retflag)], s_jsr>; //Return from subroutine } -def JMP : MbrForm< 0x1A, 0x00, (ops GPRC:$RD, GPRC:$RS, GPRC:$DISP), "jmp $RD,($RS),$DISP", s_jsr>; //Jump +let isBranch = 1, isTerminator = 1, noResults = 1, isBarrier = 1, +Ra = 31, disp = 0 in +def JMP : MbrpForm< 0x1A, 0x00, (ops GPRC:$RS), "jmp $$31,($RS),0", + [(brind GPRC:$RS)], s_jsr>; //Jump + let isCall = 1, noResults = 1, Ra = 26, Defs = [R0, R1, R2, R3, R4, R5, R6, R7, R8, R16, R17, R18, R19, R20, R21, R22, R23, R24, R25, R26, R27, R28, R29, @@ -545,6 +549,12 @@ def : Pat<(f64 (load (Alpha_gprello tconstpool:$DISP, GPRC:$RB))), (LDTr tconstpool:$DISP, GPRC:$RB)>; +//jumptable rels +def : Pat<(i64 (Alpha_gprelhi tjumptable:$DISP, GPRC:$RB)), + (LDAHr tjumptable:$DISP, GPRC:$RB)>; +def : Pat<(i64 (Alpha_gprello tjumptable:$DISP, GPRC:$RB)), + (LDAr tjumptable:$DISP, GPRC:$RB)>; + //misc ext patterns def : Pat<(i64 (extload (add GPRC:$RB, immSExt16:$DISP), i8)), From sabre at nondot.org Mon Sep 18 13:08:06 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 18 Sep 2006 13:08:06 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CFrontend/2006-09-18-fwrite-cast-crash.c Message-ID: <200609181808.k8II86H7015016@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CFrontend: 2006-09-18-fwrite-cast-crash.c added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+13 -0) 2006-09-18-fwrite-cast-crash.c | 13 +++++++++++++ 1 files changed, 13 insertions(+) Index: llvm/test/Regression/CFrontend/2006-09-18-fwrite-cast-crash.c diff -c /dev/null llvm/test/Regression/CFrontend/2006-09-18-fwrite-cast-crash.c:1.1 *** /dev/null Mon Sep 18 13:08:01 2006 --- llvm/test/Regression/CFrontend/2006-09-18-fwrite-cast-crash.c Mon Sep 18 13:07:51 2006 *************** *** 0 **** --- 1,13 ---- + // RUN: %llvmgcc %s -S -o - + // PR910 + + struct l_struct_2E_FILE { char x; }; + unsigned fwrite(signed char *, unsigned , unsigned , signed char *); + static signed char str301[39]; + static void Usage(signed char *ltmp_611_6) { + struct l_struct_2E_FILE *ltmp_6202_16; + unsigned ltmp_6203_92; + ltmp_6203_92 = /*tail*/ ((unsigned (*) (signed char *, unsigned , unsigned , + struct l_struct_2E_FILE *))(void*)fwrite)((&(str301[0u])), 38u, 1u, ltmp_6202_16); + } + From sabre at nondot.org Mon Sep 18 13:27:19 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 18 Sep 2006 13:27:19 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200609181827.k8IIRJBx015385@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.508 -> 1.509 --- Log message: Fix an infinite loop building the CFE --- Diffs of the changes: (+2 -1) InstructionCombining.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.508 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.509 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.508 Mon Sep 18 00:27:43 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Sep 18 13:27:05 2006 @@ -3988,7 +3988,8 @@ // preferable because it allows the C<hasOneUse() && CI->isNullValue() && - I.isEquality() && !Shift->isArithmeticShift()) { + I.isEquality() && !Shift->isArithmeticShift() && + isa(Shift->getOperand(0))) { // Compute C << Y. Value *NS; if (Shift->getOpcode() == Instruction::Shr) { From nicholas at mxc.ca Mon Sep 18 14:04:14 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 18 Sep 2006 14:04:14 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Instructions.h Message-ID: <200609181904.k8IJ4E38015989@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Instructions.h updated: 1.40 -> 1.41 --- Log message: Add a new helper method to SwitchInst. Useful when you've got a BB from somewhere (like the dominator graph) and would like to know which case it came from. --- Diffs of the changes: (+13 -0) Instructions.h | 13 +++++++++++++ 1 files changed, 13 insertions(+) Index: llvm/include/llvm/Instructions.h diff -u llvm/include/llvm/Instructions.h:1.40 llvm/include/llvm/Instructions.h:1.41 --- llvm/include/llvm/Instructions.h:1.40 Sun Sep 17 23:54:57 2006 +++ llvm/include/llvm/Instructions.h Mon Sep 18 14:03:59 2006 @@ -1310,6 +1310,19 @@ return 0; } + /// findCaseDest - Finds the unique case value for a given successor. Returns + /// null if the successor is not found, not unique, or is the default case. + ConstantInt *findCaseDest(BasicBlock *BB) { + ConstantInt *CI = NULL; + for (unsigned i = 1, e = getNumCases(); i != e; ++i) { + if (getSuccessor(i) == BB) { + if (CI) return NULL; // Multiple cases lead to BB. + else CI = getCaseValue(i); + } + } + return CI; + } + /// addCase - Add an entry to the switch instruction... /// void addCase(ConstantInt *OnVal, BasicBlock *Dest); From alenhar2 at cs.uiuc.edu Mon Sep 18 14:44:44 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Mon, 18 Sep 2006 14:44:44 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaLLRP.cpp Alpha.h AlphaTargetMachine.cpp Message-ID: <200609181944.k8IJiiqj016687@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaLLRP.cpp added (r1.1) Alpha.h updated: 1.6 -> 1.7 AlphaTargetMachine.cpp updated: 1.31 -> 1.32 --- Log message: A pass to remove the worst of the replay trap offenders, and as a bonus, align basic blocks when it is free to do so --- Diffs of the changes: (+146 -0) Alpha.h | 2 AlphaLLRP.cpp | 143 +++++++++++++++++++++++++++++++++++++++++++++++++ AlphaTargetMachine.cpp | 1 3 files changed, 146 insertions(+) Index: llvm/lib/Target/Alpha/AlphaLLRP.cpp diff -c /dev/null llvm/lib/Target/Alpha/AlphaLLRP.cpp:1.1 *** /dev/null Mon Sep 18 14:44:39 2006 --- llvm/lib/Target/Alpha/AlphaLLRP.cpp Mon Sep 18 14:44:29 2006 *************** *** 0 **** --- 1,143 ---- + //===-- AlphaLLRP.cpp - Alpha Load Load Replay Trap elimination pass. -- --===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Andrew Lenharth and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // Here we check for potential replay traps introduced by the spiller + // We also align some branch targets if we can do so for free + //===----------------------------------------------------------------------===// + + + #include "Alpha.h" + #include "llvm/CodeGen/MachineFunctionPass.h" + #include "llvm/CodeGen/MachineInstrBuilder.h" + #include "llvm/ADT/SetOperations.h" + #include "llvm/ADT/Statistic.h" + #include "llvm/Support/CommandLine.h" + using namespace llvm; + + namespace { + Statistic<> nopintro("alpha-nops", "Number of nops inserted"); + Statistic<> nopalign("alpha-nops-align", + "Number of nops inserted for alignment"); + + cl::opt + AlignAll("alpha-align-all", cl::Hidden, + cl::desc("Align all blocks")); + + struct AlphaLLRPPass : public MachineFunctionPass { + /// Target machine description which we query for reg. names, data + /// layout, etc. + /// + AlphaTargetMachine &TM; + + AlphaLLRPPass(AlphaTargetMachine &tm) : TM(tm) { } + + virtual const char *getPassName() const { + return "Alpha NOP inserter"; + } + + bool runOnMachineFunction(MachineFunction &F) { + bool Changed = false; + MachineInstr* prev[3] = {0,0,0}; + unsigned count = 0; + for (MachineFunction::iterator FI = F.begin(), FE = F.end(); + FI != FE; ++FI) { + MachineBasicBlock& MBB = *FI; + bool ub = false; + for (MachineBasicBlock::iterator I = MBB.begin(); I != MBB.end(); ) { + if (count%4 == 0) + prev[0] = prev[1] = prev[2] = 0; //Slots cleared at fetch boundary + ++count; + MachineInstr *MI = I++; + switch (MI->getOpcode()) { + case Alpha::LDQ: case Alpha::LDL: + case Alpha::LDWU: case Alpha::LDBU: + case Alpha::LDT: case Alpha::LDS: + + case Alpha::STQ: case Alpha::STL: + case Alpha::STW: case Alpha::STB: + case Alpha::STT: case Alpha::STS: + if (MI->getOperand(2).getReg() == Alpha::R30) { + if (prev[0] + && prev[0]->getOperand(2).getReg() == + MI->getOperand(2).getReg() + && prev[0]->getOperand(1).getImmedValue() == + MI->getOperand(1).getImmedValue()) { + prev[0] = prev[1]; + prev[1] = prev[2]; + prev[2] = 0; + BuildMI(MBB, MI, Alpha::BIS, 2, Alpha::R31).addReg(Alpha::R31) + .addReg(Alpha::R31); + Changed = true; nopintro += 1; + count += 1; + } else if (prev[1] + && prev[1]->getOperand(2).getReg() == + MI->getOperand(2).getReg() + && prev[1]->getOperand(1).getImmedValue() == + MI->getOperand(1).getImmedValue()) { + prev[0] = prev[2]; + prev[1] = prev[2] = 0; + BuildMI(MBB, MI, Alpha::BIS, 2, Alpha::R31).addReg(Alpha::R31) + .addReg(Alpha::R31); + BuildMI(MBB, MI, Alpha::BIS, 2, Alpha::R31).addReg(Alpha::R31) + .addReg(Alpha::R31); + Changed = true; nopintro += 2; + count += 2; + } else if (prev[2] + && prev[2]->getOperand(2).getReg() == + MI->getOperand(2).getReg() + && prev[2]->getOperand(1).getImmedValue() == + MI->getOperand(1).getImmedValue()) { + prev[0] = prev[1] = prev[2] = 0; + BuildMI(MBB, MI, Alpha::BIS, 2, Alpha::R31).addReg(Alpha::R31) + .addReg(Alpha::R31); + BuildMI(MBB, MI, Alpha::BIS, 2, Alpha::R31).addReg(Alpha::R31) + .addReg(Alpha::R31); + BuildMI(MBB, MI, Alpha::BIS, 2, Alpha::R31).addReg(Alpha::R31) + .addReg(Alpha::R31); + Changed = true; nopintro += 3; + count += 3; + } + prev[0] = prev[1]; + prev[1] = prev[2]; + prev[2] = MI; + break; + } + //fall through + case Alpha::BR: + case Alpha::JMP: + ub = true; + //fall through + default: + prev[0] = prev[1]; + prev[1] = prev[2]; + prev[2] = 0; + break; + } + } + if (ub || AlignAll) { + //we can align stuff for free at this point + while (count % 4) { + BuildMI(MBB, MBB.end(), Alpha::BIS, 2, Alpha::R31) + .addReg(Alpha::R31).addReg(Alpha::R31); + ++count; + ++nopalign; + prev[0] = prev[1]; + prev[1] = prev[2]; + prev[2] = 0; + } + } + } + return Changed; + } + }; + } // end of anonymous namespace + + FunctionPass *llvm::createAlphaLLRPPass(AlphaTargetMachine &tm) { + return new AlphaLLRPPass(tm); + } Index: llvm/lib/Target/Alpha/Alpha.h diff -u llvm/lib/Target/Alpha/Alpha.h:1.6 llvm/lib/Target/Alpha/Alpha.h:1.7 --- llvm/lib/Target/Alpha/Alpha.h:1.6 Tue Jul 25 15:40:54 2006 +++ llvm/lib/Target/Alpha/Alpha.h Mon Sep 18 14:44:29 2006 @@ -31,6 +31,8 @@ FunctionPass *createAlphaPatternInstructionSelector(TargetMachine &TM); FunctionPass *createAlphaCodeEmitterPass(AlphaTargetMachine &TM, MachineCodeEmitter &MCE); + FunctionPass *createAlphaLLRPPass(AlphaTargetMachine &tm); + } // end namespace llvm; // Defines symbolic names for Alpha registers. This defines a mapping from Index: llvm/lib/Target/Alpha/AlphaTargetMachine.cpp diff -u llvm/lib/Target/Alpha/AlphaTargetMachine.cpp:1.31 llvm/lib/Target/Alpha/AlphaTargetMachine.cpp:1.32 --- llvm/lib/Target/Alpha/AlphaTargetMachine.cpp:1.31 Thu Sep 7 18:39:26 2006 +++ llvm/lib/Target/Alpha/AlphaTargetMachine.cpp Mon Sep 18 14:44:29 2006 @@ -77,6 +77,7 @@ } bool AlphaTargetMachine::addAssemblyEmitter(FunctionPassManager &PM, bool Fast, std::ostream &Out) { + PM.add(createAlphaLLRPPass(*this)); PM.add(createAlphaCodePrinterPass(Out, *this)); return false; } From nicholas at mxc.ca Mon Sep 18 15:44:51 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 18 Sep 2006 15:44:51 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Instructions.h Message-ID: <200609182044.k8IKipvQ018080@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Instructions.h updated: 1.41 -> 1.42 --- Log message: Fix findCaseDest to return null when BB is both the default dest and one of the numeric cases. --- Diffs of the changes: (+2 -0) Instructions.h | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/include/llvm/Instructions.h diff -u llvm/include/llvm/Instructions.h:1.41 llvm/include/llvm/Instructions.h:1.42 --- llvm/include/llvm/Instructions.h:1.41 Mon Sep 18 14:03:59 2006 +++ llvm/include/llvm/Instructions.h Mon Sep 18 15:44:37 2006 @@ -1313,6 +1313,8 @@ /// findCaseDest - Finds the unique case value for a given successor. Returns /// null if the successor is not found, not unique, or is the default case. ConstantInt *findCaseDest(BasicBlock *BB) { + if (BB == getDefaultDest()) return NULL; + ConstantInt *CI = NULL; for (unsigned i = 1, e = getNumCases(); i != e; ++i) { if (getSuccessor(i) == BB) { From nicholas at mxc.ca Mon Sep 18 16:09:49 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 18 Sep 2006 16:09:49 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Message-ID: <200609182109.k8IL9ncF018546@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: PredicateSimplifier.cpp updated: 1.10 -> 1.11 --- Log message: Walk down the dominator tree instead of the control flow graph. That means that we can't modify the CFG any more, at least not until it's possible to update the dominator tree (PR217: http://llvm.org/PR217 ). --- Diffs of the changes: (+92 -152) PredicateSimplifier.cpp | 244 ++++++++++++++++++------------------------------ 1 files changed, 92 insertions(+), 152 deletions(-) Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.10 llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.11 --- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.10 Wed Sep 13 14:32:53 2006 +++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Mon Sep 18 16:09:35 2006 @@ -48,10 +48,6 @@ NumVarsReplaced("predsimplify", "Number of argument substitutions"); Statistic<> NumInstruction("predsimplify", "Number of instructions removed"); - Statistic<> - NumSwitchCases("predsimplify", "Number of switch cases removed"); - Statistic<> - NumBranches("predsimplify", "Number of branches made unconditional"); /// Returns true if V1 is a better choice than V2. Note that it is /// not a total ordering. @@ -126,21 +122,18 @@ } ElemTy &getLeader(iterator I) { - assert(I != 0 && "Element zero is out of range."); - assert(I <= leaders.size() && "Invalid iterator."); + assert(I && I <= leaders.size() && "Illegal leader to get."); return leaders[I-1]; } const ElemTy &getLeader(const_iterator I) const { - assert(I != 0 && "Element zero is out of range."); + assert(I && I <= leaders.size() && "Illegal leaders to get."); return leaders[I-1]; } #ifdef DEBUG void debug(std::ostream &os) const { - std::set Unique; for (unsigned i = 1, e = leaders.size()+1; i != e; ++i) { - Unique.insert(getLeader(i)); os << i << ". " << *getLeader(i) << ": ["; for (std::map::const_iterator I = mapping.begin(), E = mapping.end(); I != E; ++I) { @@ -150,14 +143,6 @@ } os << "]\n"; } - assert(Unique.size() == leaders.size() && "Duplicate leaders."); - - for (typename std::map::const_iterator - I = mapping.begin(), E = mapping.end(); I != E; ++I) { - assert(I->second != 0 && "Zero iterator in mapping."); - assert(I->second <= leaders.size() && - "Invalid iterator found in mapping."); - } } #endif @@ -263,7 +248,6 @@ order(V1, V2); if (isa(V2)) return; // refuse to set false == true. - DEBUG(std::cerr << "equal: " << *V1 << " and " << *V2 << "\n"); SynonymIterator deleted = union_find.unionSets(V1, V2); if (deleted) { SynonymIterator replacement = union_find.findLeader(V1); @@ -286,7 +270,6 @@ // For example, %x = setne int 0, 0 causes "0 != 0". if (isa(V1) && isa(V2)) return; - DEBUG(std::cerr << "not equal: " << *V1 << " and " << *V2 << "\n"); if (findProperty(NE, V1, V2) != Properties.end()) return; // found. @@ -450,8 +433,6 @@ E = Properties.end(); I != E; ++I) { os << (*I).I1 << " " << OpcodeTable[(*I).Opcode] << " " << (*I).I2 << "\n"; - assert((*I).I1 <= size && "Invalid property."); - assert((*I).I2 <= size && "Invalid property."); } os << "\n"; } @@ -478,25 +459,24 @@ // Used by terminator instructions to proceed from the current basic // block to the next. Verifies that "current" dominates "next", // then calls visitBasicBlock. - void proceedToSuccessor(PropertySet &CurrentPS, PropertySet &NextPS, - DTNodeType *Current, DTNodeType *Next); - void proceedToSuccessor(PropertySet &CurrentPS, - DTNodeType *Current, DTNodeType *Next); + void proceedToSuccessor(TerminatorInst *TI, unsigned edge, + PropertySet &CurrentPS, PropertySet &NextPS); + void proceedToSuccessors(PropertySet &CurrentPS, BasicBlock *Current); // Visits each instruction in the basic block. - void visitBasicBlock(DTNodeType *DTNode, PropertySet &KnownProperties); + void visitBasicBlock(BasicBlock *Block, PropertySet &KnownProperties); // Tries to simplify each Instruction and add new properties to // the PropertySet. Returns true if it erase the instruction. - void visitInstruction(Instruction *I, DTNodeType *, PropertySet &); + void visitInstruction(Instruction *I, PropertySet &); // For each instruction, add the properties to KnownProperties. - void visit(TerminatorInst *TI, DTNodeType *, PropertySet &); - void visit(BranchInst *BI, DTNodeType *, PropertySet &); - void visit(SwitchInst *SI, DTNodeType *, PropertySet); - void visit(LoadInst *LI, DTNodeType *, PropertySet &); - void visit(StoreInst *SI, DTNodeType *, PropertySet &); - void visit(BinaryOperator *BO, DTNodeType *, PropertySet &); + void visit(TerminatorInst *TI, PropertySet &); + void visit(BranchInst *BI, PropertySet &); + void visit(SwitchInst *SI, PropertySet); + void visit(LoadInst *LI, PropertySet &); + void visit(StoreInst *SI, PropertySet &); + void visit(BinaryOperator *BO, PropertySet &); DominatorTree *DT; bool modified; @@ -515,12 +495,13 @@ modified = false; PropertySet KnownProperties; - visitBasicBlock(DT->getRootNode(), KnownProperties); + visitBasicBlock(DT->getRootNode()->getBlock(), KnownProperties); return modified; } void PredicateSimplifier::getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); + AU.setPreservesCFG(); } // resolve catches cases addProperty won't because it wasn't used as a @@ -611,8 +592,6 @@ V = KP.canonicalize(V); - DEBUG(std::cerr << "peering into " << *V << "\n"); - if (BinaryOperator *BO = dyn_cast(V)) return resolve(BO, KP); else if (SelectInst *SI = dyn_cast(V)) @@ -621,24 +600,17 @@ return V; } -void PredicateSimplifier::visitBasicBlock(DTNodeType *DTNode, +void PredicateSimplifier::visitBasicBlock(BasicBlock *BB, PropertySet &KnownProperties) { - BasicBlock *BB = DTNode->getBlock(); for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E;) { - visitInstruction(I++, DTNode, KnownProperties); + visitInstruction(I++, KnownProperties); } } void PredicateSimplifier::visitInstruction(Instruction *I, - DTNodeType *DTNode, PropertySet &KnownProperties) { - - DEBUG(std::cerr << "Considering instruction " << *I << "\n"); - DEBUG(KnownProperties.debug(std::cerr)); - // Try to replace the whole instruction. Value *V = resolve(I, KnownProperties); - assert(V->getType() == I->getType() && "Instruction type mutated!"); if (V != I) { modified = true; ++NumInstruction; @@ -651,7 +623,6 @@ for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) { Value *Oper = I->getOperand(i); Value *V = resolve(Oper, KnownProperties); - assert(V->getType() == Oper->getType() && "Operand type mutated!"); if (V != Oper) { modified = true; ++NumVarsReplaced; @@ -662,54 +633,60 @@ } if (TerminatorInst *TI = dyn_cast(I)) - visit(TI, DTNode, KnownProperties); + visit(TI, KnownProperties); else if (LoadInst *LI = dyn_cast(I)) - visit(LI, DTNode, KnownProperties); + visit(LI, KnownProperties); else if (StoreInst *SI = dyn_cast(I)) - visit(SI, DTNode, KnownProperties); + visit(SI, KnownProperties); else if (BinaryOperator *BO = dyn_cast(I)) - visit(BO, DTNode, KnownProperties); + visit(BO, KnownProperties); } -void PredicateSimplifier::proceedToSuccessor(PropertySet &CurrentPS, - PropertySet &NextPS, - DTNodeType *Current, - DTNodeType *Next) { - if (Next->getBlock()->getSinglePredecessor() == Current->getBlock()) - proceedToSuccessor(NextPS, Current, Next); +// The basic block on the target of the specified edge must be known +// to be immediately dominated by the parent of the TerminatorInst. +void PredicateSimplifier::proceedToSuccessor(TerminatorInst *TI, + unsigned edge, + PropertySet &CurrentPS, + PropertySet &NextPS) { + assert(edge < TI->getNumSuccessors() && "Invalid index for edge."); + + BasicBlock *BB = TI->getParent(), + *BBNext = TI->getSuccessor(edge); + + if (BBNext->getSinglePredecessor() == BB) + visitBasicBlock(BBNext, NextPS); else - proceedToSuccessor(CurrentPS, Current, Next); + visitBasicBlock(BBNext, CurrentPS); } -void PredicateSimplifier::proceedToSuccessor(PropertySet &KP, - DTNodeType *Current, - DTNodeType *Next) { - if (Current->properlyDominates(Next)) - visitBasicBlock(Next, KP); +void PredicateSimplifier::proceedToSuccessors(PropertySet &KP, + BasicBlock *BBCurrent) { + DTNodeType *Current = DT->getNode(BBCurrent); + for (DTNodeType::iterator I = Current->begin(), E = Current->end(); + I != E; ++I) { + PropertySet Copy(KP); + visitBasicBlock((*I)->getBlock(), Copy); + } } -void PredicateSimplifier::visit(TerminatorInst *TI, DTNodeType *Node, - PropertySet &KP) { +void PredicateSimplifier::visit(TerminatorInst *TI, PropertySet &KP) { if (BranchInst *BI = dyn_cast(TI)) { - visit(BI, Node, KP); + visit(BI, KP); return; } if (SwitchInst *SI = dyn_cast(TI)) { - visit(SI, Node, KP); + visit(SI, KP); return; } - for (unsigned i = 0, E = TI->getNumSuccessors(); i != E; ++i) { - BasicBlock *BB = TI->getSuccessor(i); - PropertySet KPcopy(KP); - proceedToSuccessor(KPcopy, Node, DT->getNode(TI->getSuccessor(i))); - } + proceedToSuccessors(KP, TI->getParent()); } -void PredicateSimplifier::visit(BranchInst *BI, DTNodeType *Node, - PropertySet &KP) { +void PredicateSimplifier::visit(BranchInst *BI, PropertySet &KP) { + BasicBlock *BB = BI->getParent(); + if (BI->isUnconditional()) { - proceedToSuccessor(KP, Node, DT->getNode(BI->getSuccessor(0))); + proceedToSuccessors(KP, BB); return; } @@ -718,110 +695,73 @@ BasicBlock *TrueDest = BI->getSuccessor(0), *FalseDest = BI->getSuccessor(1); - if (Condition == ConstantBool::True) { - FalseDest->removePredecessor(BI->getParent()); - BI->setUnconditionalDest(TrueDest); - modified = true; - ++NumBranches; - proceedToSuccessor(KP, Node, DT->getNode(TrueDest)); + if (Condition == ConstantBool::True || TrueDest == FalseDest) { + proceedToSuccessors(KP, BB); return; } else if (Condition == ConstantBool::False) { - TrueDest->removePredecessor(BI->getParent()); - BI->setUnconditionalDest(FalseDest); - modified = true; - ++NumBranches; - proceedToSuccessor(KP, Node, DT->getNode(FalseDest)); + proceedToSuccessors(KP, BB); return; } - PropertySet TrueProperties(KP), FalseProperties(KP); - DEBUG(std::cerr << "true set:\n"); - TrueProperties.addEqual(ConstantBool::True, Condition); - DEBUG(TrueProperties.debug(std::cerr)); - DEBUG(std::cerr << "false set:\n"); - FalseProperties.addEqual(ConstantBool::False, Condition); - DEBUG(FalseProperties.debug(std::cerr)); - - PropertySet KPcopy(KP); - proceedToSuccessor(KP, TrueProperties, Node, DT->getNode(TrueDest)); - proceedToSuccessor(KPcopy, FalseProperties, Node, DT->getNode(FalseDest)); -} - -void PredicateSimplifier::visit(SwitchInst *SI, DTNodeType *DTNode, - PropertySet KP) { - Value *Condition = SI->getCondition(); - assert(Condition == KP.canonicalize(Condition) && - "Instruction wasn't already canonicalized?"); + DTNodeType *Node = DT->getNode(BB); + for (DTNodeType::iterator I = Node->begin(), E = Node->end(); I != E; ++I) { + if ((*I)->getBlock() == TrueDest) { + PropertySet TrueProperties(KP); + TrueProperties.addEqual(ConstantBool::True, Condition); + proceedToSuccessor(BI, 0, KP, TrueProperties); + continue; + } - // If there's an NEProperty covering this SwitchInst, we may be able to - // eliminate one of the cases. - for (PropertySet::ConstPropertyIterator I = KP.Properties.begin(), - E = KP.Properties.end(); I != E; ++I) { - if (I->Opcode != PropertySet::NE) continue; - Value *V1 = KP.union_find.getLeader(I->I1), - *V2 = KP.union_find.getLeader(I->I2); - - // Find a Property with a ConstantInt on one side and our - // Condition on the other. - ConstantInt *CI = NULL; - if (V1 == Condition) - CI = dyn_cast(V2); - else if (V2 == Condition) - CI = dyn_cast(V1); - - if (!CI) continue; - - unsigned i = SI->findCaseValue(CI); - if (i != 0) { // zero is reserved for the default case. - SI->getSuccessor(i)->removePredecessor(SI->getParent()); - SI->removeCase(i); - modified = true; - ++NumSwitchCases; + if ((*I)->getBlock() == FalseDest) { + PropertySet FalseProperties(KP); + FalseProperties.addEqual(ConstantBool::False, Condition); + proceedToSuccessor(BI, 1, KP, FalseProperties); + continue; } + + visitBasicBlock((*I)->getBlock(), KP); } +} + +void PredicateSimplifier::visit(SwitchInst *SI, PropertySet KP) { + Value *Condition = SI->getCondition(); // Set the EQProperty in each of the cases BBs, // and the NEProperties in the default BB. PropertySet DefaultProperties(KP); - DTNodeType *Node = DT->getNode(SI->getParent()), - *DefaultNode = DT->getNode(SI->getSuccessor(0)); - if (!Node->dominates(DefaultNode)) DefaultNode = NULL; - - for (unsigned I = 1, E = SI->getNumCases(); I < E; ++I) { - ConstantInt *CI = SI->getCaseValue(I); - - BasicBlock *SuccBB = SI->getSuccessor(I); - PropertySet copy(KP); - if (SuccBB->getSinglePredecessor()) { + DTNodeType *Node = DT->getNode(SI->getParent()); + for (DTNodeType::iterator I = Node->begin(), E = Node->end(); I != E; ++I) { + BasicBlock *BB = (*I)->getBlock(); + + PropertySet Copy(KP); + + if (BB == SI->getDefaultDest()) { PropertySet NewProperties(KP); - NewProperties.addEqual(Condition, CI); - proceedToSuccessor(copy, NewProperties, DTNode, DT->getNode(SuccBB)); - } else - proceedToSuccessor(copy, DTNode, DT->getNode(SuccBB)); + for (unsigned i = 1, e = SI->getNumCases(); i < e; ++i) + NewProperties.addNotEqual(Condition, SI->getCaseValue(i)); - if (DefaultNode) - DefaultProperties.addNotEqual(Condition, CI); + proceedToSuccessor(SI, 0, Copy, NewProperties); + } else if (ConstantInt *CI = SI->findCaseDest(BB)) { + PropertySet NewProperties(KP); + NewProperties.addEqual(Condition, CI); + proceedToSuccessor(SI, SI->findCaseValue(CI), Copy, NewProperties); + } else + visitBasicBlock(BB, Copy); } - - if (DefaultNode) - proceedToSuccessor(DefaultProperties, DTNode, DefaultNode); } -void PredicateSimplifier::visit(LoadInst *LI, DTNodeType *, - PropertySet &KP) { +void PredicateSimplifier::visit(LoadInst *LI, PropertySet &KP) { Value *Ptr = LI->getPointerOperand(); KP.addNotEqual(Constant::getNullValue(Ptr->getType()), Ptr); } -void PredicateSimplifier::visit(StoreInst *SI, DTNodeType *, - PropertySet &KP) { +void PredicateSimplifier::visit(StoreInst *SI, PropertySet &KP) { Value *Ptr = SI->getPointerOperand(); KP.addNotEqual(Constant::getNullValue(Ptr->getType()), Ptr); } -void PredicateSimplifier::visit(BinaryOperator *BO, DTNodeType *, - PropertySet &KP) { +void PredicateSimplifier::visit(BinaryOperator *BO, PropertySet &KP) { Instruction::BinaryOps ops = BO->getOpcode(); switch (ops) { From evan.cheng at apple.com Mon Sep 18 16:49:18 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 18 Sep 2006 16:49:18 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200609182149.k8ILnIwX019294@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.396 -> 1.397 --- Log message: Allow i32 UDIV, SDIV, UREM, SREM to be expanded into libcalls. --- Diffs of the changes: (+30 -6) LegalizeDAG.cpp | 36 ++++++++++++++++++++++++++++++------ 1 files changed, 30 insertions(+), 6 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.396 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.397 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.396 Sat Sep 16 00:08:34 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Sep 18 16:49:04 2006 @@ -2148,6 +2148,19 @@ if (Tmp1.Val) Result = Tmp1; break; case TargetLowering::Expand: { + if (Node->getValueType(0) == MVT::i32) { + switch (Node->getOpcode()) { + default: assert(0 && "Do not know how to expand this integer BinOp!"); + case ISD::UDIV: + case ISD::SDIV: + const char *FnName = Node->getOpcode() == ISD::UDIV + ? "__udivsi3" : "__divsi3"; + SDOperand Dummy; + Result = ExpandLibCall(FnName, Node, Dummy); + }; + break; + } + assert(MVT::isVector(Node->getValueType(0)) && "Cannot expand this binary operator!"); // Expand the operation into a bunch of nasty scalar code. @@ -2318,13 +2331,24 @@ } break; case TargetLowering::Expand: + unsigned DivOpc= (Node->getOpcode() == ISD::UREM) ? ISD::UDIV : ISD::SREM; if (MVT::isInteger(Node->getValueType(0))) { - // X % Y -> X-X/Y*Y - MVT::ValueType VT = Node->getValueType(0); - unsigned Opc = Node->getOpcode() == ISD::UREM ? ISD::UDIV : ISD::SDIV; - Result = DAG.getNode(Opc, VT, Tmp1, Tmp2); - Result = DAG.getNode(ISD::MUL, VT, Result, Tmp2); - Result = DAG.getNode(ISD::SUB, VT, Tmp1, Result); + if (TLI.getOperationAction(DivOpc, Node->getValueType(0)) == + TargetLowering::Legal) { + // X % Y -> X-X/Y*Y + MVT::ValueType VT = Node->getValueType(0); + unsigned Opc = Node->getOpcode() == ISD::UREM ? ISD::UDIV : ISD::SDIV; + Result = DAG.getNode(Opc, VT, Tmp1, Tmp2); + Result = DAG.getNode(ISD::MUL, VT, Result, Tmp2); + Result = DAG.getNode(ISD::SUB, VT, Tmp1, Result); + } else { + assert(Node->getValueType(0) == MVT::i32 && + "Cannot expand this binary operator!"); + const char *FnName = Node->getOpcode() == ISD::UREM + ? "__umodsi3" : "__modsi3"; + SDOperand Dummy; + Result = ExpandLibCall(FnName, Node, Dummy); + } } else { // Floating point mod -> fmod libcall. const char *FnName = Node->getValueType(0) == MVT::f32 ? "fmodf":"fmod"; From sabre at nondot.org Mon Sep 18 17:28:21 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 18 Sep 2006 17:28:21 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/TableGen/2006-09-18-LargeInt.td Message-ID: <200609182228.k8IMSLWY020155@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/TableGen: 2006-09-18-LargeInt.td added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+5 -0) 2006-09-18-LargeInt.td | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm/test/Regression/TableGen/2006-09-18-LargeInt.td diff -c /dev/null llvm/test/Regression/TableGen/2006-09-18-LargeInt.td:1.1 *** /dev/null Mon Sep 18 17:28:17 2006 --- llvm/test/Regression/TableGen/2006-09-18-LargeInt.td Mon Sep 18 17:28:07 2006 *************** *** 0 **** --- 1,5 ---- + // RUN: tblgen %s | grep -- -65536 + + def X { + int Y = 0xFFFF0000; + } From sabre at nondot.org Mon Sep 18 17:28:41 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 18 Sep 2006 17:28:41 -0500 Subject: [llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp FileLexer.cpp.cvs FileLexer.l FileLexer.l.cvs Message-ID: <200609182228.k8IMSfLw020175@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: DAGISelEmitter.cpp updated: 1.256 -> 1.257 FileLexer.cpp.cvs updated: 1.6 -> 1.7 FileLexer.l updated: 1.30 -> 1.31 FileLexer.l.cvs updated: 1.5 -> 1.6 --- Log message: Fix Regression/TableGen/2006-09-18-LargeInt.td --- Diffs of the changes: (+9 -7) DAGISelEmitter.cpp | 2 ++ FileLexer.cpp.cvs | 6 +++--- FileLexer.l | 4 ++-- FileLexer.l.cvs | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) Index: llvm/utils/TableGen/DAGISelEmitter.cpp diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.256 llvm/utils/TableGen/DAGISelEmitter.cpp:1.257 --- llvm/utils/TableGen/DAGISelEmitter.cpp:1.256 Thu Sep 14 18:54:24 2006 +++ llvm/utils/TableGen/DAGISelEmitter.cpp Mon Sep 18 17:28:27 2006 @@ -2373,6 +2373,8 @@ } } else if (IntInit *II = dynamic_cast(Child->getLeafValue())) { + if (II->getValue() == 2147483647) + std::cerr << "HERE!\n"; emitCheck("isa(" + RootName + utostr(OpNo) + ")"); unsigned CTmp = TmpNo++; emitCode("int64_t CN"+utostr(CTmp)+" = cast("+ Index: llvm/utils/TableGen/FileLexer.cpp.cvs diff -u llvm/utils/TableGen/FileLexer.cpp.cvs:1.6 llvm/utils/TableGen/FileLexer.cpp.cvs:1.7 --- llvm/utils/TableGen/FileLexer.cpp.cvs:1.6 Fri Sep 1 16:14:42 2006 +++ llvm/utils/TableGen/FileLexer.cpp.cvs Mon Sep 18 17:28:27 2006 @@ -21,7 +21,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /var/cvs/llvm/llvm/utils/TableGen/FileLexer.cpp.cvs,v 1.6 2006/09/01 21:14:42 lattner Exp $ + * $Header: /var/cvs/llvm/llvm/utils/TableGen/FileLexer.cpp.cvs,v 1.7 2006/09/18 22:28:27 lattner Exp $ */ #define FLEX_SCANNER @@ -535,8 +535,8 @@ /// static int ParseInt(const char *Str) { if (Str[0] == '0' && Str[1] == 'b') - return strtol(Str+2, 0, 2); - return strtol(Str, 0, 0); + return strtoll(Str+2, 0, 2); + return strtoll(Str, 0, 0); } static int CommentDepth = 0; Index: llvm/utils/TableGen/FileLexer.l diff -u llvm/utils/TableGen/FileLexer.l:1.30 llvm/utils/TableGen/FileLexer.l:1.31 --- llvm/utils/TableGen/FileLexer.l:1.30 Fri Sep 1 16:13:49 2006 +++ llvm/utils/TableGen/FileLexer.l Mon Sep 18 17:28:27 2006 @@ -42,8 +42,8 @@ /// static int ParseInt(const char *Str) { if (Str[0] == '0' && Str[1] == 'b') - return strtol(Str+2, 0, 2); - return strtol(Str, 0, 0); + return strtoll(Str+2, 0, 2); + return strtoll(Str, 0, 0); } static int CommentDepth = 0; Index: llvm/utils/TableGen/FileLexer.l.cvs diff -u llvm/utils/TableGen/FileLexer.l.cvs:1.5 llvm/utils/TableGen/FileLexer.l.cvs:1.6 --- llvm/utils/TableGen/FileLexer.l.cvs:1.5 Fri Sep 1 16:14:42 2006 +++ llvm/utils/TableGen/FileLexer.l.cvs Mon Sep 18 17:28:27 2006 @@ -42,8 +42,8 @@ /// static int ParseInt(const char *Str) { if (Str[0] == '0' && Str[1] == 'b') - return strtol(Str+2, 0, 2); - return strtol(Str, 0, 0); + return strtoll(Str+2, 0, 2); + return strtoll(Str, 0, 0); } static int CommentDepth = 0; From sabre at nondot.org Mon Sep 18 17:41:21 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 18 Sep 2006 17:41:21 -0500 Subject: [llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp Message-ID: <200609182241.k8IMfL3q020499@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: DAGISelEmitter.cpp updated: 1.257 -> 1.258 --- Log message: There! --- Diffs of the changes: (+0 -2) DAGISelEmitter.cpp | 2 -- 1 files changed, 2 deletions(-) Index: llvm/utils/TableGen/DAGISelEmitter.cpp diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.257 llvm/utils/TableGen/DAGISelEmitter.cpp:1.258 --- llvm/utils/TableGen/DAGISelEmitter.cpp:1.257 Mon Sep 18 17:28:27 2006 +++ llvm/utils/TableGen/DAGISelEmitter.cpp Mon Sep 18 17:41:07 2006 @@ -2373,8 +2373,6 @@ } } else if (IntInit *II = dynamic_cast(Child->getLeafValue())) { - if (II->getValue() == 2147483647) - std::cerr << "HERE!\n"; emitCheck("isa(" + RootName + utostr(OpNo) + ")"); unsigned CTmp = TmpNo++; emitCode("int64_t CN"+utostr(CTmp)+" = cast("+ From evan.cheng at apple.com Mon Sep 18 18:28:47 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 18 Sep 2006 18:28:47 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200609182328.k8INSlaF021327@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.397 -> 1.398 --- Log message: Fix a typo. --- Diffs of the changes: (+2 -3) LegalizeDAG.cpp | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.397 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.398 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.397 Mon Sep 18 16:49:04 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Sep 18 18:28:33 2006 @@ -2331,14 +2331,13 @@ } break; case TargetLowering::Expand: - unsigned DivOpc= (Node->getOpcode() == ISD::UREM) ? ISD::UDIV : ISD::SREM; + unsigned DivOpc= (Node->getOpcode() == ISD::UREM) ? ISD::UDIV : ISD::SDIV; if (MVT::isInteger(Node->getValueType(0))) { if (TLI.getOperationAction(DivOpc, Node->getValueType(0)) == TargetLowering::Legal) { // X % Y -> X-X/Y*Y MVT::ValueType VT = Node->getValueType(0); - unsigned Opc = Node->getOpcode() == ISD::UREM ? ISD::UDIV : ISD::SDIV; - Result = DAG.getNode(Opc, VT, Tmp1, Tmp2); + Result = DAG.getNode(DivOpc, VT, Tmp1, Tmp2); Result = DAG.getNode(ISD::MUL, VT, Result, Tmp2); Result = DAG.getNode(ISD::SUB, VT, Tmp1, Result); } else { From nicholas at mxc.ca Mon Sep 18 19:32:08 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 18 Sep 2006 19:32:08 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/PredicateSimplifier/dg.exp Message-ID: <200609190032.k8J0W82L022300@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/PredicateSimplifier: dg.exp added (r1.1) --- Log message: Enable dejagnu tests for predicate simplifier. --- Diffs of the changes: (+3 -0) dg.exp | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/test/Regression/Transforms/PredicateSimplifier/dg.exp diff -c /dev/null llvm/test/Regression/Transforms/PredicateSimplifier/dg.exp:1.1 *** /dev/null Mon Sep 18 19:32:04 2006 --- llvm/test/Regression/Transforms/PredicateSimplifier/dg.exp Mon Sep 18 19:31:54 2006 *************** *** 0 **** --- 1,3 ---- + load_lib llvm-dg.exp + + llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext $llvmgcc_version From sabre at nondot.org Mon Sep 18 19:41:50 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 18 Sep 2006 19:41:50 -0500 Subject: [llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp Message-ID: <200609190041.k8J0foRC022480@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: DAGISelEmitter.cpp updated: 1.258 -> 1.259 --- Log message: If multiple predicates are listed, they must all pass --- Diffs of the changes: (+1 -1) DAGISelEmitter.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/utils/TableGen/DAGISelEmitter.cpp diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.258 llvm/utils/TableGen/DAGISelEmitter.cpp:1.259 --- llvm/utils/TableGen/DAGISelEmitter.cpp:1.258 Mon Sep 18 17:41:07 2006 +++ llvm/utils/TableGen/DAGISelEmitter.cpp Mon Sep 18 19:41:36 2006 @@ -2195,7 +2195,7 @@ assert(0 && "Unknown predicate type!"); } if (!PredicateCheck.empty()) - PredicateCheck += " || "; + PredicateCheck += " && "; PredicateCheck += "(" + Def->getValueAsString("CondString") + ")"; } } From sabre at nondot.org Mon Sep 18 23:51:38 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 18 Sep 2006 23:51:38 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200609190451.k8J4pcE2026580@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.338 -> 1.339 --- Log message: Minor speedup for legalize by avoiding some malloc traffic --- Diffs of the changes: (+9 -0) SelectionDAG.cpp | 9 +++++++++ 1 files changed, 9 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.338 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.339 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.338 Tue Sep 12 16:00:35 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Sep 18 23:51:23 2006 @@ -1329,6 +1329,15 @@ if (EVT == VT) return N1; // Not actually extending break; } + case ISD::EXTRACT_ELEMENT: + // EXTRACT_ELEMENT of BUILD_PAIR is often formed while legalize is expanding + // 64-bit integers into 32-bit parts. Instead of building the extract of + // the BUILD_PAIR, only to have legalize rip it apart, just do it now. + if (N2C && N1.getOpcode() == ISD::BUILD_PAIR) { + assert((unsigned)N2C->getValue() < 2 && "Bad EXTRACT_ELEMENT!"); + return N1.getOperand(N2C->getValue()); + } + break; // FIXME: figure out how to safely handle things like // int foo(int x) { return 1 << (x & 255); } From sabre at nondot.org Tue Sep 19 00:02:53 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Sep 2006 00:02:53 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200609190502.k8J52rJH026799@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.339 -> 1.340 --- Log message: Fold extract_element(cst) to cst --- Diffs of the changes: (+8 -2) SelectionDAG.cpp | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.339 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.340 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.339 Mon Sep 18 23:51:23 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Sep 19 00:02:39 2006 @@ -1330,12 +1330,18 @@ break; } case ISD::EXTRACT_ELEMENT: + assert(N2C && (unsigned)N2C->getValue() < 2 && "Bad EXTRACT_ELEMENT!"); + // EXTRACT_ELEMENT of BUILD_PAIR is often formed while legalize is expanding // 64-bit integers into 32-bit parts. Instead of building the extract of // the BUILD_PAIR, only to have legalize rip it apart, just do it now. - if (N2C && N1.getOpcode() == ISD::BUILD_PAIR) { - assert((unsigned)N2C->getValue() < 2 && "Bad EXTRACT_ELEMENT!"); + if (N1.getOpcode() == ISD::BUILD_PAIR) return N1.getOperand(N2C->getValue()); + + // EXTRACT_ELEMENT of a constant int is also very common. + if (ConstantSDNode *C = dyn_cast(N1)) { + unsigned Shift = MVT::getSizeInBits(VT) * N2C->getValue(); + return getConstant(C->getValue() >> Shift, VT); } break; From sabre at nondot.org Tue Sep 19 00:23:13 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Sep 2006 00:23:13 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelLowering.cpp Message-ID: <200609190523.k8J5NDpf027142@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCISelLowering.cpp updated: 1.206 -> 1.207 --- Log message: Fold the PPCISD shifts when presented with 0 inputs. This occurs for code like: long long test(long long X, int Y) { return 1ULL << Y; } long long test2(long long X, int Y) { return -1LL << Y; } which we used to compile to: _test: li r2, 1 subfic r3, r5, 32 li r4, 0 addi r6, r5, -32 srw r3, r2, r3 slw r4, r4, r5 slw r6, r2, r6 or r3, r4, r3 slw r4, r2, r5 or r3, r3, r6 blr _test2: li r2, -1 subfic r3, r5, 32 addi r6, r5, -32 srw r3, r2, r3 slw r4, r2, r5 slw r2, r2, r6 or r3, r4, r3 or r3, r3, r2 blr Now we produce: _test: li r2, 1 addi r3, r5, -32 subfic r4, r5, 32 slw r3, r2, r3 srw r4, r2, r4 or r3, r4, r3 slw r4, r2, r5 blr _test2: li r2, -1 subfic r3, r5, 32 addi r6, r5, -32 srw r3, r2, r3 slw r4, r2, r5 slw r2, r2, r6 or r3, r4, r3 or r3, r3, r2 blr --- Diffs of the changes: (+20 -0) PPCISelLowering.cpp | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+) Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.206 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.207 --- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.206 Tue Sep 12 16:02:35 2006 +++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Tue Sep 19 00:22:59 2006 @@ -2309,6 +2309,26 @@ SelectionDAG &DAG = DCI.DAG; switch (N->getOpcode()) { default: break; + case PPCISD::SHL: + if (ConstantSDNode *C = dyn_cast(N->getOperand(0))) { + if (C->getValue() == 0) // 0 << V -> 0. + return N->getOperand(0); + } + break; + case PPCISD::SRL: + if (ConstantSDNode *C = dyn_cast(N->getOperand(0))) { + if (C->getValue() == 0) // 0 >>u V -> 0. + return N->getOperand(0); + } + break; + case PPCISD::SRA: + if (ConstantSDNode *C = dyn_cast(N->getOperand(0))) { + if (C->getValue() == 0 || // 0 >>s V -> 0. + C->isAllOnesValue()) // -1 >>s V -> -1. + return N->getOperand(0); + } + break; + case ISD::SINT_TO_FP: if (TM.getSubtarget().has64BitSupport()) { if (N->getOperand(0).getOpcode() == ISD::FP_TO_SINT) { From sabre at nondot.org Tue Sep 19 01:17:01 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Sep 2006 01:17:01 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/select.ll Message-ID: <200609190617.k8J6H1NA027978@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: select.ll updated: 1.11 -> 1.12 --- Log message: new testcases --- Diffs of the changes: (+14 -1) select.ll | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletion(-) Index: llvm/test/Regression/Transforms/InstCombine/select.ll diff -u llvm/test/Regression/Transforms/InstCombine/select.ll:1.11 llvm/test/Regression/Transforms/InstCombine/select.ll:1.12 --- llvm/test/Regression/Transforms/InstCombine/select.ll:1.11 Sat Sep 9 15:26:04 2006 +++ llvm/test/Regression/Transforms/InstCombine/select.ll Tue Sep 19 01:16:46 2006 @@ -1,5 +1,4 @@ ; This test makes sure that these instructions are properly eliminated. -; ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep select @@ -154,3 +153,17 @@ %V = div int %Y, %R ; div Y,X ret int %V } + +int %test19(uint %x) { +entry: + %tmp = setgt uint %x, 2147483647 + %retval = select bool %tmp, int -1, int 0 + ret int %retval +} + +int %test20(int %x) { + %tmp = setlt int %x, 0 + %retval = select bool %tmp, int -1, int 0 + ret int %retval +} + From sabre at nondot.org Tue Sep 19 01:18:09 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Sep 2006 01:18:09 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/select.ll Message-ID: <200609190618.k8J6I94s028058@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: select.ll updated: 1.12 -> 1.13 --- Log message: make this harder --- Diffs of the changes: (+14 -2) select.ll | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-) Index: llvm/test/Regression/Transforms/InstCombine/select.ll diff -u llvm/test/Regression/Transforms/InstCombine/select.ll:1.12 llvm/test/Regression/Transforms/InstCombine/select.ll:1.13 --- llvm/test/Regression/Transforms/InstCombine/select.ll:1.12 Tue Sep 19 01:16:46 2006 +++ llvm/test/Regression/Transforms/InstCombine/select.ll Tue Sep 19 01:17:55 2006 @@ -1,6 +1,7 @@ ; This test makes sure that these instructions are properly eliminated. -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep select +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep select && +; RUN: llvm-as < %s | opt -instcombine -disable-output implementation @@ -155,7 +156,6 @@ } int %test19(uint %x) { -entry: %tmp = setgt uint %x, 2147483647 %retval = select bool %tmp, int -1, int 0 ret int %retval @@ -167,3 +167,15 @@ ret int %retval } +long %test21(int %x) { + %tmp = setlt int %x, 0 + %retval = select bool %tmp, long -1, long 0 + ret long %retval +} + +short %test20(int %x) { + %tmp = setlt int %x, 0 + %retval = select bool %tmp, short -1, short 0 + ret short %retval +} + From sabre at nondot.org Tue Sep 19 01:18:36 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Sep 2006 01:18:36 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200609190618.k8J6Ian5028087@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.509 -> 1.510 --- Log message: implement select.ll:test19-22 --- Diffs of the changes: (+43 -6) InstructionCombining.cpp | 49 +++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 43 insertions(+), 6 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.509 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.510 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.509 Mon Sep 18 13:27:05 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Sep 19 01:18:21 2006 @@ -5690,12 +5690,48 @@ return new CastInst(NotCond, SI.getType()); } - // If one of the constants is zero (we know they can't both be) and we - // have a setcc instruction with zero, and we have an 'and' with the - // non-constant value, eliminate this whole mess. This corresponds to - // cases like this: ((X & 27) ? 27 : 0) - if (TrueValC->isNullValue() || FalseValC->isNullValue()) - if (SetCondInst *IC = dyn_cast(SI.getCondition())) + if (SetCondInst *IC = dyn_cast(SI.getCondition())) { + + // (x sra x, 31 + // (x >u 2147483647) ? -1 : 0 -> sra x, 31 + if (TrueValC->isAllOnesValue() && FalseValC->isNullValue()) + if (ConstantInt *CmpCst = dyn_cast(IC->getOperand(1))) { + bool CanXForm = false; + if (CmpCst->getType()->isSigned()) + CanXForm = CmpCst->isNullValue() && + IC->getOpcode() == Instruction::SetLT; + else { + unsigned Bits = CmpCst->getType()->getPrimitiveSizeInBits(); + CanXForm = (CmpCst->getRawValue() == ~0ULL >> (64-Bits+1)) && + IC->getOpcode() == Instruction::SetGT; + } + + // The comparison constant and the result are not neccessarily the + // same width. In any case, the first step to do is make sure that + // X is signed. + Value *X = IC->getOperand(0); + if (!X->getType()->isSigned()) + X = InsertCastBefore(X, X->getType()->getSignedVersion(), SI); + + // Now that X is signed, we have to make the all ones value. Do + // this by inserting a new SRA. + unsigned Bits = X->getType()->getPrimitiveSizeInBits(); + Constant *ShAmt = ConstantUInt::get(Type::UByteTy, Bits-1); + Instruction *SRA = new ShiftInst(Instruction::Shr, X, ShAmt,"ones"); + InsertNewInstBefore(SRA, SI); + + // Finally, convert to the type of the select RHS. If this is + // smaller than the compare value, it will truncate the ones to fit. + // If it is larger, it will sext the ones to fit. + return new CastInst(SRA, SI.getType()); + } + + + // If one of the constants is zero (we know they can't both be) and we + // have a setcc instruction with zero, and we have an 'and' with the + // non-constant value, eliminate this whole mess. This corresponds to + // cases like this: ((X & 27) ? 27 : 0) + if (TrueValC->isNullValue() || FalseValC->isNullValue()) if (IC->isEquality() && isa(IC->getOperand(1)) && cast(IC->getOperand(1))->isNullValue()) if (Instruction *ICA = dyn_cast(IC->getOperand(0))) @@ -5715,6 +5751,7 @@ Instruction::Xor, V, ICA->getOperand(1)), SI); return ReplaceInstUsesWith(SI, V); } + } } // See if we are selecting two values based on a comparison of the two values. From sabre at nondot.org Tue Sep 19 01:19:17 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Sep 2006 01:19:17 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/README.txt Message-ID: <200609190619.k8J6JHXm028160@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: README.txt updated: 1.39 -> 1.40 --- Log message: item done --- Diffs of the changes: (+0 -11) README.txt | 11 ----------- 1 files changed, 11 deletions(-) Index: llvm/lib/Target/README.txt diff -u llvm/lib/Target/README.txt:1.39 llvm/lib/Target/README.txt:1.40 --- llvm/lib/Target/README.txt:1.39 Sun Sep 17 23:54:35 2006 +++ llvm/lib/Target/README.txt Tue Sep 19 01:19:03 2006 @@ -63,17 +63,6 @@ //===---------------------------------------------------------------------===// -Turn this into a signed shift right in instcombine: - -int f(unsigned x) { - return x >> 31 ? -1 : 0; -} - -http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25600 -http://gcc.gnu.org/ml/gcc-patches/2006-02/msg01492.html - -//===---------------------------------------------------------------------===// - On targets with expensive 64-bit multiply, we could LSR this: for (i = ...; ++i) { From sabre at nondot.org Tue Sep 19 01:19:33 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Sep 2006 01:19:33 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/select.ll Message-ID: <200609190619.k8J6JXLA028180@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: select.ll updated: 1.13 -> 1.14 --- Log message: number test right --- Diffs of the changes: (+1 -1) select.ll | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/Transforms/InstCombine/select.ll diff -u llvm/test/Regression/Transforms/InstCombine/select.ll:1.13 llvm/test/Regression/Transforms/InstCombine/select.ll:1.14 --- llvm/test/Regression/Transforms/InstCombine/select.ll:1.13 Tue Sep 19 01:17:55 2006 +++ llvm/test/Regression/Transforms/InstCombine/select.ll Tue Sep 19 01:19:19 2006 @@ -173,7 +173,7 @@ ret long %retval } -short %test20(int %x) { +short %test22(int %x) { %tmp = setlt int %x, 0 %retval = select bool %tmp, short -1, short 0 ret short %retval From rafael.espindola at gmail.com Tue Sep 19 10:49:43 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Tue, 19 Sep 2006 10:49:43 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMMul.cpp ARM.h ARMTargetMachine.cpp ARMTargetMachine.h Message-ID: <200609191549.k8JFnhTb016575@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMMul.cpp added (r1.1) ARM.h updated: 1.5 -> 1.6 ARMTargetMachine.cpp updated: 1.9 -> 1.10 ARMTargetMachine.h updated: 1.5 -> 1.6 --- Log message: Implement a MachineFunctionPass to fix the mul instruction --- Diffs of the changes: (+74 -1) ARM.h | 1 ARMMul.cpp | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++ ARMTargetMachine.cpp | 7 ++++- ARMTargetMachine.h | 1 4 files changed, 74 insertions(+), 1 deletion(-) Index: llvm/lib/Target/ARM/ARMMul.cpp diff -c /dev/null llvm/lib/Target/ARM/ARMMul.cpp:1.1 *** /dev/null Tue Sep 19 10:49:35 2006 --- llvm/lib/Target/ARM/ARMMul.cpp Tue Sep 19 10:49:24 2006 *************** *** 0 **** --- 1,66 ---- + //===-- ARMTargetMachine.cpp - Define TargetMachine for ARM ---------------===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the "Instituto Nokia de Tecnologia" and + // is distributed under the University of Illinois Open Source + // License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // + //===----------------------------------------------------------------------===// + + + #include "ARM.h" + #include "llvm/CodeGen/MachineInstrBuilder.h" + #include "llvm/CodeGen/MachineFunctionPass.h" + #include "llvm/Support/Compiler.h" + + using namespace llvm; + + namespace { + class VISIBILITY_HIDDEN FixMul : public MachineFunctionPass { + virtual bool runOnMachineFunction(MachineFunction &MF); + }; + } + + FunctionPass *llvm::createARMFixMulPass() { return new FixMul(); } + + bool FixMul::runOnMachineFunction(MachineFunction &MF) { + bool Changed = false; + + for (MachineFunction::iterator BB = MF.begin(), E = MF.end(); + BB != E; ++BB) { + MachineBasicBlock &MBB = *BB; + + for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end(); + I != E; ++I) { + MachineInstr *MI = I; + + if (MI->getOpcode() == ARM::MUL) { + MachineOperand &RdOp = MI->getOperand(0); + MachineOperand &RmOp = MI->getOperand(1); + MachineOperand &RsOp = MI->getOperand(2); + + unsigned Rd = RdOp.getReg(); + unsigned Rm = RmOp.getReg(); + unsigned Rs = RsOp.getReg(); + + if(Rd == Rm) { + Changed = true; + if (Rd != Rs) { + RmOp.setReg(Rs); + RsOp.setReg(Rm); + } else { + BuildMI(MBB, I, ARM::MOV, 3, ARM::R12).addReg(Rm).addImm(0) + .addImm(ARMShift::LSL); + RmOp.setReg(ARM::R12); + } + } + } + } + } + + return Changed; + } Index: llvm/lib/Target/ARM/ARM.h diff -u llvm/lib/Target/ARM/ARM.h:1.5 llvm/lib/Target/ARM/ARM.h:1.6 --- llvm/lib/Target/ARM/ARM.h:1.5 Wed Sep 13 07:09:43 2006 +++ llvm/lib/Target/ARM/ARM.h Tue Sep 19 10:49:24 2006 @@ -77,6 +77,7 @@ FunctionPass *createARMISelDag(TargetMachine &TM); FunctionPass *createARMCodePrinterPass(std::ostream &OS, TargetMachine &TM); + FunctionPass *createARMFixMulPass(); } // end namespace llvm; // Defines symbolic names for ARM registers. This defines a mapping from Index: llvm/lib/Target/ARM/ARMTargetMachine.cpp diff -u llvm/lib/Target/ARM/ARMTargetMachine.cpp:1.9 llvm/lib/Target/ARM/ARMTargetMachine.cpp:1.10 --- llvm/lib/Target/ARM/ARMTargetMachine.cpp:1.9 Thu Sep 7 18:39:26 2006 +++ llvm/lib/Target/ARM/ARMTargetMachine.cpp Tue Sep 19 10:49:24 2006 @@ -54,10 +54,15 @@ PM.add(createARMISelDag(*this)); return false; } + +bool ARMTargetMachine::addPostRegAlloc(FunctionPassManager &PM, bool Fast) { + PM.add(createARMFixMulPass()); + return true; +} + bool ARMTargetMachine::addAssemblyEmitter(FunctionPassManager &PM, bool Fast, std::ostream &Out) { // Output assembly language. PM.add(createARMCodePrinterPass(Out, *this)); return false; } - Index: llvm/lib/Target/ARM/ARMTargetMachine.h diff -u llvm/lib/Target/ARM/ARMTargetMachine.h:1.5 llvm/lib/Target/ARM/ARMTargetMachine.h:1.6 --- llvm/lib/Target/ARM/ARMTargetMachine.h:1.5 Thu Sep 7 18:39:26 2006 +++ llvm/lib/Target/ARM/ARMTargetMachine.h Tue Sep 19 10:49:24 2006 @@ -46,6 +46,7 @@ // Pass Pipeline Configuration virtual bool addInstSelector(FunctionPassManager &PM, bool Fast); + virtual bool addPostRegAlloc(FunctionPassManager &PM, bool Fast); virtual bool addAssemblyEmitter(FunctionPassManager &PM, bool Fast, std::ostream &Out); }; From rafael.espindola at gmail.com Tue Sep 19 10:49:43 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Tue, 19 Sep 2006 10:49:43 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/ARM/mul.ll Message-ID: <200609191549.k8JFnhuA016574@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/ARM: mul.ll added (r1.1) --- Log message: Implement a MachineFunctionPass to fix the mul instruction --- Diffs of the changes: (+15 -0) mul.ll | 15 +++++++++++++++ 1 files changed, 15 insertions(+) Index: llvm/test/Regression/CodeGen/ARM/mul.ll diff -c /dev/null llvm/test/Regression/CodeGen/ARM/mul.ll:1.1 *** /dev/null Tue Sep 19 10:49:35 2006 --- llvm/test/Regression/CodeGen/ARM/mul.ll Tue Sep 19 10:49:25 2006 *************** *** 0 **** --- 1,15 ---- + ; RUN: llvm-as < %s | llc -march=arm && + ; RUN: llvm-as < %s | llc -march=arm | grep "mul r0, r12, r0" | wc -l | grep 1 && + ; RUN: llvm-as < %s | llc -march=arm | grep "mul r0, r1, r0" | wc -l | grep 1 + + int %mul1(int %u) { + entry: + %tmp = mul int %u, %u; + ret int %tmp + } + + int %mul2(int %u, int %v) { + entry: + %tmp = mul int %u, %v; + ret int %tmp + } From rafael.espindola at gmail.com Tue Sep 19 11:41:54 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Tue, 19 Sep 2006 11:41:54 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMMul.cpp Message-ID: <200609191641.k8JGfser017575@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMMul.cpp updated: 1.1 -> 1.2 --- Log message: fix header add comments untabify --- Diffs of the changes: (+23 -20) ARMMul.cpp | 43 +++++++++++++++++++++++-------------------- 1 files changed, 23 insertions(+), 20 deletions(-) Index: llvm/lib/Target/ARM/ARMMul.cpp diff -u llvm/lib/Target/ARM/ARMMul.cpp:1.1 llvm/lib/Target/ARM/ARMMul.cpp:1.2 --- llvm/lib/Target/ARM/ARMMul.cpp:1.1 Tue Sep 19 10:49:24 2006 +++ llvm/lib/Target/ARM/ARMMul.cpp Tue Sep 19 11:41:40 2006 @@ -1,4 +1,4 @@ -//===-- ARMTargetMachine.cpp - Define TargetMachine for ARM ---------------===// +//===-- ARMMul.cpp - Define TargetMachine for A5CRM -----------------------===// // // The LLVM Compiler Infrastructure // @@ -8,6 +8,7 @@ // //===----------------------------------------------------------------------===// // +// Modify the ARM multiplication instructions so that Rd and Rm are distinct // //===----------------------------------------------------------------------===// @@ -39,25 +40,27 @@ MachineInstr *MI = I; if (MI->getOpcode() == ARM::MUL) { - MachineOperand &RdOp = MI->getOperand(0); - MachineOperand &RmOp = MI->getOperand(1); - MachineOperand &RsOp = MI->getOperand(2); - - unsigned Rd = RdOp.getReg(); - unsigned Rm = RmOp.getReg(); - unsigned Rs = RsOp.getReg(); - - if(Rd == Rm) { - Changed = true; - if (Rd != Rs) { - RmOp.setReg(Rs); - RsOp.setReg(Rm); - } else { - BuildMI(MBB, I, ARM::MOV, 3, ARM::R12).addReg(Rm).addImm(0) - .addImm(ARMShift::LSL); - RmOp.setReg(ARM::R12); - } - } + MachineOperand &RdOp = MI->getOperand(0); + MachineOperand &RmOp = MI->getOperand(1); + MachineOperand &RsOp = MI->getOperand(2); + + unsigned Rd = RdOp.getReg(); + unsigned Rm = RmOp.getReg(); + unsigned Rs = RsOp.getReg(); + + if(Rd == Rm) { + Changed = true; + if (Rd != Rs) { + //Rd and Rm must be distinct, but Rd can be equal to Rs. + //Swap Rs and Rm + RmOp.setReg(Rs); + RsOp.setReg(Rm); + } else { + BuildMI(MBB, I, ARM::MOV, 3, ARM::R12).addReg(Rm).addImm(0) + .addImm(ARMShift::LSL); + RmOp.setReg(ARM::R12); + } + } } } } From jlaskey at apple.com Tue Sep 19 11:51:26 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 19 Sep 2006 11:51:26 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/NightlyTestAccept.php Message-ID: <200609191651.k8JGpQ1N017801@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: NightlyTestAccept.php updated: 1.50 -> 1.51 --- Log message: Tidy up output. --- Diffs of the changes: (+5 -5) NightlyTestAccept.php | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) Index: nightlytest-serverside/NightlyTestAccept.php diff -u nightlytest-serverside/NightlyTestAccept.php:1.50 nightlytest-serverside/NightlyTestAccept.php:1.51 --- nightlytest-serverside/NightlyTestAccept.php:1.50 Sun Sep 17 05:02:47 2006 +++ nightlytest-serverside/NightlyTestAccept.php Tue Sep 19 11:51:12 2006 @@ -859,7 +859,7 @@ } $rounded_perc = sprintf("%1.2f", $perc); - array_push($changes, "$prog: $rounded_perc\% ($value_old => $value_new)\n"); + array_push($changes, "$prog: $rounded_perc% ($value_old => $value_new)\n"); $output_big_changes[$measure] = $changes; } } @@ -908,19 +908,19 @@ if (StringIsNull($passing)) { $passing = "None"; } - $email .= "\nNew Test Passes: $passing\n"; + $email .= "\nNew Test Passes:\n$passing\n"; if (StringIsNull($failing)) { $failing = "None"; } - $email .= "\nNew Test Failures: $failing\n"; + $email .= "\nNew Test Failures:\n$failing\n"; if (StringIsNull($added)) { $added = "None"; } - $email .= "\nAdded Tests: $added\n"; + $email .= "\nAdded Tests:\n$added\n"; if (StringIsNull($removed)) { $removed= "None"; } - $email .= "\nRemoved Tests: $removed\n"; + $email .= "\nRemoved Tests:\n$removed\n"; $email .= "\nSignificant changes in test results:\n"; foreach ($output_big_changes as $measure => $values) { From alenhar2 at cs.uiuc.edu Tue Sep 19 12:00:06 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 19 Sep 2006 12:00:06 -0500 Subject: [llvm-commits] CVS: llvm-test/Makefile.rules Message-ID: <200609191700.k8JH06BO018032@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.rules updated: 1.16 -> 1.17 --- Log message: Alpha needs to use ieee mode --- Diffs of the changes: (+5 -0) Makefile.rules | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm-test/Makefile.rules diff -u llvm-test/Makefile.rules:1.16 llvm-test/Makefile.rules:1.17 --- llvm-test/Makefile.rules:1.16 Fri Aug 25 13:18:38 2006 +++ llvm-test/Makefile.rules Tue Sep 19 11:59:51 2006 @@ -327,6 +327,11 @@ endif endif +ifeq ($(ARCH),Alpha) +CPPFLAGS += -mieee +CFLAGS += -mieee +endif + ifdef EXTRA_OPTIONS TARGET_FLAGS += $(EXTRA_OPTIONS) endif From jlaskey at apple.com Tue Sep 19 12:46:24 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 19 Sep 2006 12:46:24 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/SQLQuery.php Message-ID: <200609191746.k8JHkONp020062@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: SQLQuery.php updated: 1.3 -> 1.4 --- Log message: make multiple queries easier --- Diffs of the changes: (+36 -27) SQLQuery.php | 63 +++++++++++++++++++++++++++++++++-------------------------- 1 files changed, 36 insertions(+), 27 deletions(-) Index: nightlytest-serverside/SQLQuery.php diff -u nightlytest-serverside/SQLQuery.php:1.3 nightlytest-serverside/SQLQuery.php:1.4 --- nightlytest-serverside/SQLQuery.php:1.3 Fri Sep 15 07:16:26 2006 +++ nightlytest-serverside/SQLQuery.php Tue Sep 19 12:46:04 2006 @@ -1,11 +1,11 @@ @@ -31,7 +31,7 @@ Password:
- Query:
+ Query:

@@ -39,36 +39,45 @@ EOD; if ($was_query) { + $queries = split("\n", $queries); + $mysql_link = mysql_connect("127.0.0.1", $user, $password) or die("Error: could not connect to database!\n"); mysql_select_db("nightlytestresults"); - $query = $_POST["Query"]; - $my_query = mysql_query($query) or die (mysql_error()); - - print "\n"; - $heading = false; - - while ($row = mysql_fetch_assoc($my_query)) { - if (!$heading) { - print " \n"; - foreach ($row as $key => $value) { - print " \n"; - } - print " \n"; - $heading = true; - } + foreach ($queries as $query) { + $query = rtrim($query); + if (strlen($query) == 0) continue; - print " \n"; - foreach ($row as $key => $value) { - print " \n"; + if ($my_query = mysql_query($query)) { + print "
$key
$value
\n"; + $heading = false; + + while ($row = mysql_fetch_assoc($my_query)) { + if (!$heading) { + print " "; + foreach ($row as $key => $value) { + print " "; + } + print " \n"; + $heading = true; + } + + print " "; + foreach ($row as $key => $value) { + print " "; + } + print " \n"; + } + + print "
$key
$value



\n"; + + mysql_free_result($my_query); + } else { + $error = mysql_error(); + print "$error
\n"; } - print " \n"; } - print "\n"; - - mysql_free_result($my_query); - mysql_close($mysql_link); } From jlaskey at apple.com Tue Sep 19 12:48:13 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 19 Sep 2006 12:48:13 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/SQLQuery.php Message-ID: <200609191748.k8JHmDGc020192@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: SQLQuery.php updated: 1.4 -> 1.5 --- Log message: leave query in form --- Diffs of the changes: (+1 -1) SQLQuery.php | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: nightlytest-serverside/SQLQuery.php diff -u nightlytest-serverside/SQLQuery.php:1.4 nightlytest-serverside/SQLQuery.php:1.5 --- nightlytest-serverside/SQLQuery.php:1.4 Tue Sep 19 12:46:04 2006 +++ nightlytest-serverside/SQLQuery.php Tue Sep 19 12:47:59 2006 @@ -31,7 +31,7 @@ Password:
- Query:
+ Query:

From jlaskey at apple.com Tue Sep 19 12:49:48 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 19 Sep 2006 12:49:48 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/SQLQuery.php Message-ID: <200609191749.k8JHnm3e020316@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: SQLQuery.php updated: 1.5 -> 1.6 --- Log message: more space --- Diffs of the changes: (+1 -1) SQLQuery.php | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: nightlytest-serverside/SQLQuery.php diff -u nightlytest-serverside/SQLQuery.php:1.5 nightlytest-serverside/SQLQuery.php:1.6 --- nightlytest-serverside/SQLQuery.php:1.5 Tue Sep 19 12:47:59 2006 +++ nightlytest-serverside/SQLQuery.php Tue Sep 19 12:49:34 2006 @@ -74,7 +74,7 @@ mysql_free_result($my_query); } else { $error = mysql_error(); - print "$error
\n"; + print "$error


\n"; } } From jlaskey at apple.com Tue Sep 19 12:50:58 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 19 Sep 2006 12:50:58 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/SQLQuery.php Message-ID: <200609191750.k8JHowgm020425@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: SQLQuery.php updated: 1.6 -> 1.7 --- Log message: Make errors stand out better --- Diffs of the changes: (+1 -1) SQLQuery.php | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: nightlytest-serverside/SQLQuery.php diff -u nightlytest-serverside/SQLQuery.php:1.6 nightlytest-serverside/SQLQuery.php:1.7 --- nightlytest-serverside/SQLQuery.php:1.6 Tue Sep 19 12:49:34 2006 +++ nightlytest-serverside/SQLQuery.php Tue Sep 19 12:50:44 2006 @@ -74,7 +74,7 @@ mysql_free_result($my_query); } else { $error = mysql_error(); - print "$error


\n"; + print "$error<\B>


\n"; } } From jlaskey at apple.com Tue Sep 19 12:52:27 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 19 Sep 2006 12:52:27 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/SQLQuery.php Message-ID: <200609191752.k8JHqRET020543@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: SQLQuery.php updated: 1.7 -> 1.8 --- Log message: typo --- Diffs of the changes: (+1 -1) SQLQuery.php | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: nightlytest-serverside/SQLQuery.php diff -u nightlytest-serverside/SQLQuery.php:1.7 nightlytest-serverside/SQLQuery.php:1.8 --- nightlytest-serverside/SQLQuery.php:1.7 Tue Sep 19 12:50:44 2006 +++ nightlytest-serverside/SQLQuery.php Tue Sep 19 12:52:13 2006 @@ -74,7 +74,7 @@ mysql_free_result($my_query); } else { $error = mysql_error(); - print "$error<\B>


\n"; + print "$error


\n"; } } From sabre at nondot.org Tue Sep 19 13:02:15 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Sep 2006 13:02:15 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAllocLocal.cpp Message-ID: <200609191802.k8JI2FPF020886@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: RegAllocLocal.cpp updated: 1.92 -> 1.93 --- Log message: Fix UnitTests/2005-05-12-Int64ToFP.c with llc-beta. In particular, do not allow it to go into an infinite loop, filling up the disk! --- Diffs of the changes: (+10 -7) RegAllocLocal.cpp | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-) Index: llvm/lib/CodeGen/RegAllocLocal.cpp diff -u llvm/lib/CodeGen/RegAllocLocal.cpp:1.92 llvm/lib/CodeGen/RegAllocLocal.cpp:1.93 --- llvm/lib/CodeGen/RegAllocLocal.cpp:1.92 Fri Sep 8 15:21:31 2006 +++ llvm/lib/CodeGen/RegAllocLocal.cpp Tue Sep 19 13:02:01 2006 @@ -621,18 +621,21 @@ for (const unsigned *ImplicitDefs = TID.ImplicitDefs; *ImplicitDefs; ++ImplicitDefs) { unsigned Reg = *ImplicitDefs; - if (PhysRegsUsed[Reg] == -2) continue; - - spillPhysReg(MBB, MI, Reg, true); - PhysRegsUseOrder.push_back(Reg); - PhysRegsUsed[Reg] = 0; // It is free and reserved now + bool IsNonAllocatable = PhysRegsUsed[Reg] == -2; + if (!IsNonAllocatable) { + spillPhysReg(MBB, MI, Reg, true); + PhysRegsUseOrder.push_back(Reg); + PhysRegsUsed[Reg] = 0; // It is free and reserved now + } PhysRegsEverUsed[Reg] = true; for (const unsigned *AliasSet = RegInfo->getAliasSet(Reg); *AliasSet; ++AliasSet) { if (PhysRegsUsed[*AliasSet] != -2) { - PhysRegsUseOrder.push_back(*AliasSet); - PhysRegsUsed[*AliasSet] = 0; // It is free and reserved now + if (!IsNonAllocatable) { + PhysRegsUseOrder.push_back(*AliasSet); + PhysRegsUsed[*AliasSet] = 0; // It is free and reserved now + } PhysRegsEverUsed[*AliasSet] = true; } } From alenhar2 at cs.uiuc.edu Tue Sep 19 13:24:05 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 19 Sep 2006 13:24:05 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/cast_ptr.ll Message-ID: <200609191824.k8JIO5Zh020109@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: cast_ptr.ll added (r1.1) --- Log message: Inspired by the linux kernel, the more we keep adds in the pointer realm, the better pointer analysis works. --- Diffs of the changes: (+15 -0) cast_ptr.ll | 15 +++++++++++++++ 1 files changed, 15 insertions(+) Index: llvm/test/Regression/Transforms/InstCombine/cast_ptr.ll diff -c /dev/null llvm/test/Regression/Transforms/InstCombine/cast_ptr.ll:1.1 *** /dev/null Tue Sep 19 13:23:49 2006 --- llvm/test/Regression/Transforms/InstCombine/cast_ptr.ll Tue Sep 19 13:23:39 2006 *************** *** 0 **** --- 1,15 ---- + ; Tests to make sure elimination of casts is working correctly + ; RUN: llvm-as < %s | opt -instcombine -disable-output && + ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep cast + + target pointersize = 32 + + implementation + + sbyte* %test1(sbyte* %t) { + %tmpc = cast sbyte* %t to uint + %tmpa = add uint %tmpc, 32 + %tv = cast uint %tmpa to sbyte* + ret sbyte* %tv + } + From alenhar2 at cs.uiuc.edu Tue Sep 19 13:25:09 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 19 Sep 2006 13:25:09 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200609191825.k8JIP902020133@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.510 -> 1.511 --- Log message: If we have an add, do it in the pointer realm, not the int realm. This is critical in the linux kernel for pointer analysis correctness --- Diffs of the changes: (+22 -0) InstructionCombining.cpp | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.510 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.511 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.510 Tue Sep 19 01:18:21 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Sep 19 13:24:51 2006 @@ -1595,6 +1595,28 @@ return R; } + // add (cast *A to intptrtype) B -> cast (GEP (cast *A to sbyte*) B) -> intptrtype + { + CastInst* CI = dyn_cast(LHS); + Value* Other = RHS; + if (!CI) { + CI = dyn_cast(RHS); + Other = LHS; + } + if (CI) { + const Type *UIntPtrTy = TD->getIntPtrType(); + const Type *SIntPtrTy = UIntPtrTy->getSignedVersion(); + if((CI->getType() == UIntPtrTy || CI->getType() == SIntPtrTy) + && isa(CI->getOperand(0)->getType())) { + Instruction* I2 = new CastInst(CI->getOperand(0), PointerType::get(Type::SByteTy), "ctg", &I); + WorkList.push_back(I2); + I2 = new GetElementPtrInst(I2, Other, "ctg", &I); + WorkList.push_back(I2); + return new CastInst(I2, CI->getType()); + } + } + } + return Changed ? &I : 0; } From evan.cheng at apple.com Tue Sep 19 13:40:30 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 19 Sep 2006 13:40:30 -0500 Subject: [llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp Message-ID: <200609191840.k8JIeU81021593@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: DAGISelEmitter.cpp updated: 1.259 -> 1.260 --- Log message: Add result of a Xform to isel queue. --- Diffs of the changes: (+1 -0) DAGISelEmitter.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/utils/TableGen/DAGISelEmitter.cpp diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.259 llvm/utils/TableGen/DAGISelEmitter.cpp:1.260 --- llvm/utils/TableGen/DAGISelEmitter.cpp:1.259 Mon Sep 18 19:41:36 2006 +++ llvm/utils/TableGen/DAGISelEmitter.cpp Tue Sep 19 13:40:15 2006 @@ -2827,6 +2827,7 @@ emitCode("SDOperand Tmp" + utostr(ResNo) + " = Transform_" + Op->getName() + "(" + Ops.back() + ".Val);"); NodeOps.push_back("Tmp" + utostr(ResNo)); + emitCode("AddToISelQueue(Tmp" + utostr(ResNo) + ");"); if (isRoot) emitCode("return Tmp" + utostr(ResNo) + ".Val;"); return NodeOps; From evan.cheng at apple.com Tue Sep 19 14:08:19 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 19 Sep 2006 14:08:19 -0500 Subject: [llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp Message-ID: <200609191908.k8JJ8JTh022066@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: DAGISelEmitter.cpp updated: 1.260 -> 1.261 --- Log message: Allow PatFrag to be a leaf node. --- Diffs of the changes: (+18 -10) DAGISelEmitter.cpp | 28 ++++++++++++++++++---------- 1 files changed, 18 insertions(+), 10 deletions(-) Index: llvm/utils/TableGen/DAGISelEmitter.cpp diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.260 llvm/utils/TableGen/DAGISelEmitter.cpp:1.261 --- llvm/utils/TableGen/DAGISelEmitter.cpp:1.260 Tue Sep 19 13:40:15 2006 +++ llvm/utils/TableGen/DAGISelEmitter.cpp Tue Sep 19 14:08:04 2006 @@ -1158,15 +1158,19 @@ // keep track of the fact that this fragment uses it. std::string Code = Fragments[i]->getValueAsCode("Predicate"); if (!Code.empty()) { - assert(!P->getOnlyTree()->isLeaf() && "Can't be a leaf!"); - std::string ClassName = - getSDNodeInfo(P->getOnlyTree()->getOperator()).getSDClassName(); - const char *C2 = ClassName == "SDNode" ? "N" : "inN"; - - OS << "inline bool Predicate_" << Fragments[i]->getName() - << "(SDNode *" << C2 << ") {\n"; - if (ClassName != "SDNode") - OS << " " << ClassName << " *N = cast<" << ClassName << ">(inN);\n"; + if (P->getOnlyTree()->isLeaf()) + OS << "inline bool Predicate_" << Fragments[i]->getName() + << "(SDNode *N) {\n"; + else { + std::string ClassName = + getSDNodeInfo(P->getOnlyTree()->getOperator()).getSDClassName(); + const char *C2 = ClassName == "SDNode" ? "N" : "inN"; + + OS << "inline bool Predicate_" << Fragments[i]->getName() + << "(SDNode *" << C2 << ") {\n"; + if (ClassName != "SDNode") + OS << " " << ClassName << " *N = cast<" << ClassName << ">(inN);\n"; + } OS << Code << "\n}\n"; P->getOnlyTree()->setPredicateFn("Predicate_"+Fragments[i]->getName()); } @@ -2371,6 +2375,11 @@ #endif assert(0 && "Unknown leaf type!"); } + + // If there is a node predicate for this, emit the call. + if (!Child->getPredicateFn().empty()) + emitCheck(Child->getPredicateFn() + "(" + RootName + utostr(OpNo) + + ".Val)"); } else if (IntInit *II = dynamic_cast(Child->getLeafValue())) { emitCheck("isa(" + RootName + utostr(OpNo) + ")"); @@ -2827,7 +2836,6 @@ emitCode("SDOperand Tmp" + utostr(ResNo) + " = Transform_" + Op->getName() + "(" + Ops.back() + ".Val);"); NodeOps.push_back("Tmp" + utostr(ResNo)); - emitCode("AddToISelQueue(Tmp" + utostr(ResNo) + ");"); if (isRoot) emitCode("return Tmp" + utostr(ResNo) + ".Val;"); return NodeOps; From jlaskey at apple.com Tue Sep 19 14:12:47 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 19 Sep 2006 14:12:47 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/NightlyTestAccept.php Message-ID: <200609191912.k8JJCllA022207@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: NightlyTestAccept.php updated: 1.51 -> 1.52 --- Log message: Fix problems with significantly changed report --- Diffs of the changes: (+17 -8) NightlyTestAccept.php | 25 +++++++++++++++++-------- 1 files changed, 17 insertions(+), 8 deletions(-) Index: nightlytest-serverside/NightlyTestAccept.php diff -u nightlytest-serverside/NightlyTestAccept.php:1.51 nightlytest-serverside/NightlyTestAccept.php:1.52 --- nightlytest-serverside/NightlyTestAccept.php:1.51 Tue Sep 19 11:51:12 2006 +++ nightlytest-serverside/NightlyTestAccept.php Tue Sep 19 14:12:33 2006 @@ -823,6 +823,7 @@ print "Gathered all previous night\'s programs\n"; } +$monitoring = array("Bytecode", "CBE", "GCCAS", "JIT", "LLC", "LLC-BETA", "LLC compile", "LLC-BETA compile"); $output_big_changes = array(); foreach ($prog_hash_new as $prog => $prog_new) { $prog_old = $prog_hash_old[$prog]; @@ -832,18 +833,26 @@ $vals_old = split(",", $prog_old); // get list of values measured from newest test - $measures = array(); + $new_measures = array(); foreach ($vals_new as $measure) { - $measure = preg_replace("/[ \,\.\:\-0-9]*/", "", $measure); - if(strpos($measure, "/") == 0) { - array_push($measures, $measure); - } + list($measure, $value) = split(": ", $measure); + $new_measures[$measure] = $value; } + // get list of values measured from older test + $old_measures = array(); + foreach ($vals_old as $measure) { + list($measure, $value) = split(": ", $measure); + $old_measures[$measure] = $value; + } + // put measures into hash of arrays - foreach ($measures as $measure) { - $value_new = MatchOne("/$measure:.*?(\d*\.*\d+)/", $prog_new, "0"); - $value_old = MatchOne("/$measure:.*?(\d*\.*\d+)/", $prog_old, "0"); + foreach ($monitoring as $measure) { + $value_new = MatchOne("/(\d+\.?\d*)/", $new_measures[$measure], ""); + $value_old = MatchOne("/(\d+\.?\d*)/", $old_measures[$measure], ""); + + if (StringIsNull($value_new) || StringIsNull($value_old)) continue; + $diff = ($value_old - $value_new); $perc = 0; From jlaskey at apple.com Tue Sep 19 14:18:02 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 19 Sep 2006 14:18:02 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/NightlyTestAccept.php Message-ID: <200609191918.k8JJI21J022409@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: NightlyTestAccept.php updated: 1.52 -> 1.53 --- Log message: We don't need no stinking backslashes --- Diffs of the changes: (+4 -4) NightlyTestAccept.php | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: nightlytest-serverside/NightlyTestAccept.php diff -u nightlytest-serverside/NightlyTestAccept.php:1.52 nightlytest-serverside/NightlyTestAccept.php:1.53 --- nightlytest-serverside/NightlyTestAccept.php:1.52 Tue Sep 19 14:12:33 2006 +++ nightlytest-serverside/NightlyTestAccept.php Tue Sep 19 14:17:47 2006 @@ -971,16 +971,16 @@ $sentdata=""; foreach ($_GET as $key => $value) { if(strpos($value, "\n") == 0) { - $sentdata .= "\'$key\' => \"$value\",\n"; + $sentdata .= "'$key' => \"$value\",\n"; } else { - $sentdata .= "\'$key\' => < $value) { if(strpos($value, "\n") == 0) { - $sentdata .= "\'$key\' => \"$value\",\n"; + $sentdata .= "'$key' => \"$value\",\n"; } else { - $sentdata .= "\'$key\' => < Changes in directory nightlytest-serverside: NightlyTestAccept.php updated: 1.53 -> 1.54 --- Log message: Missing a space --- Diffs of the changes: (+2 -2) NightlyTestAccept.php | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: nightlytest-serverside/NightlyTestAccept.php diff -u nightlytest-serverside/NightlyTestAccept.php:1.53 nightlytest-serverside/NightlyTestAccept.php:1.54 --- nightlytest-serverside/NightlyTestAccept.php:1.53 Tue Sep 19 14:17:47 2006 +++ nightlytest-serverside/NightlyTestAccept.php Tue Sep 19 15:47:28 2006 @@ -829,8 +829,8 @@ $prog_old = $prog_hash_old[$prog]; // get data from server - $vals_new = split(",", $prog_new); - $vals_old = split(",", $prog_old); + $vals_new = split(", ", $prog_new); + $vals_old = split(", ", $prog_old); // get list of values measured from newest test $new_measures = array(); From jlaskey at apple.com Tue Sep 19 16:47:33 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 19 Sep 2006 16:47:33 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/NightlyTestAccept.php Message-ID: <200609192147.k8JLlXg5026514@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: NightlyTestAccept.php updated: 1.54 -> 1.55 --- Log message: Add category --- Diffs of the changes: (+2 -2) NightlyTestAccept.php | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: nightlytest-serverside/NightlyTestAccept.php diff -u nightlytest-serverside/NightlyTestAccept.php:1.54 nightlytest-serverside/NightlyTestAccept.php:1.55 --- nightlytest-serverside/NightlyTestAccept.php:1.54 Tue Sep 19 15:47:28 2006 +++ nightlytest-serverside/NightlyTestAccept.php Tue Sep 19 16:47:19 2006 @@ -798,7 +798,7 @@ $prog_hash_new = array(); while ($row = mysql_fetch_assoc($program_query)) { - $program = $row['program']; + $program = $row['type']."/".$row['program']; $result = $row['result']; $prog_hash_new[$program] = $result; } @@ -813,7 +813,7 @@ $prog_hash_old = array(); while ($row = mysql_fetch_assoc($program_query)) { - $program = $row['program']; + $program = $row['type']."/".$row['program']; $result = $row['result']; $prog_hash_old[$program] = $result; } From jlaskey at apple.com Tue Sep 19 17:07:47 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 19 Sep 2006 17:07:47 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php Message-ID: <200609192207.k8JM7lC1026947@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.81 -> 1.82 --- Log message: One more attempt at getting it right --- Diffs of the changes: (+5 -10) ProgramResults.php | 15 +++++---------- 1 files changed, 5 insertions(+), 10 deletions(-) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.81 nightlytest-serverside/ProgramResults.php:1.82 --- nightlytest-serverside/ProgramResults.php:1.81 Sun Sep 17 04:58:16 2006 +++ nightlytest-serverside/ProgramResults.php Tue Sep 19 17:07:32 2006 @@ -609,13 +609,8 @@ while ($row = mysql_fetch_assoc($program_query)) { $program = trimTestPath($row['program']); $measure = strtoupper($row['measure']); - $result = $test_hash[$program]; - if (isset($result)) { - $result .= ", " . $measure; - } else { - $result = $measure; - } - $test_hash[$program] = $result; + $key = "$program [$measure]"; + $test_hash[$key] = true; } mysql_free_result($program_query); return $test_hash; @@ -634,9 +629,9 @@ while ($row = mysql_fetch_assoc($program_query)) { $program = trimTestPath($row['program']); $measure = strtoupper($row['measure']); - $result = $test_hash[$program]; - if (strpos("$result", $measure) !== false) { - $passing .= "$program [$measure]\n"; + $key = "$program [$measure]"; + if (isset($test_hash[$key])) { + $passing .= "$key\n"; } } mysql_free_result($program_query); From evan.cheng at apple.com Tue Sep 19 20:10:16 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 19 Sep 2006 20:10:16 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200609200110.k8K1AGfQ030248@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.511 -> 1.512 --- Log message: 80 col. --- Diffs of the changes: (+2 -1) InstructionCombining.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.511 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.512 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.511 Tue Sep 19 13:24:51 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Sep 19 20:10:02 2006 @@ -1608,7 +1608,8 @@ const Type *SIntPtrTy = UIntPtrTy->getSignedVersion(); if((CI->getType() == UIntPtrTy || CI->getType() == SIntPtrTy) && isa(CI->getOperand(0)->getType())) { - Instruction* I2 = new CastInst(CI->getOperand(0), PointerType::get(Type::SByteTy), "ctg", &I); + Instruction* I2 = new CastInst(CI->getOperand(0), + PointerType::get(Type::SByteTy), "ctg", &I); WorkList.push_back(I2); I2 = new GetElementPtrInst(I2, Other, "ctg", &I); WorkList.push_back(I2); From evan.cheng at apple.com Tue Sep 19 20:39:54 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 19 Sep 2006 20:39:54 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200609200139.k8K1dsFQ030727@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.512 -> 1.513 --- Log message: Back out Chris' last set of changes. This breaks 177.mesa and povray somehow. --- Diffs of the changes: (+6 -43) InstructionCombining.cpp | 49 +++++------------------------------------------ 1 files changed, 6 insertions(+), 43 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.512 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.513 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.512 Tue Sep 19 20:10:02 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Sep 19 20:39:40 2006 @@ -5713,48 +5713,12 @@ return new CastInst(NotCond, SI.getType()); } - if (SetCondInst *IC = dyn_cast(SI.getCondition())) { - - // (x sra x, 31 - // (x >u 2147483647) ? -1 : 0 -> sra x, 31 - if (TrueValC->isAllOnesValue() && FalseValC->isNullValue()) - if (ConstantInt *CmpCst = dyn_cast(IC->getOperand(1))) { - bool CanXForm = false; - if (CmpCst->getType()->isSigned()) - CanXForm = CmpCst->isNullValue() && - IC->getOpcode() == Instruction::SetLT; - else { - unsigned Bits = CmpCst->getType()->getPrimitiveSizeInBits(); - CanXForm = (CmpCst->getRawValue() == ~0ULL >> (64-Bits+1)) && - IC->getOpcode() == Instruction::SetGT; - } - - // The comparison constant and the result are not neccessarily the - // same width. In any case, the first step to do is make sure that - // X is signed. - Value *X = IC->getOperand(0); - if (!X->getType()->isSigned()) - X = InsertCastBefore(X, X->getType()->getSignedVersion(), SI); - - // Now that X is signed, we have to make the all ones value. Do - // this by inserting a new SRA. - unsigned Bits = X->getType()->getPrimitiveSizeInBits(); - Constant *ShAmt = ConstantUInt::get(Type::UByteTy, Bits-1); - Instruction *SRA = new ShiftInst(Instruction::Shr, X, ShAmt,"ones"); - InsertNewInstBefore(SRA, SI); - - // Finally, convert to the type of the select RHS. If this is - // smaller than the compare value, it will truncate the ones to fit. - // If it is larger, it will sext the ones to fit. - return new CastInst(SRA, SI.getType()); - } - - - // If one of the constants is zero (we know they can't both be) and we - // have a setcc instruction with zero, and we have an 'and' with the - // non-constant value, eliminate this whole mess. This corresponds to - // cases like this: ((X & 27) ? 27 : 0) - if (TrueValC->isNullValue() || FalseValC->isNullValue()) + // If one of the constants is zero (we know they can't both be) and we + // have a setcc instruction with zero, and we have an 'and' with the + // non-constant value, eliminate this whole mess. This corresponds to + // cases like this: ((X & 27) ? 27 : 0) + if (TrueValC->isNullValue() || FalseValC->isNullValue()) + if (SetCondInst *IC = dyn_cast(SI.getCondition())) if (IC->isEquality() && isa(IC->getOperand(1)) && cast(IC->getOperand(1))->isNullValue()) if (Instruction *ICA = dyn_cast(IC->getOperand(0))) @@ -5774,7 +5738,6 @@ Instruction::Xor, V, ICA->getOperand(1)), SI); return ReplaceInstUsesWith(SI, V); } - } } // See if we are selecting two values based on a comparison of the two values. From sabre at nondot.org Tue Sep 19 22:39:02 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Sep 2006 22:39:02 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200609200339.k8K3d2E8032726@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.398 -> 1.399 --- Log message: Expand 64-bit shifts more optimally if we know that the high bit of the shift amount is one or zero. For example, for: long long foo1(long long X, int C) { return X << (C|32); } long long foo2(long long X, int C) { return X << (C&~32); } we get: _foo1: movb $31, %cl movl 4(%esp), %edx andb 12(%esp), %cl shll %cl, %edx xorl %eax, %eax ret _foo2: movb $223, %cl movl 4(%esp), %eax movl 8(%esp), %edx andb 12(%esp), %cl shldl %cl, %eax, %edx shll %cl, %eax ret instead of: _foo1: subl $4, %esp movl %ebx, (%esp) movb $32, %bl movl 8(%esp), %eax movl 12(%esp), %edx movb %bl, %cl orb 16(%esp), %cl shldl %cl, %eax, %edx shll %cl, %eax xorl %ecx, %ecx testb %bl, %bl cmovne %eax, %edx cmovne %ecx, %eax movl (%esp), %ebx addl $4, %esp ret _foo2: subl $4, %esp movl %ebx, (%esp) movb $223, %cl movl 8(%esp), %eax movl 12(%esp), %edx andb 16(%esp), %cl shldl %cl, %eax, %edx shll %cl, %eax xorl %ecx, %ecx xorb %bl, %bl testb %bl, %bl cmovne %eax, %edx cmovne %ecx, %eax movl (%esp), %ebx addl $4, %esp ret --- Diffs of the changes: (+66 -0) LegalizeDAG.cpp | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 66 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.398 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.399 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.398 Mon Sep 18 18:28:33 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Sep 19 22:38:48 2006 @@ -3781,6 +3781,72 @@ return true; } } + + // Okay, the shift amount isn't constant. However, if we can tell that it is + // >= 32 or < 32, we can still simplify it, without knowing the actual value. + uint64_t Mask = NVTBits, KnownZero, KnownOne; + TLI.ComputeMaskedBits(Amt, Mask, KnownZero, KnownOne); + + // If we know that the high bit of the shift amount is one, then we can do + // this as a couple of simple shifts. + if (KnownOne & Mask) { + // Mask out the high bit, which we know is set. + Amt = DAG.getNode(ISD::AND, Amt.getValueType(), Amt, + DAG.getConstant(NVTBits-1, Amt.getValueType())); + + // Expand the incoming operand to be shifted, so that we have its parts + SDOperand InL, InH; + ExpandOp(Op, InL, InH); + switch(Opc) { + case ISD::SHL: + Lo = DAG.getConstant(0, NVT); // Low part is zero. + Hi = DAG.getNode(ISD::SHL, NVT, InL, Amt); // High part from Lo part. + return true; + case ISD::SRL: + Hi = DAG.getConstant(0, NVT); // Hi part is zero. + Lo = DAG.getNode(ISD::SRL, NVT, InH, Amt); // Lo part from Hi part. + return true; + case ISD::SRA: + Hi = DAG.getNode(ISD::SRA, NVT, InH, // Sign extend high part. + DAG.getConstant(NVTBits-1, Amt.getValueType())); + Lo = DAG.getNode(ISD::SRA, NVT, InH, Amt); // Lo part from Hi part. + return true; + } + } + + // If we know that the high bit of the shift amount is zero, then we can do + // this as a couple of simple shifts. + if (KnownZero & Mask) { + // Compute 32-amt. + SDOperand Amt2 = DAG.getNode(ISD::SUB, Amt.getValueType(), + DAG.getConstant(NVTBits, Amt.getValueType()), + Amt); + + // Expand the incoming operand to be shifted, so that we have its parts + SDOperand InL, InH; + ExpandOp(Op, InL, InH); + switch(Opc) { + case ISD::SHL: + Lo = DAG.getNode(ISD::SHL, NVT, InL, Amt); + Hi = DAG.getNode(ISD::OR, NVT, + DAG.getNode(ISD::SHL, NVT, InH, Amt), + DAG.getNode(ISD::SRL, NVT, InL, Amt2)); + return true; + case ISD::SRL: + Hi = DAG.getNode(ISD::SRL, NVT, InH, Amt); + Lo = DAG.getNode(ISD::OR, NVT, + DAG.getNode(ISD::SRL, NVT, InL, Amt), + DAG.getNode(ISD::SHL, NVT, InH, Amt2)); + return true; + case ISD::SRA: + Hi = DAG.getNode(ISD::SRA, NVT, InH, Amt); + Lo = DAG.getNode(ISD::OR, NVT, + DAG.getNode(ISD::SRL, NVT, InL, Amt), + DAG.getNode(ISD::SHL, NVT, InH, Amt2)); + return true; + } + } + return false; } From sabre at nondot.org Tue Sep 19 22:47:54 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Sep 2006 22:47:54 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelLowering.cpp Message-ID: <200609200347.k8K3ls8D000454@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCISelLowering.cpp updated: 1.207 -> 1.208 --- Log message: Legalize is no longer limited to cleverness with just constant shift amounts. Allow it to be clever when possible and fall back to the gross code when needed. This allows us to compile: long long foo1(long long X, int C) { return X << (C|32); } long long foo2(long long X, int C) { return X << (C&~32); } to: _foo1: rlwinm r2, r5, 0, 27, 31 slw r3, r4, r2 li r4, 0 blr .globl _foo2 .align 4 _foo2: rlwinm r2, r5, 0, 27, 25 subfic r5, r2, 32 slw r3, r3, r2 srw r5, r4, r5 or r3, r3, r5 slw r4, r4, r2 blr instead of: _foo1: ori r2, r5, 32 subfic r5, r2, 32 addi r6, r2, -32 srw r5, r4, r5 slw r3, r3, r2 slw r6, r4, r6 or r3, r3, r5 slw r4, r4, r2 or r3, r3, r6 blr .globl _foo2 .align 4 _foo2: rlwinm r2, r5, 0, 27, 25 subfic r5, r2, 32 addi r6, r2, -32 srw r5, r4, r5 slw r3, r3, r2 slw r6, r4, r6 or r3, r3, r5 slw r4, r4, r2 or r3, r3, r6 blr --- Diffs of the changes: (+32 -41) PPCISelLowering.cpp | 73 ++++++++++++++++++++++------------------------------ 1 files changed, 32 insertions(+), 41 deletions(-) Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.207 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.208 --- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.207 Tue Sep 19 00:22:59 2006 +++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Tue Sep 19 22:47:40 2006 @@ -181,9 +181,9 @@ setOperationAction(ISD::BUILD_PAIR, MVT::i64, Expand); } else { // 32 bit PowerPC wants to expand i64 shifts itself. - setOperationAction(ISD::SHL, MVT::i64, Custom); - setOperationAction(ISD::SRL, MVT::i64, Custom); - setOperationAction(ISD::SRA, MVT::i64, Custom); + setOperationAction(ISD::SHL_PARTS, MVT::i32, Custom); + setOperationAction(ISD::SRA_PARTS, MVT::i32, Custom); + setOperationAction(ISD::SRL_PARTS, MVT::i32, Custom); } if (TM.getSubtarget().hasAltivec()) { @@ -1412,20 +1412,15 @@ return FP; } -static SDOperand LowerSHL(SDOperand Op, SelectionDAG &DAG, - MVT::ValueType PtrVT) { - assert(Op.getValueType() == MVT::i64 && +static SDOperand LowerSHL_PARTS(SDOperand Op, SelectionDAG &DAG) { + assert(Op.getNumOperands() == 3 && Op.getValueType() == MVT::i32 && Op.getOperand(1).getValueType() == MVT::i32 && "Unexpected SHL!"); - // The generic code does a fine job expanding shift by a constant. - if (isa(Op.getOperand(1))) return SDOperand(); - // Otherwise, expand into a bunch of logical ops. Note that these ops + // Expand into a bunch of logical ops. Note that these ops // depend on the PPC behavior for oversized shift amounts. - SDOperand Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, MVT::i32, Op.getOperand(0), - DAG.getConstant(0, PtrVT)); - SDOperand Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, MVT::i32, Op.getOperand(0), - DAG.getConstant(1, PtrVT)); - SDOperand Amt = Op.getOperand(1); + SDOperand Lo = Op.getOperand(0); + SDOperand Hi = Op.getOperand(1); + SDOperand Amt = Op.getOperand(2); SDOperand Tmp1 = DAG.getNode(ISD::SUB, MVT::i32, DAG.getConstant(32, MVT::i32), Amt); @@ -1437,23 +1432,20 @@ SDOperand Tmp6 = DAG.getNode(PPCISD::SHL, MVT::i32, Lo, Tmp5); SDOperand OutHi = DAG.getNode(ISD::OR, MVT::i32, Tmp4, Tmp6); SDOperand OutLo = DAG.getNode(PPCISD::SHL, MVT::i32, Lo, Amt); - return DAG.getNode(ISD::BUILD_PAIR, MVT::i64, OutLo, OutHi); + SDOperand OutOps[] = { OutLo, OutHi }; + return DAG.getNode(ISD::MERGE_VALUES, DAG.getVTList(MVT::i32, MVT::i32), + OutOps, 2); } -static SDOperand LowerSRL(SDOperand Op, SelectionDAG &DAG, - MVT::ValueType PtrVT) { - assert(Op.getValueType() == MVT::i64 && - Op.getOperand(1).getValueType() == MVT::i32 && "Unexpected SHL!"); - // The generic code does a fine job expanding shift by a constant. - if (isa(Op.getOperand(1))) return SDOperand(); +static SDOperand LowerSRL_PARTS(SDOperand Op, SelectionDAG &DAG) { + assert(Op.getNumOperands() == 3 && Op.getValueType() == MVT::i32 && + Op.getOperand(1).getValueType() == MVT::i32 && "Unexpected SRL!"); // Otherwise, expand into a bunch of logical ops. Note that these ops // depend on the PPC behavior for oversized shift amounts. - SDOperand Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, MVT::i32, Op.getOperand(0), - DAG.getConstant(0, PtrVT)); - SDOperand Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, MVT::i32, Op.getOperand(0), - DAG.getConstant(1, PtrVT)); - SDOperand Amt = Op.getOperand(1); + SDOperand Lo = Op.getOperand(0); + SDOperand Hi = Op.getOperand(1); + SDOperand Amt = Op.getOperand(2); SDOperand Tmp1 = DAG.getNode(ISD::SUB, MVT::i32, DAG.getConstant(32, MVT::i32), Amt); @@ -1465,22 +1457,19 @@ SDOperand Tmp6 = DAG.getNode(PPCISD::SRL, MVT::i32, Hi, Tmp5); SDOperand OutLo = DAG.getNode(ISD::OR, MVT::i32, Tmp4, Tmp6); SDOperand OutHi = DAG.getNode(PPCISD::SRL, MVT::i32, Hi, Amt); - return DAG.getNode(ISD::BUILD_PAIR, MVT::i64, OutLo, OutHi); + SDOperand OutOps[] = { OutLo, OutHi }; + return DAG.getNode(ISD::MERGE_VALUES, DAG.getVTList(MVT::i32, MVT::i32), + OutOps, 2); } -static SDOperand LowerSRA(SDOperand Op, SelectionDAG &DAG, - MVT::ValueType PtrVT) { - assert(Op.getValueType() == MVT::i64 && +static SDOperand LowerSRA_PARTS(SDOperand Op, SelectionDAG &DAG) { + assert(Op.getNumOperands() == 3 && Op.getValueType() == MVT::i32 && Op.getOperand(1).getValueType() == MVT::i32 && "Unexpected SRA!"); - // The generic code does a fine job expanding shift by a constant. - if (isa(Op.getOperand(1))) return SDOperand(); // Otherwise, expand into a bunch of logical ops, followed by a select_cc. - SDOperand Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, MVT::i32, Op.getOperand(0), - DAG.getConstant(0, PtrVT)); - SDOperand Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, MVT::i32, Op.getOperand(0), - DAG.getConstant(1, PtrVT)); - SDOperand Amt = Op.getOperand(1); + SDOperand Lo = Op.getOperand(0); + SDOperand Hi = Op.getOperand(1); + SDOperand Amt = Op.getOperand(2); SDOperand Tmp1 = DAG.getNode(ISD::SUB, MVT::i32, DAG.getConstant(32, MVT::i32), Amt); @@ -1493,7 +1482,9 @@ SDOperand OutHi = DAG.getNode(PPCISD::SRA, MVT::i32, Hi, Amt); SDOperand OutLo = DAG.getSelectCC(Tmp5, DAG.getConstant(0, MVT::i32), Tmp4, Tmp6, ISD::SETLE); - return DAG.getNode(ISD::BUILD_PAIR, MVT::i64, OutLo, OutHi); + SDOperand OutOps[] = { OutLo, OutHi }; + return DAG.getNode(ISD::MERGE_VALUES, DAG.getVTList(MVT::i32, MVT::i32), + OutOps, 2); } //===----------------------------------------------------------------------===// @@ -2217,9 +2208,9 @@ case ISD::SINT_TO_FP: return LowerSINT_TO_FP(Op, DAG); // Lower 64-bit shifts. - case ISD::SHL: return LowerSHL(Op, DAG, getPointerTy()); - case ISD::SRL: return LowerSRL(Op, DAG, getPointerTy()); - case ISD::SRA: return LowerSRA(Op, DAG, getPointerTy()); + case ISD::SHL_PARTS: return LowerSHL_PARTS(Op, DAG); + case ISD::SRL_PARTS: return LowerSRL_PARTS(Op, DAG); + case ISD::SRA_PARTS: return LowerSRA_PARTS(Op, DAG); // Vector-related lowering. case ISD::BUILD_VECTOR: return LowerBUILD_VECTOR(Op, DAG); From sabre at nondot.org Tue Sep 19 22:59:40 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Sep 2006 22:59:40 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/README.txt Message-ID: <200609200359.k8K3xe8e000663@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: README.txt updated: 1.95 -> 1.96 --- Log message: Add a note that we should match rlwnm better --- Diffs of the changes: (+34 -0) README.txt | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+) Index: llvm/lib/Target/PowerPC/README.txt diff -u llvm/lib/Target/PowerPC/README.txt:1.95 llvm/lib/Target/PowerPC/README.txt:1.96 --- llvm/lib/Target/PowerPC/README.txt:1.95 Thu Sep 14 15:56:30 2006 +++ llvm/lib/Target/PowerPC/README.txt Tue Sep 19 22:59:25 2006 @@ -6,6 +6,40 @@ ===-------------------------------------------------------------------------=== +We only produce the rlwnm instruction for rotate instructions. We should +at least match stuff like: + +unsigned rot_and(unsigned X, int Y) { + unsigned T = (X << Y) | (X >> (32-Y)); + T &= 127; + return T; +} + +_foo3: + rlwnm r2, r3, r4, 0, 31 + rlwinm r3, r2, 0, 25, 31 + blr + +... which is the basic pattern that should be written in the instr. It may +also be useful for stuff like: + +long long foo2(long long X, int C) { + return X << (C&~32); +} + +which currently produces: + +_foo2: + rlwinm r2, r5, 0, 27, 25 + subfic r5, r2, 32 + slw r3, r3, r2 + srw r5, r4, r5 + or r3, r3, r5 + slw r4, r4, r2 + blr + +===-------------------------------------------------------------------------=== + Support 'update' load/store instructions. These are cracked on the G5, but are still a codesize win. From sabre at nondot.org Tue Sep 19 23:26:01 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Sep 2006 23:26:01 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp README.txt Message-ID: <200609200426.k8K4Q1GB001149@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCISelDAGToDAG.cpp updated: 1.208 -> 1.209 README.txt updated: 1.96 -> 1.97 --- Log message: Two improvements: 1. Codegen this comparison: if (X == 0x8000) as: cmplwi cr0, r3, 32768 bne cr0, LBB1_2 ;cond_next instead of: lis r2, 0 ori r2, r2, 32768 cmpw cr0, r3, r2 bne cr0, LBB1_2 ;cond_next 2. Codegen this comparison: if (X == 0x12345678) as: xoris r2, r3, 4660 cmplwi cr0, r2, 22136 bne cr0, LBB1_2 ;cond_next instead of: lis r2, 4660 ori r2, r2, 22136 cmpw cr0, r3, r2 bne cr0, LBB1_2 ;cond_next --- Diffs of the changes: (+27 -22) PPCISelDAGToDAG.cpp | 28 +++++++++++++++++++++++++++- README.txt | 21 --------------------- 2 files changed, 27 insertions(+), 22 deletions(-) Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp diff -u llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.208 llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.209 --- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.208 Sun Aug 27 07:54:01 2006 +++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Tue Sep 19 23:25:47 2006 @@ -699,7 +699,33 @@ if (LHS.getValueType() == MVT::i32) { unsigned Imm; - if (ISD::isUnsignedIntSetCC(CC)) { + if (CC == ISD::SETEQ || CC == ISD::SETNE) { + if (isInt32Immediate(RHS, Imm)) { + // SETEQ/SETNE comparison with 16-bit immediate, fold it. + if (isUInt16(Imm)) + return SDOperand(CurDAG->getTargetNode(PPC::CMPLWI, MVT::i32, LHS, + getI32Imm(Imm & 0xFFFF)), 0); + // If this is a 16-bit signed immediate, fold it. + if (isInt16(Imm)) + return SDOperand(CurDAG->getTargetNode(PPC::CMPWI, MVT::i32, LHS, + getI32Imm(Imm & 0xFFFF)), 0); + + // For non-equality comparisons, the default code would materialize the + // constant, then compare against it, like this: + // lis r2, 4660 + // ori r2, r2, 22136 + // cmpw cr0, r3, r2 + // Since we are just comparing for equality, we can emit this instead: + // xoris r0,r3,0x1234 + // cmplwi cr0,r0,0x5678 + // beq cr0,L6 + SDOperand Xor(CurDAG->getTargetNode(PPC::XORIS, MVT::i32, LHS, + getI32Imm(Imm >> 16)), 0); + return SDOperand(CurDAG->getTargetNode(PPC::CMPLWI, MVT::i32, Xor, + getI32Imm(Imm & 0xFFFF)), 0); + } + Opc = PPC::CMPLW; + } else if (ISD::isUnsignedIntSetCC(CC)) { if (isInt32Immediate(RHS, Imm) && isUInt16(Imm)) return SDOperand(CurDAG->getTargetNode(PPC::CMPLWI, MVT::i32, LHS, getI32Imm(Imm & 0xFFFF)), 0); Index: llvm/lib/Target/PowerPC/README.txt diff -u llvm/lib/Target/PowerPC/README.txt:1.96 llvm/lib/Target/PowerPC/README.txt:1.97 --- llvm/lib/Target/PowerPC/README.txt:1.96 Tue Sep 19 22:59:25 2006 +++ llvm/lib/Target/PowerPC/README.txt Tue Sep 19 23:25:47 2006 @@ -50,27 +50,6 @@ ===-------------------------------------------------------------------------=== -* Codegen this: - - void test2(int X) { - if (X == 0x12345678) bar(); - } - - as: - - xoris r0,r3,0x1234 - cmplwi cr0,r0,0x5678 - beq cr0,L6 - - not: - - lis r2, 4660 - ori r2, r2, 22136 - cmpw cr0, r3, r2 - bne .LBB_test2_2 - -===-------------------------------------------------------------------------=== - Lump the constant pool for each function into ONE pic object, and reference pieces of it as offsets from the start. For functions like this (contrived to have lots of constants obviously): From sabre at nondot.org Tue Sep 19 23:33:41 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Sep 2006 23:33:41 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Message-ID: <200609200433.k8K4Xf9f001289@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCISelDAGToDAG.cpp updated: 1.209 -> 1.210 --- Log message: Improve PPC64 equality comparisons like PPC32 comparisons. --- Diffs of the changes: (+31 -3) PPCISelDAGToDAG.cpp | 34 +++++++++++++++++++++++++++++++--- 1 files changed, 31 insertions(+), 3 deletions(-) Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp diff -u llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.209 llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.210 --- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.209 Tue Sep 19 23:25:47 2006 +++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Tue Sep 19 23:33:27 2006 @@ -303,7 +303,7 @@ /// isInt64Immediate - This method tests to see if the node is a 64-bit constant /// operand. If so Imm will receive the 64-bit value. static bool isInt64Immediate(SDNode *N, uint64_t &Imm) { - if (N->getOpcode() == ISD::Constant && N->getValueType(0) == MVT::i32) { + if (N->getOpcode() == ISD::Constant && N->getValueType(0) == MVT::i64) { Imm = cast(N)->getValue(); return true; } @@ -740,7 +740,35 @@ } } else if (LHS.getValueType() == MVT::i64) { uint64_t Imm; - if (ISD::isUnsignedIntSetCC(CC)) { + if (CC == ISD::SETEQ || CC == ISD::SETNE) { + if (isInt64Immediate(RHS.Val, Imm)) { + // SETEQ/SETNE comparison with 16-bit immediate, fold it. + if (isUInt16(Imm)) + return SDOperand(CurDAG->getTargetNode(PPC::CMPLDI, MVT::i64, LHS, + getI32Imm(Imm & 0xFFFF)), 0); + // If this is a 16-bit signed immediate, fold it. + if (isInt16(Imm)) + return SDOperand(CurDAG->getTargetNode(PPC::CMPDI, MVT::i64, LHS, + getI32Imm(Imm & 0xFFFF)), 0); + + // For non-equality comparisons, the default code would materialize the + // constant, then compare against it, like this: + // lis r2, 4660 + // ori r2, r2, 22136 + // cmpd cr0, r3, r2 + // Since we are just comparing for equality, we can emit this instead: + // xoris r0,r3,0x1234 + // cmpldi cr0,r0,0x5678 + // beq cr0,L6 + if (isUInt32(Imm)) { + SDOperand Xor(CurDAG->getTargetNode(PPC::XORIS8, MVT::i64, LHS, + getI64Imm(Imm >> 16)), 0); + return SDOperand(CurDAG->getTargetNode(PPC::CMPLDI, MVT::i64, Xor, + getI64Imm(Imm & 0xFFFF)), 0); + } + } + Opc = PPC::CMPLD; + } else if (ISD::isUnsignedIntSetCC(CC)) { if (isInt64Immediate(RHS.Val, Imm) && isUInt16(Imm)) return SDOperand(CurDAG->getTargetNode(PPC::CMPLDI, MVT::i64, LHS, getI64Imm(Imm & 0xFFFF)), 0); @@ -749,7 +777,7 @@ short SImm; if (isIntS16Immediate(RHS, SImm)) return SDOperand(CurDAG->getTargetNode(PPC::CMPDI, MVT::i64, LHS, - getI64Imm((int)SImm & 0xFFFF)), + getI64Imm(SImm & 0xFFFF)), 0); Opc = PPC::CMPD; } From sabre at nondot.org Tue Sep 19 23:45:14 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Sep 2006 23:45:14 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200609200445.k8K4jEPa001594@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.513 -> 1.514 --- Log message: We went through all that trouble to compute whether it was safe to transform this comparison, but never checked it. Whoops, no wonder we miscompiled 177.mesa! --- Diffs of the changes: (+46 -6) InstructionCombining.cpp | 52 +++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 46 insertions(+), 6 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.513 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.514 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.513 Tue Sep 19 20:39:40 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Sep 19 23:44:59 2006 @@ -5713,12 +5713,51 @@ return new CastInst(NotCond, SI.getType()); } - // If one of the constants is zero (we know they can't both be) and we - // have a setcc instruction with zero, and we have an 'and' with the - // non-constant value, eliminate this whole mess. This corresponds to - // cases like this: ((X & 27) ? 27 : 0) - if (TrueValC->isNullValue() || FalseValC->isNullValue()) - if (SetCondInst *IC = dyn_cast(SI.getCondition())) + if (SetCondInst *IC = dyn_cast(SI.getCondition())) { + + // (x sra x, 31 + // (x >u 2147483647) ? -1 : 0 -> sra x, 31 + if (TrueValC->isAllOnesValue() && FalseValC->isNullValue()) + if (ConstantInt *CmpCst = dyn_cast(IC->getOperand(1))) { + bool CanXForm = false; + if (CmpCst->getType()->isSigned()) + CanXForm = CmpCst->isNullValue() && + IC->getOpcode() == Instruction::SetLT; + else { + unsigned Bits = CmpCst->getType()->getPrimitiveSizeInBits(); + CanXForm = (CmpCst->getRawValue() == ~0ULL >> (64-Bits+1)) && + IC->getOpcode() == Instruction::SetGT; + } + + if (CanXForm) { + // The comparison constant and the result are not neccessarily the + // same width. In any case, the first step to do is make sure + // that X is signed. + Value *X = IC->getOperand(0); + if (!X->getType()->isSigned()) + X = InsertCastBefore(X, X->getType()->getSignedVersion(), SI); + + // Now that X is signed, we have to make the all ones value. Do + // this by inserting a new SRA. + unsigned Bits = X->getType()->getPrimitiveSizeInBits(); + Constant *ShAmt = ConstantUInt::get(Type::UByteTy, Bits-1); + Instruction *SRA = new ShiftInst(Instruction::Shr, X, + ShAmt, "ones"); + InsertNewInstBefore(SRA, SI); + + // Finally, convert to the type of the select RHS. If this is + // smaller than the compare value, it will truncate the ones to + // fit. If it is larger, it will sext the ones to fit. + return new CastInst(SRA, SI.getType()); + } + } + + + // If one of the constants is zero (we know they can't both be) and we + // have a setcc instruction with zero, and we have an 'and' with the + // non-constant value, eliminate this whole mess. This corresponds to + // cases like this: ((X & 27) ? 27 : 0) + if (TrueValC->isNullValue() || FalseValC->isNullValue()) if (IC->isEquality() && isa(IC->getOperand(1)) && cast(IC->getOperand(1))->isNullValue()) if (Instruction *ICA = dyn_cast(IC->getOperand(0))) @@ -5738,6 +5777,7 @@ Instruction::Xor, V, ICA->getOperand(1)), SI); return ReplaceInstUsesWith(SI, V); } + } } // See if we are selecting two values based on a comparison of the two values. From sabre at nondot.org Tue Sep 19 23:59:47 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Sep 2006 23:59:47 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/README.txt Message-ID: <200609200459.k8K4xlm9001877@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: README.txt updated: 1.97 -> 1.98 --- Log message: This is already done --- Diffs of the changes: (+0 -8) README.txt | 8 -------- 1 files changed, 8 deletions(-) Index: llvm/lib/Target/PowerPC/README.txt diff -u llvm/lib/Target/PowerPC/README.txt:1.97 llvm/lib/Target/PowerPC/README.txt:1.98 --- llvm/lib/Target/PowerPC/README.txt:1.97 Tue Sep 19 23:25:47 2006 +++ llvm/lib/Target/PowerPC/README.txt Tue Sep 19 23:59:33 2006 @@ -546,14 +546,6 @@ ===-------------------------------------------------------------------------=== -On PPC64, this results in a truncate followed by a truncstore. These should -be folded together. - -unsigned short G; -void foo(unsigned long H) { G = H; } - -===-------------------------------------------------------------------------=== - We compile: unsigned test6(unsigned x) { From sabre at nondot.org Wed Sep 20 01:19:41 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 20 Sep 2006 01:19:41 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200609200619.k8K6JfSp003257@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.187 -> 1.188 --- Log message: Two things: 1. teach SimplifySetCC that '(srl (ctlz x), 5) == 0' is really x != 0. 2. Teach visitSELECT_CC to use SimplifySetCC instead of calling it and ignoring the result. This allows us to compile: bool %test(ulong %x) { %tmp = setlt ulong %x, 4294967296 ret bool %tmp } to: _test: cntlzw r2, r3 cmplwi cr0, r3, 1 srwi r2, r2, 5 li r3, 0 beq cr0, LBB1_2 ; LBB1_1: ; mr r3, r2 LBB1_2: ; blr instead of: _test: addi r2, r3, -1 cntlzw r2, r2 cntlzw r3, r3 srwi r2, r2, 5 cmplwi cr0, r2, 0 srwi r2, r3, 5 li r3, 0 bne cr0, LBB1_2 ; LBB1_1: ; mr r3, r2 LBB1_2: ; blr This isn't wonderful, but it's an improvement. --- Diffs of the changes: (+40 -5) DAGCombiner.cpp | 45 ++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 40 insertions(+), 5 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.187 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.188 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.187 Thu Sep 14 16:11:37 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Sep 20 01:19:26 2006 @@ -22,7 +22,6 @@ // FIXME: shr X, (and Y,31) -> shr X, Y (TRICKY!) // FIXME: mul (x, const) -> shifts + adds // FIXME: undef values -// FIXME: make truncate see through SIGN_EXTEND and AND // FIXME: divide by zero is currently left unfolded. do we want to turn this // into an undef? // FIXME: select ne (select cc, 1, 0), 0, true, false -> select cc, true, false @@ -1721,14 +1720,26 @@ ConstantSDNode *N2C = dyn_cast(N2); ISD::CondCode CC = cast(N4)->get(); - // Determine if the condition we're dealing with is constant - SDOperand SCC = SimplifySetCC(TLI.getSetCCResultTy(), N0, N1, CC, false); - //ConstantSDNode *SCCC = dyn_cast_or_null(SCC.Val); - // fold select_cc lhs, rhs, x, x, cc -> x if (N2 == N3) return N2; + // Determine if the condition we're dealing with is constant + SDOperand SCC = SimplifySetCC(TLI.getSetCCResultTy(), N0, N1, CC, false); + + if (ConstantSDNode *SCCC = dyn_cast_or_null(SCC.Val)) { + if (SCCC->getValue()) + return N2; // cond always true -> true val + else + return N3; // cond always false -> false val + } + + // Fold to a simpler select_cc + if (SCC.Val && SCC.getOpcode() == ISD::SETCC) + return DAG.getNode(ISD::SELECT_CC, N2.getValueType(), + SCC.getOperand(0), SCC.getOperand(1), N2, N3, + SCC.getOperand(2)); + // If we can fold this based on the true/false value, do so. if (SimplifySelectOps(N, N2, N3)) return SDOperand(N, 0); // Don't revisit N. @@ -3340,6 +3351,30 @@ case ISD::SETGE: return DAG.getConstant((int64_t)C0 >= (int64_t)C1, VT); } } else { + // If the LHS is '(srl (ctlz x), 5)', the RHS is 0/1, and this is an + // equality comparison, then we're just comparing whether X itself is + // zero. + if (N0.getOpcode() == ISD::SRL && (C1 == 0 || C1 == 1) && + N0.getOperand(0).getOpcode() == ISD::CTLZ && + N0.getOperand(1).getOpcode() == ISD::Constant) { + unsigned ShAmt = cast(N0.getOperand(1))->getValue(); + if ((Cond == ISD::SETEQ || Cond == ISD::SETNE) && + ShAmt == Log2_32(MVT::getSizeInBits(N0.getValueType()))) { + if ((C1 == 0) == (Cond == ISD::SETEQ)) { + // (srl (ctlz x), 5) == 0 -> X != 0 + // (srl (ctlz x), 5) != 1 -> X != 0 + Cond = ISD::SETNE; + } else { + // (srl (ctlz x), 5) != 0 -> X == 0 + // (srl (ctlz x), 5) == 1 -> X == 0 + Cond = ISD::SETEQ; + } + SDOperand Zero = DAG.getConstant(0, N0.getValueType()); + return DAG.getSetCC(VT, N0.getOperand(0).getOperand(0), + Zero, Cond); + } + } + // If the LHS is a ZERO_EXTEND, perform the comparison on the input. if (N0.getOpcode() == ISD::ZERO_EXTEND) { unsigned InSize = MVT::getSizeInBits(N0.getOperand(0).getValueType()); From sabre at nondot.org Wed Sep 20 01:29:31 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 20 Sep 2006 01:29:31 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200609200629.k8K6TVQq003448@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.188 -> 1.189 --- Log message: Fold the full generality of (any_extend (truncate x)) --- Diffs of the changes: (+9 -3) DAGCombiner.cpp | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.188 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.189 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.188 Wed Sep 20 01:19:26 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Sep 20 01:29:17 2006 @@ -1858,9 +1858,15 @@ N0.getOpcode() == ISD::SIGN_EXTEND) return DAG.getNode(N0.getOpcode(), VT, N0.getOperand(0)); - // fold (aext (truncate x)) -> x iff x size == zext size. - if (N0.getOpcode() == ISD::TRUNCATE && N0.getOperand(0).getValueType() == VT) - return N0.getOperand(0); + // fold (aext (truncate x)) + if (N0.getOpcode() == ISD::TRUNCATE) { + SDOperand TruncOp = N0.getOperand(0); + if (TruncOp.getValueType() == VT) + return TruncOp; // x iff x size == zext size. + if (TruncOp.getValueType() > VT) + return DAG.getNode(ISD::TRUNCATE, VT, TruncOp); + return DAG.getNode(ISD::ANY_EXTEND, VT, TruncOp); + } // fold (aext (load x)) -> (aext (truncate (extload x))) if (N0.getOpcode() == ISD::LOAD && N0.hasOneUse() && (!AfterLegalize||TLI.isOperationLegal(ISD::EXTLOAD, N0.getValueType()))) { From sabre at nondot.org Wed Sep 20 01:32:24 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 20 Sep 2006 01:32:24 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/README.txt Message-ID: <200609200632.k8K6WOiP003523@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: README.txt updated: 1.136 -> 1.137 --- Log message: add a note --- Diffs of the changes: (+16 -0) README.txt | 16 ++++++++++++++++ 1 files changed, 16 insertions(+) Index: llvm/lib/Target/X86/README.txt diff -u llvm/lib/Target/X86/README.txt:1.136 llvm/lib/Target/X86/README.txt:1.137 --- llvm/lib/Target/X86/README.txt:1.136 Mon Sep 18 00:36:54 2006 +++ llvm/lib/Target/X86/README.txt Wed Sep 20 01:32:10 2006 @@ -734,3 +734,19 @@ addl $12, %esp The add\sub pair is really unneeded here. + +//===---------------------------------------------------------------------===// + +We generate really bad code in some cases due to lowering SETCC/SELECT at +legalize time, which prevents the post-legalize dag combine pass from +understanding the code. As a silly example, this prevents us from folding +stuff like this: + +bool %test(ulong %x) { + %tmp = setlt ulong %x, 4294967296 + ret bool %tmp +} + +into x.h == 0 + + From sabre at nondot.org Wed Sep 20 01:40:52 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 20 Sep 2006 01:40:52 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/select_lt0.ll Message-ID: <200609200640.k8K6eq18003705@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/PowerPC: select_lt0.ll updated: 1.2 -> 1.3 --- Log message: new testcase --- Diffs of the changes: (+7 -1) select_lt0.ll | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletion(-) Index: llvm/test/Regression/CodeGen/PowerPC/select_lt0.ll diff -u llvm/test/Regression/CodeGen/PowerPC/select_lt0.ll:1.2 llvm/test/Regression/CodeGen/PowerPC/select_lt0.ll:1.3 --- llvm/test/Regression/CodeGen/PowerPC/select_lt0.ll:1.2 Thu Aug 18 20:16:18 2005 +++ llvm/test/Regression/CodeGen/PowerPC/select_lt0.ll Wed Sep 20 01:40:37 2006 @@ -38,8 +38,14 @@ } short %seli16_2(int %a, short %b) { -entry: %tmp.1 = setlt int %a, 0 %retval = select bool %tmp.1, short %b, short 0 ret short %retval } + +int %seli32_a_a(int %a) { + %tmp = setlt int %a, 1 + %min = select bool %tmp, int %a, int 0 + ret int %min +} + From sabre at nondot.org Wed Sep 20 01:41:49 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 20 Sep 2006 01:41:49 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200609200641.k8K6fnxG003747@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.189 -> 1.190 --- Log message: Compile: int test3(int a, int b) { return (a < 0) ? a : 0; } to: _test3: srawi r2, r3, 31 and r3, r2, r3 blr instead of: _test3: cmpwi cr0, r3, 1 li r2, 0 blt cr0, LBB2_2 ;entry LBB2_1: ;entry mr r3, r2 LBB2_2: ;entry blr This implements: PowerPC/select_lt0.ll:seli32_a_a --- Diffs of the changes: (+4 -3) DAGCombiner.cpp | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.189 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.190 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.189 Wed Sep 20 01:29:17 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Sep 20 01:41:35 2006 @@ -3168,7 +3168,6 @@ ISD::CondCode CC) { MVT::ValueType VT = N2.getValueType(); - //ConstantSDNode *N0C = dyn_cast(N0.Val); ConstantSDNode *N1C = dyn_cast(N1.Val); ConstantSDNode *N2C = dyn_cast(N2.Val); ConstantSDNode *N3C = dyn_cast(N3.Val); @@ -3204,9 +3203,11 @@ // Check to see if we can perform the "gzip trick", transforming // select_cc setlt X, 0, A, 0 -> and (sra X, size(X)-1), A - if (N1C && N1C->isNullValue() && N3C && N3C->isNullValue() && + if (N1C && N3C && N3C->isNullValue() && CC == ISD::SETLT && MVT::isInteger(N0.getValueType()) && - MVT::isInteger(N2.getValueType()) && CC == ISD::SETLT) { + MVT::isInteger(N2.getValueType()) && + (N1C->isNullValue() || // (a < 0) ? b : 0 + (N1C->getValue() == 1 && N0 == N2))) { // (a < 1) ? a : 0 MVT::ValueType XType = N0.getValueType(); MVT::ValueType AType = N2.getValueType(); if (XType >= AType) { From sabre at nondot.org Wed Sep 20 01:42:10 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 20 Sep 2006 01:42:10 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/README.txt Message-ID: <200609200642.k8K6gAKs003782@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: README.txt updated: 1.98 -> 1.99 --- Log message: item done --- Diffs of the changes: (+0 -6) README.txt | 6 ------ 1 files changed, 6 deletions(-) Index: llvm/lib/Target/PowerPC/README.txt diff -u llvm/lib/Target/PowerPC/README.txt:1.98 llvm/lib/Target/PowerPC/README.txt:1.99 --- llvm/lib/Target/PowerPC/README.txt:1.98 Tue Sep 19 23:59:33 2006 +++ llvm/lib/Target/PowerPC/README.txt Wed Sep 20 01:41:56 2006 @@ -139,12 +139,6 @@ ===-------------------------------------------------------------------------=== -int test3(int a, int b) { return (a < 0) ? a : 0; } - -should be branch free code. LLVM is turning it into < 1 because of the RHS. - -===-------------------------------------------------------------------------=== - No loads or stores of the constants should be needed: struct foo { double X, Y; }; From jlaskey at apple.com Wed Sep 20 04:20:42 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 20 Sep 2006 04:20:42 -0500 Subject: [llvm-commits] CVS: llvm/utils/NewNightlyTest.pl Message-ID: <200609200920.k8K9KgsZ007987@zion.cs.uiuc.edu> Changes in directory llvm/utils: NewNightlyTest.pl updated: 1.59 -> 1.60 --- Log message: Trim the home directory from the dejagnu test --- Diffs of the changes: (+2 -3) NewNightlyTest.pl | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) Index: llvm/utils/NewNightlyTest.pl diff -u llvm/utils/NewNightlyTest.pl:1.59 llvm/utils/NewNightlyTest.pl:1.60 --- llvm/utils/NewNightlyTest.pl:1.59 Fri Sep 15 12:03:36 2006 +++ llvm/utils/NewNightlyTest.pl Wed Sep 20 04:20:22 2006 @@ -385,9 +385,8 @@ while ( ) { if ( length($_) > 1 ) { chomp($_); - if ( m/^PASS:/ || m/^XPASS:/ || - m/^FAIL:/ || m/^XFAIL:/) { - push(@lines, "$_"); + if ( m/^(PASS|XPASS|FAIL|XFAIL): .*\/llvm\/test\/(.*)$/ ) { + push(@lines, "$1: test/$2"); } } } From jlaskey at apple.com Wed Sep 20 06:05:30 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 20 Sep 2006 06:05:30 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/NightlyTestAccept.php Message-ID: <200609201105.k8KB5U2h018381@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: NightlyTestAccept.php updated: 1.55 -> 1.56 --- Log message: Testing #1 --- Diffs of the changes: (+5 -5) NightlyTestAccept.php | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) Index: nightlytest-serverside/NightlyTestAccept.php diff -u nightlytest-serverside/NightlyTestAccept.php:1.55 nightlytest-serverside/NightlyTestAccept.php:1.56 --- nightlytest-serverside/NightlyTestAccept.php:1.55 Tue Sep 19 16:47:19 2006 +++ nightlytest-serverside/NightlyTestAccept.php Wed Sep 20 06:05:16 2006 @@ -727,19 +727,19 @@ * Adding test results pass/fail/xfail status to database * *******************************************************************************/ +print "$all_tests

\n"; $ALL_TESTS = split("\n", $all_tests); foreach ($ALL_TESTS as $info) { $subpatterns = array(); if (preg_match("/(TEST-)?(XPASS|PASS|XFAIL|FAIL):\s(.+?)\s(.+)/", $info, $subpatterns)) { list($ignore1, $ignore2, $result, $measure, $program) = $subpatterns; + print "$program, $result, $measure, $night_id
\n"; AddTests($program, $result, $measure, $night_id); - } else { - print "Unrecognized test: $info\n"; } } if ($print_debug) { - print "Dejagnu Tests Added\n"; + print "Program Tests Added\n"; } foreach ($DEJAGNUTESTS_RESULTS as $info) { @@ -965,8 +965,8 @@ chdir("$cwd/machines/$machine_id"); WriteFile("$db_date-Build-Log.txt", $build_log); -WriteFile("$db_date-O-files.txt", $o_file_size); -WriteFile("$db_date-A-files.txt", $a_file_size); +// WriteFile("$db_date-O-files.txt", $o_file_size); +// WriteFile("$db_date-A-files.txt", $a_file_size); $sentdata=""; foreach ($_GET as $key => $value) { From jlaskey at apple.com Wed Sep 20 06:09:16 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 20 Sep 2006 06:09:16 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/NightlyTestAccept.php Message-ID: <200609201109.k8KB9G4N018503@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: NightlyTestAccept.php updated: 1.56 -> 1.57 --- Log message: Testing #2 --- Diffs of the changes: (+0 -2) NightlyTestAccept.php | 2 -- 1 files changed, 2 deletions(-) Index: nightlytest-serverside/NightlyTestAccept.php diff -u nightlytest-serverside/NightlyTestAccept.php:1.56 nightlytest-serverside/NightlyTestAccept.php:1.57 --- nightlytest-serverside/NightlyTestAccept.php:1.56 Wed Sep 20 06:05:16 2006 +++ nightlytest-serverside/NightlyTestAccept.php Wed Sep 20 06:09:02 2006 @@ -727,13 +727,11 @@ * Adding test results pass/fail/xfail status to database * *******************************************************************************/ -print "$all_tests

\n"; $ALL_TESTS = split("\n", $all_tests); foreach ($ALL_TESTS as $info) { $subpatterns = array(); if (preg_match("/(TEST-)?(XPASS|PASS|XFAIL|FAIL):\s(.+?)\s(.+)/", $info, $subpatterns)) { list($ignore1, $ignore2, $result, $measure, $program) = $subpatterns; - print "$program, $result, $measure, $night_id
\n"; AddTests($program, $result, $measure, $night_id); } } From jlaskey at apple.com Wed Sep 20 06:31:50 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 20 Sep 2006 06:31:50 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/NightlyTestAccept.php Message-ID: <200609201131.k8KBVogX018982@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: NightlyTestAccept.php updated: 1.57 -> 1.58 --- Log message: Make sure we use the exact machine for id --- Diffs of the changes: (+3 -9) NightlyTestAccept.php | 12 +++--------- 1 files changed, 3 insertions(+), 9 deletions(-) Index: nightlytest-serverside/NightlyTestAccept.php diff -u nightlytest-serverside/NightlyTestAccept.php:1.57 nightlytest-serverside/NightlyTestAccept.php:1.58 --- nightlytest-serverside/NightlyTestAccept.php:1.57 Wed Sep 20 06:09:02 2006 +++ nightlytest-serverside/NightlyTestAccept.php Wed Sep 20 06:31:36 2006 @@ -138,18 +138,13 @@ * *******************************************************************************/ function DoesMachineExist($uname, $hardware, $os, $name, $nickname, $gcc_version) { - $query = "SELECT * FROM machine WHERE uname=\"$uname\" AND nickname=\"$nickname\" AND gcc=\"$gcc_version\""; + $query = "SELECT * FROM machine WHERE uname=\"$uname\" AND hardware=\"$hardware\" AND os=\"$os\" AND nickname=\"$nickname\" AND gcc=\"$gcc_version\""; $machine_query = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_assoc($machine_query); mysql_free_result($machine_query); - if($row && - StringEqual($row['uname'], $uname) && - StringEqual($row['hardware'], $hardware) && - StringEqual($row['os'], $os) && - StringEqual($row['nickname'], $nickname) && - StringEqual($row['gcc'], $gcc_version)) { + if ($row) { return true; } @@ -190,8 +185,7 @@ * *******************************************************************************/ function GetMachineId($uname, $hardware, $os, $name, $nickname, $gcc_version) { - $query = "SELECT * FROM machine WHERE uname=\"$uname\" AND hardware=\"$hardware\" ". - "AND os=\"$os\" AND name=\"$name\" AND gcc=\"$gcc_version\""; + $query = "SELECT * FROM machine WHERE uname=\"$uname\" AND hardware=\"$hardware\" AND os=\"$os\" AND nickname=\"$nickname\" AND gcc=\"$gcc_version\""; $machine_query = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_assoc($machine_query); mysql_free_result($machine_query); From jlaskey at apple.com Wed Sep 20 06:57:39 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 20 Sep 2006 06:57:39 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/SQLUtil.php Message-ID: <200609201157.k8KBvdth019473@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: SQLUtil.php added (r1.1) --- Log message: Clean up test records --- Diffs of the changes: (+47 -0) SQLUtil.php | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 47 insertions(+) Index: nightlytest-serverside/SQLUtil.php diff -c /dev/null nightlytest-serverside/SQLUtil.php:1.1 *** /dev/null Wed Sep 20 06:57:35 2006 --- nightlytest-serverside/SQLUtil.php Wed Sep 20 06:57:25 2006 *************** *** 0 **** --- 1,47 ---- + + + + + + + \n"; + print "NEW: $new

\n"; + $count = $count + 1; + if ($count > 100) { + break; + } + } + } + + mysql_free_result($get_query); + } else { + $error = mysql_error(); + print "$error
\n"; + } + + mysql_close($mysql_link); + + ?> + + + From jlaskey at apple.com Wed Sep 20 07:05:53 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 20 Sep 2006 07:05:53 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/SQLUtil.php Message-ID: <200609201205.k8KC5rlx019669@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: SQLUtil.php updated: 1.1 -> 1.2 --- Log message: Clean up test records #2 --- Diffs of the changes: (+5 -2) SQLUtil.php | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) Index: nightlytest-serverside/SQLUtil.php diff -u nightlytest-serverside/SQLUtil.php:1.1 nightlytest-serverside/SQLUtil.php:1.2 --- nightlytest-serverside/SQLUtil.php:1.1 Wed Sep 20 06:57:25 2006 +++ nightlytest-serverside/SQLUtil.php Wed Sep 20 07:05:38 2006 @@ -24,8 +24,11 @@ if (preg_match("/(.*)\/llvm\/test\/(.*)/", $old, $subpatterns)) { list($ignore, $before, $after) = $subpatterns; $new = "test/".$after; - print "OLD: $old
\n"; - print "NEW: $new

\n"; + $result = $row['result']; + $measure = $row['measure']; + $night = $row['night']; + $set_query = "UPDATE tests SET program=\"$new\" WHERE night=$night AND program=\"$old\" AND result=\"$result\" AND measure=\"$measure\""; + print "$set_query
\n"; $count = $count + 1; if ($count > 100) { break; From jlaskey at apple.com Wed Sep 20 07:12:03 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 20 Sep 2006 07:12:03 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/SQLUtil.php Message-ID: <200609201212.k8KCC3iQ019828@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: SQLUtil.php updated: 1.2 -> 1.3 --- Log message: Clean up test records #3 --- Diffs of the changes: (+4 -7) SQLUtil.php | 11 ++++------- 1 files changed, 4 insertions(+), 7 deletions(-) Index: nightlytest-serverside/SQLUtil.php diff -u nightlytest-serverside/SQLUtil.php:1.2 nightlytest-serverside/SQLUtil.php:1.3 --- nightlytest-serverside/SQLUtil.php:1.2 Wed Sep 20 07:05:38 2006 +++ nightlytest-serverside/SQLUtil.php Wed Sep 20 07:11:49 2006 @@ -17,7 +17,6 @@ $query = "SELECT * FROM tests"; if ($get_query = mysql_query($query)) { - $count = 0; while ($row = mysql_fetch_assoc($get_query)) { $old = $row['program']; $subpatterns = array(); @@ -27,12 +26,9 @@ $result = $row['result']; $measure = $row['measure']; $night = $row['night']; - $set_query = "UPDATE tests SET program=\"$new\" WHERE night=$night AND program=\"$old\" AND result=\"$result\" AND measure=\"$measure\""; - print "$set_query
\n"; - $count = $count + 1; - if ($count > 100) { - break; - } + $query = "UPDATE tests SET program=\"$new\" WHERE night=$night AND program=\"$old\" AND result=\"$result\" AND measure=\"$measure\""; + $set_query = mysql_query($query); + mysql_free_result($set_query); } } @@ -41,6 +37,7 @@ $error = mysql_error(); print "$error
\n"; } + print "DONE
\n"; mysql_close($mysql_link); From jlaskey at apple.com Wed Sep 20 08:04:29 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 20 Sep 2006 08:04:29 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/SQLUtil.php Message-ID: <200609201304.k8KD4T4j020735@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: SQLUtil.php updated: 1.3 -> 1.4 --- Log message: Clean up test records #4 --- Diffs of the changes: (+2 -3) SQLUtil.php | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) Index: nightlytest-serverside/SQLUtil.php diff -u nightlytest-serverside/SQLUtil.php:1.3 nightlytest-serverside/SQLUtil.php:1.4 --- nightlytest-serverside/SQLUtil.php:1.3 Wed Sep 20 07:11:49 2006 +++ nightlytest-serverside/SQLUtil.php Wed Sep 20 08:04:14 2006 @@ -15,7 +15,7 @@ $mysql_link = mysql_connect("127.0.0.1", "llvm", "ll2002vm") or die("Error: could not connect to database!\n"); mysql_select_db("nightlytestresults"); -$query = "SELECT * FROM tests"; +$query = "SELECT * FROM tests WHERE measure=\"dejagnu\""; if ($get_query = mysql_query($query)) { while ($row = mysql_fetch_assoc($get_query)) { $old = $row['program']; @@ -24,9 +24,8 @@ list($ignore, $before, $after) = $subpatterns; $new = "test/".$after; $result = $row['result']; - $measure = $row['measure']; $night = $row['night']; - $query = "UPDATE tests SET program=\"$new\" WHERE night=$night AND program=\"$old\" AND result=\"$result\" AND measure=\"$measure\""; + $query = "UPDATE tests SET program=\"$new\" WHERE night=$night AND program=\"$old\" AND result=\"$result\" AND measure=\"dejagnu\""; $set_query = mysql_query($query); mysql_free_result($set_query); } From jlaskey at apple.com Wed Sep 20 08:08:53 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 20 Sep 2006 08:08:53 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/SQLUtil.php Message-ID: <200609201308.k8KD8rLd020849@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: SQLUtil.php updated: 1.4 -> 1.5 --- Log message: Clean up test records #5 --- Diffs of the changes: (+3 -0) SQLUtil.php | 3 +++ 1 files changed, 3 insertions(+) Index: nightlytest-serverside/SQLUtil.php diff -u nightlytest-serverside/SQLUtil.php:1.4 nightlytest-serverside/SQLUtil.php:1.5 --- nightlytest-serverside/SQLUtil.php:1.4 Wed Sep 20 08:04:14 2006 +++ nightlytest-serverside/SQLUtil.php Wed Sep 20 08:08:38 2006 @@ -17,6 +17,7 @@ $query = "SELECT * FROM tests WHERE measure=\"dejagnu\""; if ($get_query = mysql_query($query)) { + $count = 1; while ($row = mysql_fetch_assoc($get_query)) { $old = $row['program']; $subpatterns = array(); @@ -29,6 +30,8 @@ $set_query = mysql_query($query); mysql_free_result($set_query); } + if (($count % 1000) == 0) print "Count = $count
\n"; + $count++; } mysql_free_result($get_query); From jlaskey at apple.com Wed Sep 20 09:19:09 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 20 Sep 2006 09:19:09 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/SQLUtil.php Message-ID: <200609201419.k8KEJ9ca021990@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: SQLUtil.php updated: 1.5 -> 1.6 --- Log message: Clean up test records #6 --- Diffs of the changes: (+8 -7) SQLUtil.php | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) Index: nightlytest-serverside/SQLUtil.php diff -u nightlytest-serverside/SQLUtil.php:1.5 nightlytest-serverside/SQLUtil.php:1.6 --- nightlytest-serverside/SQLUtil.php:1.5 Wed Sep 20 08:08:38 2006 +++ nightlytest-serverside/SQLUtil.php Wed Sep 20 09:18:54 2006 @@ -20,18 +20,19 @@ $count = 1; while ($row = mysql_fetch_assoc($get_query)) { $old = $row['program']; - $subpatterns = array(); - if (preg_match("/(.*)\/llvm\/test\/(.*)/", $old, $subpatterns)) { - list($ignore, $before, $after) = $subpatterns; + $subpatterns = explode("/llvm/test/", $old, 2); + $new = $subpatterns[1]; + if (isset($new)) { $new = "test/".$after; $result = $row['result']; $night = $row['night']; $query = "UPDATE tests SET program=\"$new\" WHERE night=$night AND program=\"$old\" AND result=\"$result\" AND measure=\"dejagnu\""; - $set_query = mysql_query($query); - mysql_free_result($set_query); + print "$query\n"; +# $set_query = mysql_query($query); +# mysql_free_result($set_query); + $count = $count + 1; + if (($count % 100) == 0) break; } - if (($count % 1000) == 0) print "Count = $count
\n"; - $count++; } mysql_free_result($get_query); From jlaskey at apple.com Wed Sep 20 09:21:02 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 20 Sep 2006 09:21:02 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/SQLUtil.php Message-ID: <200609201421.k8KEL2ft022084@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: SQLUtil.php updated: 1.6 -> 1.7 --- Log message: Clean up test records #6 --- Diffs of the changes: (+3 -2) SQLUtil.php | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: nightlytest-serverside/SQLUtil.php diff -u nightlytest-serverside/SQLUtil.php:1.6 nightlytest-serverside/SQLUtil.php:1.7 --- nightlytest-serverside/SQLUtil.php:1.6 Wed Sep 20 09:18:54 2006 +++ nightlytest-serverside/SQLUtil.php Wed Sep 20 09:20:47 2006 @@ -22,6 +22,7 @@ $old = $row['program']; $subpatterns = explode("/llvm/test/", $old, 2); $new = $subpatterns[1]; + print "$count: $new\n"; if (isset($new)) { $new = "test/".$after; $result = $row['result']; @@ -30,9 +31,9 @@ print "$query\n"; # $set_query = mysql_query($query); # mysql_free_result($set_query); - $count = $count + 1; - if (($count % 100) == 0) break; } + $count = $count + 1; + if (($count % 100) == 0) break; } mysql_free_result($get_query); From alenhar2 at cs.uiuc.edu Wed Sep 20 09:40:34 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Wed, 20 Sep 2006 09:40:34 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/Readme.txt Message-ID: <200609201440.k8KEeYjI018507@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: Readme.txt updated: 1.1 -> 1.2 --- Log message: Add Note --- Diffs of the changes: (+3 -0) Readme.txt | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/lib/Target/Alpha/Readme.txt diff -u llvm/lib/Target/Alpha/Readme.txt:1.1 llvm/lib/Target/Alpha/Readme.txt:1.2 --- llvm/lib/Target/Alpha/Readme.txt:1.1 Sat Jun 3 19:25:51 2006 +++ llvm/lib/Target/Alpha/Readme.txt Wed Sep 20 09:40:01 2006 @@ -1,4 +1,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +Fix cmovs with a constant on the wrong side + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Fix Ordered/Unordered FP stuff From alenhar2 at cs.uiuc.edu Wed Sep 20 09:48:27 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Wed, 20 Sep 2006 09:48:27 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/Readme.txt Message-ID: <200609201448.k8KEmRuS025396@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: Readme.txt updated: 1.2 -> 1.3 --- Log message: clarify with test case --- Diffs of the changes: (+13 -0) Readme.txt | 13 +++++++++++++ 1 files changed, 13 insertions(+) Index: llvm/lib/Target/Alpha/Readme.txt diff -u llvm/lib/Target/Alpha/Readme.txt:1.2 llvm/lib/Target/Alpha/Readme.txt:1.3 --- llvm/lib/Target/Alpha/Readme.txt:1.2 Wed Sep 20 09:40:01 2006 +++ llvm/lib/Target/Alpha/Readme.txt Wed Sep 20 09:48:00 2006 @@ -1,6 +1,19 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Fix cmovs with a constant on the wrong side +aka: + lda $0,10($31) + cmovlt $17,$0,$16 + +is bad for: + +long %cmov_lt2(long %a, long %c) { +entry: + %tmp.1 = setlt long %c, 0 + %retval = select bool %tmp.1, long 10, long %a + ret long %retval +} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Fix Ordered/Unordered FP stuff From jlaskey at apple.com Wed Sep 20 10:00:29 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 20 Sep 2006 10:00:29 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/SQLUtil.php Message-ID: <200609201500.k8KF0TM3022760@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: SQLUtil.php updated: 1.7 -> 1.8 --- Log message: Clean up test records #7 --- Diffs of the changes: (+1 -1) SQLUtil.php | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: nightlytest-serverside/SQLUtil.php diff -u nightlytest-serverside/SQLUtil.php:1.7 nightlytest-serverside/SQLUtil.php:1.8 --- nightlytest-serverside/SQLUtil.php:1.7 Wed Sep 20 09:20:47 2006 +++ nightlytest-serverside/SQLUtil.php Wed Sep 20 10:00:11 2006 @@ -15,7 +15,7 @@ $mysql_link = mysql_connect("127.0.0.1", "llvm", "ll2002vm") or die("Error: could not connect to database!\n"); mysql_select_db("nightlytestresults"); -$query = "SELECT * FROM tests WHERE measure=\"dejagnu\""; +$query = "SELECT * FROM tests WHERE measure=\"dejagnu\" AND program LIKE \"%/llvm/test/%\""; if ($get_query = mysql_query($query)) { $count = 1; while ($row = mysql_fetch_assoc($get_query)) { From alenhar2 at cs.uiuc.edu Wed Sep 20 10:05:21 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Wed, 20 Sep 2006 10:05:21 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Alpha/cmov.ll Message-ID: <200609201505.k8KF5LBE002994@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Alpha: cmov.ll updated: 1.1 -> 1.2 --- Log message: catch another constant --- Diffs of the changes: (+7 -1) cmov.ll | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletion(-) Index: llvm/test/Regression/CodeGen/Alpha/cmov.ll diff -u llvm/test/Regression/CodeGen/Alpha/cmov.ll:1.1 llvm/test/Regression/CodeGen/Alpha/cmov.ll:1.2 --- llvm/test/Regression/CodeGen/Alpha/cmov.ll:1.1 Wed Feb 1 13:36:52 2006 +++ llvm/test/Regression/CodeGen/Alpha/cmov.ll Wed Sep 20 10:04:55 2006 @@ -1,7 +1,7 @@ ; RUN: llvm-as < %s | llc -march=alpha | not grep cmovlt ; RUN: llvm-as < %s | llc -march=alpha | grep cmoveq -long %cmovlt_(long %a, long %c) { +long %cmov_lt(long %a, long %c) { entry: %tmp.1 = setlt long %c, 0 %retval = select bool %tmp.1, long %a, long 10 @@ -15,3 +15,9 @@ ret long %retval } +long %cmov_lt2(long %a, long %c) { +entry: + %tmp.1 = setgt long %c, 0 + %retval = select bool %tmp.1, long 10, long %a + ret long %retval +} From alenhar2 at cs.uiuc.edu Wed Sep 20 10:06:07 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Wed, 20 Sep 2006 10:06:07 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaInstrInfo.td Readme.txt Message-ID: <200609201506.k8KF67cC003018@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaInstrInfo.td updated: 1.124 -> 1.125 Readme.txt updated: 1.3 -> 1.4 --- Log message: catch constants more often --- Diffs of the changes: (+14 -16) AlphaInstrInfo.td | 14 ++++++++++++++ Readme.txt | 16 ---------------- 2 files changed, 14 insertions(+), 16 deletions(-) Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.124 llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.125 --- llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.124 Mon Sep 18 13:01:03 2006 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.td Wed Sep 20 10:05:49 2006 @@ -214,6 +214,20 @@ def : Pat<(select GPRC:$which, GPRC:$src1, immUExt8:$src2), (CMOVEQi GPRC:$src1, immUExt8:$src2, GPRC:$which)>; +//Invert sense when we can for constants: +def : Pat<(select (seteq GPRC:$RCOND, 0), immUExt8:$RFALSE, GPRC:$RTRUE), + (CMOVEQi GPRC:$RTRUE, immUExt8:$RFALSE, GPRC:$RCOND)>; +def : Pat<(select (setne GPRC:$RCOND, 0), immUExt8:$RFALSE, GPRC:$RTRUE), + (CMOVNEi GPRC:$RTRUE, immUExt8:$RFALSE, GPRC:$RCOND)>; +def : Pat<(select (setgt GPRC:$RCOND, 0), immUExt8:$RFALSE, GPRC:$RTRUE), + (CMOVGTi GPRC:$RTRUE, immUExt8:$RFALSE, GPRC:$RCOND)>; +def : Pat<(select (setge GPRC:$RCOND, 0), immUExt8:$RFALSE, GPRC:$RTRUE), + (CMOVGEi GPRC:$RTRUE, immUExt8:$RFALSE, GPRC:$RCOND)>; +def : Pat<(select (setlt GPRC:$RCOND, 0), immUExt8:$RFALSE, GPRC:$RTRUE), + (CMOVLTi GPRC:$RTRUE, immUExt8:$RFALSE, GPRC:$RCOND)>; +def : Pat<(select (setle GPRC:$RCOND, 0), immUExt8:$RFALSE, GPRC:$RTRUE), + (CMOVLEi GPRC:$RTRUE, immUExt8:$RFALSE, GPRC:$RCOND)>; + def ADDL : OForm< 0x10, 0x00, "addl $RA,$RB,$RC", [(set GPRC:$RC, (intop (add GPRC:$RA, GPRC:$RB)))], s_iadd>; Index: llvm/lib/Target/Alpha/Readme.txt diff -u llvm/lib/Target/Alpha/Readme.txt:1.3 llvm/lib/Target/Alpha/Readme.txt:1.4 --- llvm/lib/Target/Alpha/Readme.txt:1.3 Wed Sep 20 09:48:00 2006 +++ llvm/lib/Target/Alpha/Readme.txt Wed Sep 20 10:05:49 2006 @@ -1,20 +1,4 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -Fix cmovs with a constant on the wrong side - -aka: - lda $0,10($31) - cmovlt $17,$0,$16 - -is bad for: - -long %cmov_lt2(long %a, long %c) { -entry: - %tmp.1 = setlt long %c, 0 - %retval = select bool %tmp.1, long 10, long %a - ret long %retval -} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Fix Ordered/Unordered FP stuff From alenhar2 at cs.uiuc.edu Wed Sep 20 10:38:23 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Wed, 20 Sep 2006 10:38:23 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200609201538.k8KFcN0q010955@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.514 -> 1.515 --- Log message: simplify --- Diffs of the changes: (+8 -12) InstructionCombining.cpp | 20 ++++++++------------ 1 files changed, 8 insertions(+), 12 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.514 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.515 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.514 Tue Sep 19 23:44:59 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Wed Sep 20 10:37:57 2006 @@ -1603,18 +1603,14 @@ CI = dyn_cast(RHS); Other = LHS; } - if (CI) { - const Type *UIntPtrTy = TD->getIntPtrType(); - const Type *SIntPtrTy = UIntPtrTy->getSignedVersion(); - if((CI->getType() == UIntPtrTy || CI->getType() == SIntPtrTy) - && isa(CI->getOperand(0)->getType())) { - Instruction* I2 = new CastInst(CI->getOperand(0), - PointerType::get(Type::SByteTy), "ctg", &I); - WorkList.push_back(I2); - I2 = new GetElementPtrInst(I2, Other, "ctg", &I); - WorkList.push_back(I2); - return new CastInst(I2, CI->getType()); - } + if (CI && CI->getType()->isSized() && + (CI->getType()->getPrimitiveSize() == + TD->getIntPtrType()->getPrimitiveSize()) + && isa(CI->getOperand(0)->getType())) { + Value* I2 = InsertCastBefore(CI->getOperand(0), + PointerType::get(Type::SByteTy), I); + I2 = InsertNewInstBefore(new GetElementPtrInst(I2, Other, "ctg2"), I); + return new CastInst(I2, CI->getType()); } } From jlaskey at apple.com Wed Sep 20 11:31:47 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 20 Sep 2006 11:31:47 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/SQLUtil.php Message-ID: <200609201631.k8KGVlN1025224@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: SQLUtil.php updated: 1.8 -> 1.9 --- Log message: Clean up test records #9 --- Diffs of the changes: (+3 -3) SQLUtil.php | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: nightlytest-serverside/SQLUtil.php diff -u nightlytest-serverside/SQLUtil.php:1.8 nightlytest-serverside/SQLUtil.php:1.9 --- nightlytest-serverside/SQLUtil.php:1.8 Wed Sep 20 10:00:11 2006 +++ nightlytest-serverside/SQLUtil.php Wed Sep 20 11:31:32 2006 @@ -29,11 +29,11 @@ $night = $row['night']; $query = "UPDATE tests SET program=\"$new\" WHERE night=$night AND program=\"$old\" AND result=\"$result\" AND measure=\"dejagnu\""; print "$query\n"; -# $set_query = mysql_query($query); -# mysql_free_result($set_query); + $set_query = mysql_query($query); + mysql_free_result($set_query); } $count = $count + 1; - if (($count % 100) == 0) break; + if (($count % 1000) == 0) break; } mysql_free_result($get_query); From jlaskey at apple.com Wed Sep 20 11:44:20 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 20 Sep 2006 11:44:20 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/SQLUtil.php Message-ID: <200609201644.k8KGiKto025564@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: SQLUtil.php updated: 1.9 -> 1.10 --- Log message: Clean up test records #10 --- Diffs of the changes: (+5 -5) SQLUtil.php | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) Index: nightlytest-serverside/SQLUtil.php diff -u nightlytest-serverside/SQLUtil.php:1.9 nightlytest-serverside/SQLUtil.php:1.10 --- nightlytest-serverside/SQLUtil.php:1.9 Wed Sep 20 11:31:32 2006 +++ nightlytest-serverside/SQLUtil.php Wed Sep 20 11:44:06 2006 @@ -15,13 +15,13 @@ $mysql_link = mysql_connect("127.0.0.1", "llvm", "ll2002vm") or die("Error: could not connect to database!\n"); mysql_select_db("nightlytestresults"); -$query = "SELECT * FROM tests WHERE measure=\"dejagnu\" AND program LIKE \"%/llvm/test/%\""; +$query = "SELECT * FROM tests WHERE measure=\"dejagnu\" AND program LIKE \"%%\""; if ($get_query = mysql_query($query)) { $count = 1; while ($row = mysql_fetch_assoc($get_query)) { $old = $row['program']; $subpatterns = explode("/llvm/test/", $old, 2); - $new = $subpatterns[1]; + $after = $subpatterns[1]; print "$count: $new\n"; if (isset($new)) { $new = "test/".$after; @@ -29,11 +29,11 @@ $night = $row['night']; $query = "UPDATE tests SET program=\"$new\" WHERE night=$night AND program=\"$old\" AND result=\"$result\" AND measure=\"dejagnu\""; print "$query\n"; - $set_query = mysql_query($query); - mysql_free_result($set_query); +# $set_query = mysql_query($query); +# mysql_free_result($set_query); } $count = $count + 1; - if (($count % 1000) == 0) break; + if (($count % 100) == 0) break; } mysql_free_result($get_query); From jlaskey at apple.com Wed Sep 20 11:45:51 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 20 Sep 2006 11:45:51 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/SQLUtil.php Message-ID: <200609201645.k8KGjpDW025649@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: SQLUtil.php updated: 1.10 -> 1.11 --- Log message: Clean up test records #11 --- Diffs of the changes: (+3 -3) SQLUtil.php | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: nightlytest-serverside/SQLUtil.php diff -u nightlytest-serverside/SQLUtil.php:1.10 nightlytest-serverside/SQLUtil.php:1.11 --- nightlytest-serverside/SQLUtil.php:1.10 Wed Sep 20 11:44:06 2006 +++ nightlytest-serverside/SQLUtil.php Wed Sep 20 11:45:37 2006 @@ -15,20 +15,20 @@ $mysql_link = mysql_connect("127.0.0.1", "llvm", "ll2002vm") or die("Error: could not connect to database!\n"); mysql_select_db("nightlytestresults"); -$query = "SELECT * FROM tests WHERE measure=\"dejagnu\" AND program LIKE \"%%\""; +$query = "SELECT * FROM tests WHERE measure=\"dejagnu\" AND program LIKE \"%/llvm/test/%\""; if ($get_query = mysql_query($query)) { $count = 1; while ($row = mysql_fetch_assoc($get_query)) { $old = $row['program']; $subpatterns = explode("/llvm/test/", $old, 2); $after = $subpatterns[1]; - print "$count: $new\n"; + print "$count: $new
\n"; if (isset($new)) { $new = "test/".$after; $result = $row['result']; $night = $row['night']; $query = "UPDATE tests SET program=\"$new\" WHERE night=$night AND program=\"$old\" AND result=\"$result\" AND measure=\"dejagnu\""; - print "$query\n"; + print "$query
\n"; # $set_query = mysql_query($query); # mysql_free_result($set_query); } From jlaskey at apple.com Wed Sep 20 11:49:43 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 20 Sep 2006 11:49:43 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/SQLUtil.php Message-ID: <200609201649.k8KGnhJW025766@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: SQLUtil.php updated: 1.11 -> 1.12 --- Log message: Clean up test records #12 --- Diffs of the changes: (+2 -2) SQLUtil.php | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: nightlytest-serverside/SQLUtil.php diff -u nightlytest-serverside/SQLUtil.php:1.11 nightlytest-serverside/SQLUtil.php:1.12 --- nightlytest-serverside/SQLUtil.php:1.11 Wed Sep 20 11:45:37 2006 +++ nightlytest-serverside/SQLUtil.php Wed Sep 20 11:49:28 2006 @@ -22,8 +22,8 @@ $old = $row['program']; $subpatterns = explode("/llvm/test/", $old, 2); $after = $subpatterns[1]; - print "$count: $new
\n"; - if (isset($new)) { + print "$count: $after
\n"; + if (isset($after)) { $new = "test/".$after; $result = $row['result']; $night = $row['night']; From nicholas at mxc.ca Wed Sep 20 12:04:18 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 20 Sep 2006 12:04:18 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Message-ID: <200609201704.k8KH4IMq026095@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: PredicateSimplifier.cpp updated: 1.11 -> 1.12 --- Log message: Use a total ordering to compare instructions. Fixes infinite loop in resolve(). --- Diffs of the changes: (+101 -87) PredicateSimplifier.cpp | 188 +++++++++++++++++++++++++----------------------- 1 files changed, 101 insertions(+), 87 deletions(-) Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.11 llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.12 --- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.11 Mon Sep 18 16:09:35 2006 +++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Wed Sep 20 12:04:01 2006 @@ -49,60 +49,30 @@ Statistic<> NumInstruction("predsimplify", "Number of instructions removed"); - /// Returns true if V1 is a better choice than V2. Note that it is - /// not a total ordering. - struct compare { - bool operator()(Value *V1, Value *V2) const { - if (isa(V1)) { - if (!isa(V2)) { - return true; - } - } else if (isa(V1)) { - if (!isa(V2) && !isa(V2)) { - return true; - } - } - if (User *U = dyn_cast(V2)) { - for (User::const_op_iterator I = U->op_begin(), E = U->op_end(); - I != E; ++I) { - if (*I == V1) { - return true; - } - } - } - return false; - } - }; - - /// Used for choosing the canonical Value in a synonym set. - /// Leaves the better choice in V1. - static void order(Value *&V1, Value *&V2) { - static compare c; - if (c(V2, V1)) - std::swap(V1, V2); - } + class PropertySet; /// Similar to EquivalenceClasses, this stores the set of equivalent - /// types. Beyond EquivalenceClasses, it allows the user to specify - /// which element will act as leader through a StrictWeakOrdering - /// function. - template + /// types. Beyond EquivalenceClasses, it allows us to specify which + /// element will act as leader. + template class VISIBILITY_HIDDEN Synonyms { std::map mapping; std::vector leaders; - StrictWeak swo; + PropertySet *PS; public: typedef unsigned iterator; typedef const unsigned const_iterator; + Synonyms(PropertySet *PS) : PS(PS) {} + // Inspection bool empty() const { return leaders.empty(); } - unsigned countLeaders() const { + typename std::vector::size_type countLeaders() const { return leaders.size(); } @@ -151,50 +121,8 @@ /// Combine two sets referring to the same element, inserting the /// elements as needed. Returns a valid iterator iff two already /// existing disjoint synonym sets were combined. The iterator - /// points to the removed element. - iterator unionSets(ElemTy E1, ElemTy E2) { - if (swo(E2, E1)) std::swap(E1, E2); - - iterator I1 = findLeader(E1), - I2 = findLeader(E2); - - if (!I1 && !I2) { // neither entry is in yet - leaders.push_back(E1); - I1 = leaders.size(); - mapping[E1] = I1; - mapping[E2] = I1; - return 0; - } - - if (!I1 && I2) { - mapping[E1] = I2; - std::swap(getLeader(I2), E1); - return 0; - } - - if (I1 && !I2) { - mapping[E2] = I1; - return 0; - } - - if (I1 == I2) return 0; - - // This is the case where we have two sets, [%a1, %a2, %a3] and - // [%p1, %p2, %p3] and someone says that %a2 == %p3. We need to - // combine the two synsets. - - if (I1 > I2) --I1; - - for (std::map::iterator I = mapping.begin(), - E = mapping.end(); I != E; ++I) { - if (I->second == I2) I->second = I1; - else if (I->second > I2) --I->second; - } - - leaders.erase(leaders.begin() + I2 - 1); - - return I2; - } + /// points to the no longer existing element. + iterator unionSets(ElemTy E1, ElemTy E2); /// Returns an iterator pointing to the synonym set containing /// element e. If none exists, a new one is created and returned. @@ -212,13 +140,51 @@ /// Represents the set of equivalent Value*s and provides insertion /// and fast lookup. Also stores the set of inequality relationships. class PropertySet { + /// Returns true if V1 is a better choice than V2. Note that it is + /// not a total ordering. + bool compare(Value *V1, Value *V2) const { + if (isa(V1)) { + if (!isa(V2)) { + return true; + } + } else if (isa(V1)) { + if (!isa(V2) && !isa(V2)) { + return true; + } + } + if (Instruction *I1 = dyn_cast(V1)) { + if (Instruction *I2 = dyn_cast(V2)) { + BasicBlock *BB1 = I1->getParent(), + *BB2 = I2->getParent(); + if (BB1 == BB2) { + for (BasicBlock::const_iterator I = BB1->begin(), E = BB1->end(); + I != E; ++I) { + if (&*I == I1) return true; + if (&*I == I2) return false; + } + assert(0 && "Instructions not found in parent BasicBlock?"); + } else + return DT->getNode(BB1)->properlyDominates(DT->getNode(BB2)); + } + } + return false; + } + struct Property; public: - class Synonyms union_find; + /// Choose the canonical Value in a synonym set. + /// Leaves the more canonical choice in V1. + void order(Value *&V1, Value *&V2) const { + if (compare(V2, V1)) std::swap(V1, V2); + } + + PropertySet(DominatorTree *DT) : union_find(this), DT(DT) {} + + class Synonyms union_find; typedef std::vector::iterator PropertyIterator; typedef std::vector::const_iterator ConstPropertyIterator; - typedef Synonyms::iterator SynonymIterator; + typedef Synonyms::iterator SynonymIterator; enum Ops { EQ, @@ -231,7 +197,7 @@ } Value *lookup(Value *V) const { - Synonyms::iterator SI = union_find.findLeader(V); + SynonymIterator SI = union_find.findLeader(V); if (!SI) return NULL; return union_find.getLeader(SI); } @@ -313,7 +279,7 @@ // Represents Head OP [Tail1, Tail2, ...] // For example: %x != %a, %x != %b. struct VISIBILITY_HIDDEN Property { - typedef Synonyms::iterator Iter; + typedef SynonymIterator Iter; Property(Ops opcode, Iter i1, Iter i2) : Opcode(opcode), I1(i1), I2(i2) @@ -421,6 +387,7 @@ } } + DominatorTree *DT; public: #ifdef DEBUG void debug(std::ostream &os) const { @@ -484,6 +451,52 @@ RegisterPass X("predsimplify", "Predicate Simplifier"); + + template + typename Synonyms::iterator + Synonyms::unionSets(ElemTy E1, ElemTy E2) { + PS->order(E1, E2); + + iterator I1 = findLeader(E1), + I2 = findLeader(E2); + + if (!I1 && !I2) { // neither entry is in yet + leaders.push_back(E1); + I1 = leaders.size(); + mapping[E1] = I1; + mapping[E2] = I1; + return 0; + } + + if (!I1 && I2) { + mapping[E1] = I2; + std::swap(getLeader(I2), E1); + return 0; + } + + if (I1 && !I2) { + mapping[E2] = I1; + return 0; + } + + if (I1 == I2) return 0; + + // This is the case where we have two sets, [%a1, %a2, %a3] and + // [%p1, %p2, %p3] and someone says that %a2 == %p3. We need to + // combine the two synsets. + + if (I1 > I2) --I1; + + for (std::map::iterator I = mapping.begin(), + E = mapping.end(); I != E; ++I) { + if (I->second == I2) I->second = I1; + else if (I->second > I2) --I->second; + } + + leaders.erase(leaders.begin() + I2 - 1); + + return I2; + } } FunctionPass *llvm::createPredicateSimplifierPass() { @@ -494,7 +507,7 @@ DT = &getAnalysis(); modified = false; - PropertySet KnownProperties; + PropertySet KnownProperties(DT); visitBasicBlock(DT->getRootNode()->getBlock(), KnownProperties); return modified; } @@ -614,6 +627,7 @@ if (V != I) { modified = true; ++NumInstruction; + DEBUG(std::cerr << "Removing " << *I); I->replaceAllUsesWith(V); I->eraseFromParent(); return; From nicholas at mxc.ca Wed Sep 20 12:04:18 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 20 Sep 2006 12:04:18 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/PredicateSimplifier/2006-09-20-ResolveCycle.ll Message-ID: <200609201704.k8KH4IGh026092@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/PredicateSimplifier: 2006-09-20-ResolveCycle.ll added (r1.1) --- Log message: Use a total ordering to compare instructions. Fixes infinite loop in resolve(). --- Diffs of the changes: (+28 -0) 2006-09-20-ResolveCycle.ll | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+) Index: llvm/test/Regression/Transforms/PredicateSimplifier/2006-09-20-ResolveCycle.ll diff -c /dev/null llvm/test/Regression/Transforms/PredicateSimplifier/2006-09-20-ResolveCycle.ll:1.1 *** /dev/null Wed Sep 20 12:04:11 2006 --- llvm/test/Regression/Transforms/PredicateSimplifier/2006-09-20-ResolveCycle.ll Wed Sep 20 12:04:01 2006 *************** *** 0 **** --- 1,28 ---- + ; RUN: llvm-as < %s | opt -predsimplify -disable-output + + void %gs_image_next() { + entry: + %tmp = load uint* null ; [#uses=2] + br bool false, label %cond_next21, label %UnifiedReturnBlock + + cond_next21: ; preds = %entry + br bool false, label %cond_next42, label %UnifiedReturnBlock + + cond_next42: ; preds = %cond_next21 + br label %cond_true158 + + cond_next134: ; preds = %cond_true158 + %tmp1571 = seteq uint 0, %min ; [#uses=0] + ret void + + cond_true158: ; preds = %cond_true158, %cond_next42 + %tmp47 = sub uint %tmp, 0 ; [#uses=2] + %tmp49 = setle uint %tmp47, 0 ; [#uses=1] + %min = select bool %tmp49, uint %tmp47, uint 0 ; [#uses=2] + %tmp92 = add uint %min, 0 ; [#uses=1] + %tmp101 = seteq uint %tmp92, %tmp ; [#uses=1] + br bool %tmp101, label %cond_next134, label %cond_true158 + + UnifiedReturnBlock: ; preds = %cond_next21, %entry + ret void + } From sabre at nondot.org Wed Sep 20 12:07:29 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 20 Sep 2006 12:07:29 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Message-ID: <200609201707.k8KH7Tc1026210@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCAsmPrinter.cpp updated: 1.194 -> 1.195 --- Log message: Wrap some darwin'isms with isDarwin checks. --- Diffs of the changes: (+7 -4) PPCAsmPrinter.cpp | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.194 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.195 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.194 Thu Sep 7 17:06:40 2006 +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Wed Sep 20 12:07:15 2006 @@ -49,9 +49,11 @@ struct VISIBILITY_HIDDEN PPCAsmPrinter : public AsmPrinter { std::set FnStubs, GVStubs; + const PPCSubtarget &Subtarget; PPCAsmPrinter(std::ostream &O, TargetMachine &TM, const TargetAsmInfo *T) - : AsmPrinter(O, TM, T) {} + : AsmPrinter(O, TM, T), Subtarget(TM.getSubtarget()) { + } virtual const char *getPassName() const { return "PowerPC Assembly Printer"; @@ -248,7 +250,7 @@ DarwinAsmPrinter(std::ostream &O, PPCTargetMachine &TM, const TargetAsmInfo *T) : PPCAsmPrinter(O, TM, T), DW(O, this, T) { - bool isPPC64 = TM.getSubtargetImpl()->isPPC64(); + bool isPPC64 = Subtarget.isPPC64(); } virtual const char *getPassName() const { @@ -480,7 +482,7 @@ bool DarwinAsmPrinter::doInitialization(Module &M) { - if (TM.getSubtarget().isGigaProcessor()) + if (Subtarget.isGigaProcessor()) O << "\t.machine ppc970\n"; AsmPrinter::doInitialization(M); @@ -637,7 +639,8 @@ // implementation of multiple entry points). If this doesn't occur, the // 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"; + if (Subtarget.isDarwin()) + O << "\t.subsections_via_symbols\n"; AsmPrinter::doFinalization(M); return false; // success From sabre at nondot.org Wed Sep 20 12:12:33 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 20 Sep 2006 12:12:33 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC.h PPCAsmPrinter.cpp PPCTargetMachine.cpp Message-ID: <200609201712.k8KHCXLF026352@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPC.h updated: 1.33 -> 1.34 PPCAsmPrinter.cpp updated: 1.195 -> 1.196 PPCTargetMachine.cpp updated: 1.106 -> 1.107 --- Log message: The DarwinAsmPrinter need not check for isDarwin. createPPCAsmPrinterPass should create the right asmprinter subclass. --- Diffs of the changes: (+15 -14) PPC.h | 4 ++-- PPCAsmPrinter.cpp | 23 ++++++++++++----------- PPCTargetMachine.cpp | 2 +- 3 files changed, 15 insertions(+), 14 deletions(-) Index: llvm/lib/Target/PowerPC/PPC.h diff -u llvm/lib/Target/PowerPC/PPC.h:1.33 llvm/lib/Target/PowerPC/PPC.h:1.34 --- llvm/lib/Target/PowerPC/PPC.h:1.33 Wed Sep 6 13:34:40 2006 +++ llvm/lib/Target/PowerPC/PPC.h Wed Sep 20 12:12:19 2006 @@ -26,8 +26,8 @@ FunctionPass *createPPCBranchSelectionPass(); FunctionPass *createPPCISelDag(PPCTargetMachine &TM); -FunctionPass *createDarwinCodePrinterPass(std::ostream &OS, - PPCTargetMachine &TM); +FunctionPass *createPPCAsmPrinterPass(std::ostream &OS, + PPCTargetMachine &TM); FunctionPass *createPPCCodeEmitterPass(PPCTargetMachine &TM, MachineCodeEmitter &MCE); void addPPCMachOObjectWriterPass(FunctionPassManager &FPM, std::ostream &o, Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.195 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.196 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.195 Wed Sep 20 12:07:15 2006 +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Wed Sep 20 12:12:19 2006 @@ -270,15 +270,6 @@ }; } // end of anonymous namespace -/// createDarwinCodePrinterPass - Returns a pass that prints the PPC assembly -/// code for a MachineFunction to the given output stream, in a format that the -/// Darwin assembler can deal with. -/// -FunctionPass *llvm::createDarwinCodePrinterPass(std::ostream &o, - PPCTargetMachine &tm) { - return new DarwinAsmPrinter(o, tm, tm.getTargetAsmInfo()); -} - // Include the auto-generated portion of the assembly writer #include "PPCGenAsmWriter.inc" @@ -639,10 +630,20 @@ // implementation of multiple entry points). If this doesn't occur, the // linker can safely perform dead code stripping. Since LLVM never generates // code that does this, it is always safe to set. - if (Subtarget.isDarwin()) - O << "\t.subsections_via_symbols\n"; + O << "\t.subsections_via_symbols\n"; AsmPrinter::doFinalization(M); return false; // success } + + +/// createDarwinCodePrinterPass - Returns a pass that prints the PPC assembly +/// code for a MachineFunction to the given output stream, in a format that the +/// Darwin assembler can deal with. +/// +FunctionPass *llvm::createPPCAsmPrinterPass(std::ostream &o, + PPCTargetMachine &tm) { + return new DarwinAsmPrinter(o, tm, tm.getTargetAsmInfo()); +} + Index: llvm/lib/Target/PowerPC/PPCTargetMachine.cpp diff -u llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.106 llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.107 --- llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.106 Thu Sep 7 22:42:15 2006 +++ llvm/lib/Target/PowerPC/PPCTargetMachine.cpp Wed Sep 20 12:12:19 2006 @@ -122,7 +122,7 @@ bool PPCTargetMachine::addAssemblyEmitter(FunctionPassManager &PM, bool Fast, std::ostream &Out) { - PM.add(createDarwinCodePrinterPass(Out, *this)); + PM.add(createPPCAsmPrinterPass(Out, *this)); return false; } From jlaskey at apple.com Wed Sep 20 12:14:39 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 20 Sep 2006 12:14:39 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/SQLUtil.php Message-ID: <200609201714.k8KHEdsE026456@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: SQLUtil.php updated: 1.12 -> 1.13 --- Log message: Clean up test records #13 --- Diffs of the changes: (+3 -4) SQLUtil.php | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) Index: nightlytest-serverside/SQLUtil.php diff -u nightlytest-serverside/SQLUtil.php:1.12 nightlytest-serverside/SQLUtil.php:1.13 --- nightlytest-serverside/SQLUtil.php:1.12 Wed Sep 20 11:49:28 2006 +++ nightlytest-serverside/SQLUtil.php Wed Sep 20 12:14:24 2006 @@ -28,12 +28,11 @@ $result = $row['result']; $night = $row['night']; $query = "UPDATE tests SET program=\"$new\" WHERE night=$night AND program=\"$old\" AND result=\"$result\" AND measure=\"dejagnu\""; - print "$query
\n"; -# $set_query = mysql_query($query); -# mysql_free_result($set_query); + $set_query = mysql_query($query); + mysql_free_result($set_query); } $count = $count + 1; - if (($count % 100) == 0) break; + if (($count % 1000) == 0) break; } mysql_free_result($get_query); From jlaskey at apple.com Wed Sep 20 13:05:50 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 20 Sep 2006 13:05:50 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/SQLUtil.php Message-ID: <200609201805.k8KI5o9O028362@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: SQLUtil.php updated: 1.13 -> 1.14 --- Log message: Clean up test records #14 --- Diffs of the changes: (+0 -1) SQLUtil.php | 1 - 1 files changed, 1 deletion(-) Index: nightlytest-serverside/SQLUtil.php diff -u nightlytest-serverside/SQLUtil.php:1.13 nightlytest-serverside/SQLUtil.php:1.14 --- nightlytest-serverside/SQLUtil.php:1.13 Wed Sep 20 12:14:24 2006 +++ nightlytest-serverside/SQLUtil.php Wed Sep 20 13:05:35 2006 @@ -22,7 +22,6 @@ $old = $row['program']; $subpatterns = explode("/llvm/test/", $old, 2); $after = $subpatterns[1]; - print "$count: $after
\n"; if (isset($after)) { $new = "test/".$after; $result = $row['result']; From jlaskey at apple.com Wed Sep 20 13:48:06 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 20 Sep 2006 13:48:06 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/SQLQuery.php Message-ID: <200609201848.k8KIm6XC029120@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: SQLQuery.php updated: 1.8 -> 1.9 --- Log message: Allow multiple queries --- Diffs of the changes: (+1 -1) SQLQuery.php | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: nightlytest-serverside/SQLQuery.php diff -u nightlytest-serverside/SQLQuery.php:1.8 nightlytest-serverside/SQLQuery.php:1.9 --- nightlytest-serverside/SQLQuery.php:1.8 Tue Sep 19 12:52:13 2006 +++ nightlytest-serverside/SQLQuery.php Wed Sep 20 13:47:52 2006 @@ -41,7 +41,7 @@ if ($was_query) { $queries = split("\n", $queries); - $mysql_link = mysql_connect("127.0.0.1", $user, $password) or die("Error: could not connect to database!\n"); + $mysql_link = mysql_connect("127.0.0.1", $user, $password, false, CLIENT_MULTI_STATEMENTS) or die("Error: could not connect to database!\n"); mysql_select_db("nightlytestresults"); foreach ($queries as $query) { From llvm at cs.uiuc.edu Wed Sep 20 14:17:24 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 20 Sep 2006 14:17:24 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/SQLUtil.php Message-ID: <200609201917.k8KJHORH029916@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: SQLUtil.php (r1.14) removed --- Log message: not needed --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Sep 20 14:30:28 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 20 Sep 2006 14:30:28 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/NightlyTestAccept.cgi Message-ID: <200609201930.k8KJUSa7030286@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: NightlyTestAccept.cgi (r1.58) removed --- Log message: force testers to switch --- Diffs of the changes: (+0 -0) 0 files changed From alenhar2 at cs.uiuc.edu Wed Sep 20 15:09:08 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Wed, 20 Sep 2006 15:09:08 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaLLRP.cpp Message-ID: <200609202009.k8KK98Bs031050@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaLLRP.cpp updated: 1.1 -> 1.2 --- Log message: Account for pseudo-ops correctly --- Diffs of the changes: (+51 -44) AlphaLLRP.cpp | 95 +++++++++++++++++++++++++++++++--------------------------- 1 files changed, 51 insertions(+), 44 deletions(-) Index: llvm/lib/Target/Alpha/AlphaLLRP.cpp diff -u llvm/lib/Target/Alpha/AlphaLLRP.cpp:1.1 llvm/lib/Target/Alpha/AlphaLLRP.cpp:1.2 --- llvm/lib/Target/Alpha/AlphaLLRP.cpp:1.1 Mon Sep 18 14:44:29 2006 +++ llvm/lib/Target/Alpha/AlphaLLRP.cpp Wed Sep 20 15:08:52 2006 @@ -58,7 +58,6 @@ case Alpha::LDQ: case Alpha::LDL: case Alpha::LDWU: case Alpha::LDBU: case Alpha::LDT: case Alpha::LDS: - case Alpha::STQ: case Alpha::STL: case Alpha::STW: case Alpha::STB: case Alpha::STT: case Alpha::STS: @@ -89,49 +88,57 @@ Changed = true; nopintro += 2; count += 2; } else if (prev[2] - && prev[2]->getOperand(2).getReg() == - MI->getOperand(2).getReg() - && prev[2]->getOperand(1).getImmedValue() == - MI->getOperand(1).getImmedValue()) { - prev[0] = prev[1] = prev[2] = 0; - BuildMI(MBB, MI, Alpha::BIS, 2, Alpha::R31).addReg(Alpha::R31) - .addReg(Alpha::R31); - BuildMI(MBB, MI, Alpha::BIS, 2, Alpha::R31).addReg(Alpha::R31) - .addReg(Alpha::R31); - BuildMI(MBB, MI, Alpha::BIS, 2, Alpha::R31).addReg(Alpha::R31) - .addReg(Alpha::R31); - Changed = true; nopintro += 3; - count += 3; - } - prev[0] = prev[1]; - prev[1] = prev[2]; - prev[2] = MI; - break; - } - //fall through - case Alpha::BR: - case Alpha::JMP: - ub = true; - //fall through - default: - prev[0] = prev[1]; - prev[1] = prev[2]; - prev[2] = 0; - break; - } - } - if (ub || AlignAll) { - //we can align stuff for free at this point - while (count % 4) { - BuildMI(MBB, MBB.end(), Alpha::BIS, 2, Alpha::R31) - .addReg(Alpha::R31).addReg(Alpha::R31); - ++count; - ++nopalign; - prev[0] = prev[1]; - prev[1] = prev[2]; - prev[2] = 0; - } - } + && prev[2]->getOperand(2).getReg() == + MI->getOperand(2).getReg() + && prev[2]->getOperand(1).getImmedValue() == + MI->getOperand(1).getImmedValue()) { + prev[0] = prev[1] = prev[2] = 0; + BuildMI(MBB, MI, Alpha::BIS, 2, Alpha::R31).addReg(Alpha::R31) + .addReg(Alpha::R31); + BuildMI(MBB, MI, Alpha::BIS, 2, Alpha::R31).addReg(Alpha::R31) + .addReg(Alpha::R31); + BuildMI(MBB, MI, Alpha::BIS, 2, Alpha::R31).addReg(Alpha::R31) + .addReg(Alpha::R31); + Changed = true; nopintro += 3; + count += 3; + } + prev[0] = prev[1]; + prev[1] = prev[2]; + prev[2] = MI; + break; + } + prev[0] = prev[1]; + prev[1] = prev[2]; + prev[2] = 0; + break; + case Alpha::ALTENT: + case Alpha::MEMLABEL: + case Alpha::PCLABEL: + --count; + break; + case Alpha::BR: + case Alpha::JMP: + ub = true; + //fall through + default: + prev[0] = prev[1]; + prev[1] = prev[2]; + prev[2] = 0; + break; + } + } + if (ub || AlignAll) { + //we can align stuff for free at this point + while (count % 4) { + BuildMI(MBB, MBB.end(), Alpha::BIS, 2, Alpha::R31) + .addReg(Alpha::R31).addReg(Alpha::R31); + ++count; + ++nopalign; + prev[0] = prev[1]; + prev[1] = prev[2]; + prev[2] = 0; + } + } } return Changed; } From asl at math.spbu.ru Wed Sep 20 17:04:07 2006 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 20 Sep 2006 17:04:07 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp Message-ID: <200609202204.k8KM47F7000654@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: AsmWriter.cpp updated: 1.205 -> 1.206 --- Log message: Adding codegeneration for StdCall & FastCall calling conventions --- Diffs of the changes: (+9 -3) AsmWriter.cpp | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) Index: llvm/lib/VMCore/AsmWriter.cpp diff -u llvm/lib/VMCore/AsmWriter.cpp:1.205 llvm/lib/VMCore/AsmWriter.cpp:1.206 --- llvm/lib/VMCore/AsmWriter.cpp:1.205 Thu Sep 14 13:23:27 2006 +++ llvm/lib/VMCore/AsmWriter.cpp Wed Sep 20 17:03:51 2006 @@ -967,9 +967,11 @@ // Print the calling convention. switch (F->getCallingConv()) { case CallingConv::C: break; // default - case CallingConv::CSRet: Out << "csretcc "; break; - case CallingConv::Fast: Out << "fastcc "; break; - case CallingConv::Cold: Out << "coldcc "; break; + case CallingConv::CSRet: Out << "csretcc "; break; + case CallingConv::Fast: Out << "fastcc "; break; + case CallingConv::Cold: Out << "coldcc "; break; + case CallingConv::X86_StdCall: Out << "x86_stdcallcc "; break; + case CallingConv::X86_FastCall: Out << "x86_fastcallcc "; break; default: Out << "cc" << F->getCallingConv() << " "; break; } @@ -1159,6 +1161,8 @@ case CallingConv::CSRet: Out << " csretcc"; break; case CallingConv::Fast: Out << " fastcc"; break; case CallingConv::Cold: Out << " coldcc"; break; + case CallingConv::X86_StdCall: Out << "x86_stdcallcc "; break; + case CallingConv::X86_FastCall: Out << "x86_fastcallcc "; break; default: Out << " cc" << CI->getCallingConv(); break; } @@ -1197,6 +1201,8 @@ case CallingConv::CSRet: Out << " csretcc"; break; case CallingConv::Fast: Out << " fastcc"; break; case CallingConv::Cold: Out << " coldcc"; break; + case CallingConv::X86_StdCall: Out << "x86_stdcallcc "; break; + case CallingConv::X86_FastCall: Out << "x86_fastcallcc "; break; default: Out << " cc" << II->getCallingConv(); break; } From asl at math.spbu.ru Wed Sep 20 17:04:05 2006 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 20 Sep 2006 17:04:05 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp X86AsmPrinter.cpp X86AsmPrinter.h X86ISelLowering.cpp X86ISelLowering.h X86IntelAsmPrinter.cpp X86MachineFunctionInfo.h Message-ID: <200609202204.k8KM45BG000649@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ATTAsmPrinter.cpp updated: 1.63 -> 1.64 X86AsmPrinter.cpp updated: 1.198 -> 1.199 X86AsmPrinter.h updated: 1.31 -> 1.32 X86ISelLowering.cpp updated: 1.261 -> 1.262 X86ISelLowering.h updated: 1.72 -> 1.73 X86IntelAsmPrinter.cpp updated: 1.56 -> 1.57 X86MachineFunctionInfo.h updated: 1.2 -> 1.3 --- Log message: Adding codegeneration for StdCall & FastCall calling conventions --- Diffs of the changes: (+771 -68) X86ATTAsmPrinter.cpp | 22 + X86AsmPrinter.cpp | 88 ++++++ X86AsmPrinter.h | 18 + X86ISelLowering.cpp | 621 +++++++++++++++++++++++++++++++++++++++++++---- X86ISelLowering.h | 10 X86IntelAsmPrinter.cpp | 41 ++- X86MachineFunctionInfo.h | 39 ++ 7 files changed, 771 insertions(+), 68 deletions(-) Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.63 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.64 --- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.63 Sun Sep 17 15:25:45 2006 +++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Wed Sep 20 17:03:51 2006 @@ -15,8 +15,10 @@ #include "X86ATTAsmPrinter.h" #include "X86.h" +#include "X86MachineFunctionInfo.h" #include "X86TargetMachine.h" #include "X86TargetAsmInfo.h" +#include "llvm/CallingConv.h" #include "llvm/Module.h" #include "llvm/Support/Mangler.h" #include "llvm/Target/TargetAsmInfo.h" @@ -42,6 +44,16 @@ // Print out labels for the function. const Function *F = MF.getFunction(); + unsigned CC = F->getCallingConv(); + + // Populate function information map. Actually, We don't want to populate + // non-stdcall or non-fastcall functions' information right now. + if (CC == CallingConv::X86_StdCall || CC == CallingConv::X86_FastCall) { + FunctionInfoMap[F] = *(MF.getInfo()); + } + + X86SharedAsmPrinter::decorateName(CurrentFnName, F); + switch (F->getLinkage()) { default: assert(0 && "Unknown linkage type!"); case Function::InternalLinkage: // Symbols default to internal. @@ -182,11 +194,14 @@ bool isMemOp = Modifier && !strcmp(Modifier, "mem"); if (!isMemOp && !isCallOp) O << '$'; - GlobalValue *GV = MO.getGlobal(); + GlobalValue *GV = MO.getGlobal(); std::string Name = Mang->getValueName(GV); bool isExt = (GV->isExternal() || GV->hasWeakLinkage() || GV->hasLinkOnceLinkage()); + + X86SharedAsmPrinter::decorateName(Name, (Function*)GV); + if (X86PICStyle == PICStyle::Stub && TM.getRelocationModel() != Reloc::Static) { // Link-once, External, or Weakly-linked global variables need @@ -202,8 +217,6 @@ } } else { if (GV->hasDLLImportLinkage()) { - // FIXME: This should be fixed with full support of stdcall & fastcall - // CC's O << "__imp_"; } O << Name; @@ -213,12 +226,9 @@ O << "-\"L" << getFunctionNumber() << "$pb\""; } else { if (GV->hasDLLImportLinkage()) { - // FIXME: This should be fixed with full support of stdcall & fastcall - // CC's O << "__imp_"; } O << Name; - } int Offset = MO.getOffset(); Index: llvm/lib/Target/X86/X86AsmPrinter.cpp diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.198 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.199 --- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.198 Sun Sep 17 15:25:45 2006 +++ llvm/lib/Target/X86/X86AsmPrinter.cpp Wed Sep 20 17:03:51 2006 @@ -17,18 +17,106 @@ #include "X86AsmPrinter.h" #include "X86ATTAsmPrinter.h" #include "X86IntelAsmPrinter.h" +#include "X86MachineFunctionInfo.h" #include "X86Subtarget.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/CallingConv.h" #include "llvm/Constants.h" #include "llvm/Module.h" #include "llvm/Type.h" #include "llvm/Assembly/Writer.h" #include "llvm/Support/Mangler.h" #include "llvm/Target/TargetAsmInfo.h" + using namespace llvm; Statistic<> llvm::EmittedInsts("asm-printer", "Number of machine instrs printed"); +static X86FunctionInfo calculateFunctionInfo(const Function* F, + const TargetData* TD) +{ + X86FunctionInfo Info; + uint64_t size = 0; + + switch (F->getCallingConv()) { + case CallingConv::X86_StdCall: + Info.setDecorationStyle(StdCall); + break; + case CallingConv::X86_FastCall: + Info.setDecorationStyle(FastCall); + break; + default: + return Info; + } + + for (Function::const_arg_iterator AI = F->arg_begin(), + AE = F->arg_end(); + AI != AE; + ++AI) { + size += TD->getTypeSize(AI->getType()); + } + + // We're not supporting tooooo huge arguments :) + Info.setBytesToPopOnReturn((unsigned int)size); + + return Info; +} + + +// Query FunctionInfoMap and use this information for various name decoration +void X86SharedAsmPrinter::decorateName(std::string& Name, const GlobalValue* GV) +{ + const X86FunctionInfo* Info; + const Function* F; + + if ((F = dyn_cast(GV)) == NULL) { + return; + } + + unsigned CC = F->getCallingConv(); + + // We don't want to decorate non-stdcall or non-fastcall functions right now + if (CC != CallingConv::X86_StdCall && CC != CallingConv::X86_FastCall) { + return; + } + + FMFInfoMap::const_iterator info_item = FunctionInfoMap.find(F); + + if (info_item == FunctionInfoMap.end()) { + // Calculate apropriate function info and populate map + FunctionInfoMap[F] = calculateFunctionInfo(F, TM.getTargetData()); + Info = &FunctionInfoMap[F]; + } else { + Info = &(info_item->second); + } + + switch (Info->getDecorationStyle()) { + case None: + break; + case StdCall: + if (!F->isVarArg()) { + // Variadic functions do not receive @0 suffix + Name += '@' + utostr_32(Info->getBytesToPopOnReturn()); + } + break; + case FastCall: + if (!F->isVarArg()) { + // Variadic functions do not receive @0 suffix + Name += '@' + utostr_32(Info->getBytesToPopOnReturn()); + } + if (Name[0] == '_') { + Name[0] = '@'; + } else { + Name = '@' + Name; + } + break; + default: + assert(0 && "Unsupported DecorationStyle"); + } + +} + /// doInitialization bool X86SharedAsmPrinter::doInitialization(Module &M) { if (Subtarget->isTargetDarwin()) { Index: llvm/lib/Target/X86/X86AsmPrinter.h diff -u llvm/lib/Target/X86/X86AsmPrinter.h:1.31 llvm/lib/Target/X86/X86AsmPrinter.h:1.32 --- llvm/lib/Target/X86/X86AsmPrinter.h:1.31 Thu Sep 14 13:23:27 2006 +++ llvm/lib/Target/X86/X86AsmPrinter.h Wed Sep 20 17:03:51 2006 @@ -17,6 +17,7 @@ #define X86ASMPRINTER_H #include "X86.h" +#include "X86MachineFunctionInfo.h" #include "X86TargetMachine.h" #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/DwarfWriter.h" @@ -45,6 +46,23 @@ Subtarget = &TM.getSubtarget(); } + typedef std::map FMFInfoMap ; + + // We have to propagate some information about MachineFunction to + // AsmPrinter. It's ok, when we're printing the function, since we have + // access to MachineFunction and can get the appropriate MachineFunctionInfo. + // Unfortunately, this is not possible when we're printing reference to + // Function (e.g. calling it and so on). Even more, there is no way to get the + // corresponding MachineFunctions: it can even be not created at all. That's + // why we should use additional structure, when we're collecting all necessary + // information. + + // This structure is using e.g. for name decoration for stdcall & fastcall'ed + // function, since we have to use arguments' size for decoration. + FMFInfoMap FunctionInfoMap; + + void decorateName(std::string& Name, const GlobalValue* GV); + bool doInitialization(Module &M); bool doFinalization(Module &M); Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.261 llvm/lib/Target/X86/X86ISelLowering.cpp:1.262 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.261 Sun Sep 17 15:25:45 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Wed Sep 20 17:03:51 2006 @@ -1523,7 +1523,9 @@ return DAG.getNode(ISD::MERGE_VALUES, RetVTs, &ArgValues[0],ArgValues.size()); } -SDOperand X86TargetLowering::LowerFastCCCallTo(SDOperand Op, SelectionDAG &DAG){ +SDOperand X86TargetLowering::LowerFastCCCallTo(SDOperand Op, + SelectionDAG &DAG, + bool isFastCall){ SDOperand Chain = Op.getOperand(0); unsigned CallingConv= cast(Op.getOperand(1))->getValue(); bool isVarArg = cast(Op.getOperand(2))->getValue() != 0; @@ -1546,6 +1548,11 @@ { X86::AX, X86::DX }, { X86::EAX, X86::EDX } }; + static const unsigned FastCallGPRArgRegs[][2] = { + { X86::CL, X86::DL }, + { X86::CX, X86::DX }, + { X86::ECX, X86::EDX } + }; static const unsigned XMMArgRegs[] = { X86::XMM0, X86::XMM1, X86::XMM2, X86::XMM3 }; @@ -1558,12 +1565,11 @@ case MVT::i8: case MVT::i16: case MVT::i32: -#if FASTCC_NUM_INT_ARGS_INREGS > 0 - if (NumIntRegs < FASTCC_NUM_INT_ARGS_INREGS) { - ++NumIntRegs; - break; - } -#endif + unsigned MaxNumIntRegs = (isFastCall ? 2 : FASTCC_NUM_INT_ARGS_INREGS); + if (NumIntRegs < MaxNumIntRegs) { + ++NumIntRegs; + break; + } // Fall through case MVT::f32: NumBytes += 4; @@ -1577,14 +1583,18 @@ case MVT::v2i64: case MVT::v4f32: case MVT::v2f64: - if (NumXMMRegs < 4) - NumXMMRegs++; - else { - // XMM arguments have to be aligned on 16-byte boundary. - NumBytes = ((NumBytes + 15) / 16) * 16; - NumBytes += 16; - } - break; + if (isFastCall) { + assert(0 && "Unknown value type!"); + } else { + if (NumXMMRegs < 4) + NumXMMRegs++; + else { + // XMM arguments have to be aligned on 16-byte boundary. + NumBytes = ((NumBytes + 15) / 16) * 16; + NumBytes += 16; + } + } + break; } } @@ -1609,15 +1619,14 @@ case MVT::i8: case MVT::i16: case MVT::i32: -#if FASTCC_NUM_INT_ARGS_INREGS > 0 - if (NumIntRegs < FASTCC_NUM_INT_ARGS_INREGS) { - RegsToPass.push_back( - std::make_pair(GPRArgRegs[Arg.getValueType()-MVT::i8][NumIntRegs], - Arg)); - ++NumIntRegs; - break; - } -#endif + unsigned MaxNumIntRegs = (isFastCall ? 2 : FASTCC_NUM_INT_ARGS_INREGS); + if (NumIntRegs < MaxNumIntRegs) { + RegsToPass.push_back( + std::make_pair(GPRArgRegs[Arg.getValueType()-MVT::i8][NumIntRegs], + Arg)); + ++NumIntRegs; + break; + } // Fall through case MVT::f32: { SDOperand PtrOff = DAG.getConstant(ArgOffset, getPointerTy()); @@ -1641,18 +1650,23 @@ case MVT::v2i64: case MVT::v4f32: case MVT::v2f64: - if (NumXMMRegs < 4) { - RegsToPass.push_back(std::make_pair(XMMArgRegs[NumXMMRegs], Arg)); - NumXMMRegs++; - } else { - // XMM arguments have to be aligned on 16-byte boundary. - ArgOffset = ((ArgOffset + 15) / 16) * 16; - SDOperand PtrOff = DAG.getConstant(ArgOffset, getPointerTy()); - PtrOff = DAG.getNode(ISD::ADD, getPointerTy(), StackPtr, PtrOff); - MemOpChains.push_back(DAG.getNode(ISD::STORE, MVT::Other, Chain, - Arg, PtrOff, DAG.getSrcValue(NULL))); - ArgOffset += 16; - } + if (isFastCall) { + assert(0 && "Unexpected ValueType for argument!"); + } else { + if (NumXMMRegs < 4) { + RegsToPass.push_back(std::make_pair(XMMArgRegs[NumXMMRegs], Arg)); + NumXMMRegs++; + } else { + // XMM arguments have to be aligned on 16-byte boundary. + ArgOffset = ((ArgOffset + 15) / 16) * 16; + SDOperand PtrOff = DAG.getConstant(ArgOffset, getPointerTy()); + PtrOff = DAG.getNode(ISD::ADD, getPointerTy(), StackPtr, PtrOff); + MemOpChains.push_back(DAG.getNode(ISD::STORE, MVT::Other, Chain, + Arg, PtrOff, DAG.getSrcValue(NULL))); + ArgOffset += 16; + } + } + break; } } @@ -1745,10 +1759,14 @@ case MVT::v2i64: case MVT::v4f32: case MVT::v2f64: - Chain = DAG.getCopyFromReg(Chain, X86::XMM0, RetVT, InFlag).getValue(1); - ResultVals.push_back(Chain.getValue(0)); - NodeTys.push_back(RetVT); - break; + if (isFastCall) { + assert(0 && "Unknown value type to return!"); + } else { + Chain = DAG.getCopyFromReg(Chain, X86::XMM0, RetVT, InFlag).getValue(1); + ResultVals.push_back(Chain.getValue(0)); + NodeTys.push_back(RetVT); + } + break; case MVT::f32: case MVT::f64: { std::vector Tys; @@ -1806,6 +1824,480 @@ return Res.getValue(Op.ResNo); } +//===----------------------------------------------------------------------===// +// StdCall Calling Convention implementation +//===----------------------------------------------------------------------===// +// StdCall calling convention seems to be standard for many Windows' API +// routines and around. It differs from C calling convention just a little: +// callee should clean up the stack, not caller. Symbols should be also +// decorated in some fancy way :) It doesn't support any vector arguments. + +/// HowToPassStdCallCCArgument - Returns how an formal argument of the specified +/// type should be passed. Returns the size of the stack slot +static void +HowToPassStdCallCCArgument(MVT::ValueType ObjectVT, unsigned &ObjSize) { + switch (ObjectVT) { + default: assert(0 && "Unhandled argument type!"); + case MVT::i8: ObjSize = 1; break; + case MVT::i16: ObjSize = 2; break; + case MVT::i32: ObjSize = 4; break; + case MVT::i64: ObjSize = 8; break; + case MVT::f32: ObjSize = 4; break; + case MVT::f64: ObjSize = 8; break; + } +} + +SDOperand X86TargetLowering::LowerStdCallCCArguments(SDOperand Op, + SelectionDAG &DAG) { + unsigned NumArgs = Op.Val->getNumValues() - 1; + MachineFunction &MF = DAG.getMachineFunction(); + MachineFrameInfo *MFI = MF.getFrameInfo(); + SDOperand Root = Op.getOperand(0); + std::vector ArgValues; + + // Add DAG nodes to load the arguments... On entry to a function on the X86, + // the stack frame looks like this: + // + // [ESP] -- return address + // [ESP + 4] -- first argument (leftmost lexically) + // [ESP + 8] -- second argument, if first argument is <= 4 bytes in size + // ... + // + unsigned ArgOffset = 0; // Frame mechanisms handle retaddr slot + for (unsigned i = 0; i < NumArgs; ++i) { + MVT::ValueType ObjectVT = Op.getValue(i).getValueType(); + unsigned ArgIncrement = 4; + unsigned ObjSize = 0; + HowToPassStdCallCCArgument(ObjectVT, ObjSize); + if (ObjSize > 4) + ArgIncrement = ObjSize; + + SDOperand ArgValue; + // Create the frame index object for this incoming parameter... + int FI = MFI->CreateFixedObject(ObjSize, ArgOffset); + SDOperand FIN = DAG.getFrameIndex(FI, getPointerTy()); + ArgValue = DAG.getLoad(Op.Val->getValueType(i), Root, FIN, + DAG.getSrcValue(NULL)); + ArgValues.push_back(ArgValue); + ArgOffset += ArgIncrement; // Move on to the next argument... + } + + ArgValues.push_back(Root); + + // If the function takes variable number of arguments, make a frame index for + // the start of the first vararg value... for expansion of llvm.va_start. + bool isVarArg = cast(Op.getOperand(2))->getValue() != 0; + if (isVarArg) { + BytesToPopOnReturn = 0; // Callee pops nothing. + BytesCallerReserves = ArgOffset; + VarArgsFrameIndex = MFI->CreateFixedObject(1, ArgOffset); + } else { + BytesToPopOnReturn = ArgOffset; // Callee pops everything.. + BytesCallerReserves = 0; + } + RegSaveFrameIndex = 0xAAAAAAA; // X86-64 only. + ReturnAddrIndex = 0; // No return address slot generated yet. + + MF.getInfo()->setBytesToPopOnReturn(BytesToPopOnReturn); + + // Return the new list of results. + std::vector RetVTs(Op.Val->value_begin(), + Op.Val->value_end()); + return DAG.getNode(ISD::MERGE_VALUES, RetVTs, &ArgValues[0],ArgValues.size()); +} + + +SDOperand X86TargetLowering::LowerStdCallCCCallTo(SDOperand Op, + SelectionDAG &DAG) { + SDOperand Chain = Op.getOperand(0); + unsigned CallingConv= cast(Op.getOperand(1))->getValue(); + bool isVarArg = cast(Op.getOperand(2))->getValue() != 0; + bool isTailCall = cast(Op.getOperand(3))->getValue() != 0; + SDOperand Callee = Op.getOperand(4); + MVT::ValueType RetVT= Op.Val->getValueType(0); + unsigned NumOps = (Op.getNumOperands() - 5) / 2; + + // Count how many bytes are to be pushed on the stack. + unsigned NumBytes = 0; + for (unsigned i = 0; i != NumOps; ++i) { + SDOperand Arg = Op.getOperand(5+2*i); + + switch (Arg.getValueType()) { + default: assert(0 && "Unexpected ValueType for argument!"); + case MVT::i8: + case MVT::i16: + case MVT::i32: + case MVT::f32: + NumBytes += 4; + break; + case MVT::i64: + case MVT::f64: + NumBytes += 8; + break; + } + } + + Chain = DAG.getCALLSEQ_START(Chain,DAG.getConstant(NumBytes, getPointerTy())); + + // Arguments go on the stack in reverse order, as specified by the ABI. + unsigned ArgOffset = 0; + std::vector MemOpChains; + SDOperand StackPtr = DAG.getRegister(X86StackPtr, getPointerTy()); + for (unsigned i = 0; i != NumOps; ++i) { + SDOperand Arg = Op.getOperand(5+2*i); + + switch (Arg.getValueType()) { + default: assert(0 && "Unexpected ValueType for argument!"); + case MVT::i8: + case MVT::i16: { + // Promote the integer to 32 bits. If the input type is signed use a + // sign extend, otherwise use a zero extend. + unsigned ExtOp = + dyn_cast(Op.getOperand(5+2*i+1))->getValue() ? + ISD::SIGN_EXTEND : ISD::ZERO_EXTEND; + Arg = DAG.getNode(ExtOp, MVT::i32, Arg); + } + // Fallthrough + + case MVT::i32: + case MVT::f32: { + SDOperand PtrOff = DAG.getConstant(ArgOffset, getPointerTy()); + PtrOff = DAG.getNode(ISD::ADD, getPointerTy(), StackPtr, PtrOff); + MemOpChains.push_back(DAG.getNode(ISD::STORE, MVT::Other, Chain, + Arg, PtrOff, DAG.getSrcValue(NULL))); + ArgOffset += 4; + break; + } + case MVT::i64: + case MVT::f64: { + SDOperand PtrOff = DAG.getConstant(ArgOffset, getPointerTy()); + PtrOff = DAG.getNode(ISD::ADD, getPointerTy(), StackPtr, PtrOff); + MemOpChains.push_back(DAG.getNode(ISD::STORE, MVT::Other, Chain, + Arg, PtrOff, DAG.getSrcValue(NULL))); + ArgOffset += 8; + break; + } + } + } + + if (!MemOpChains.empty()) + Chain = DAG.getNode(ISD::TokenFactor, MVT::Other, + &MemOpChains[0], MemOpChains.size()); + + // If the callee is a GlobalAddress node (quite common, every direct call is) + // turn it into a TargetGlobalAddress node so that legalize doesn't hack it. + if (GlobalAddressSDNode *G = dyn_cast(Callee)) + Callee = DAG.getTargetGlobalAddress(G->getGlobal(), getPointerTy()); + else if (ExternalSymbolSDNode *S = dyn_cast(Callee)) + Callee = DAG.getTargetExternalSymbol(S->getSymbol(), getPointerTy()); + + std::vector NodeTys; + NodeTys.push_back(MVT::Other); // Returns a chain + NodeTys.push_back(MVT::Flag); // Returns a flag for retval copy to use. + std::vector Ops; + Ops.push_back(Chain); + Ops.push_back(Callee); + + Chain = DAG.getNode(isTailCall ? X86ISD::TAILCALL : X86ISD::CALL, + NodeTys, &Ops[0], Ops.size()); + SDOperand InFlag = Chain.getValue(1); + + // Create the CALLSEQ_END node. + unsigned NumBytesForCalleeToPush; + + if (isVarArg) { + NumBytesForCalleeToPush = 0; + } else { + NumBytesForCalleeToPush = NumBytes; + } + + NodeTys.clear(); + NodeTys.push_back(MVT::Other); // Returns a chain + if (RetVT != MVT::Other) + NodeTys.push_back(MVT::Flag); // Returns a flag for retval copy to use. + Ops.clear(); + Ops.push_back(Chain); + Ops.push_back(DAG.getConstant(NumBytes, getPointerTy())); + Ops.push_back(DAG.getConstant(NumBytesForCalleeToPush, getPointerTy())); + Ops.push_back(InFlag); + Chain = DAG.getNode(ISD::CALLSEQ_END, NodeTys, &Ops[0], Ops.size()); + if (RetVT != MVT::Other) + InFlag = Chain.getValue(1); + + std::vector ResultVals; + NodeTys.clear(); + switch (RetVT) { + default: assert(0 && "Unknown value type to return!"); + case MVT::Other: break; + case MVT::i8: + Chain = DAG.getCopyFromReg(Chain, X86::AL, MVT::i8, InFlag).getValue(1); + ResultVals.push_back(Chain.getValue(0)); + NodeTys.push_back(MVT::i8); + break; + case MVT::i16: + Chain = DAG.getCopyFromReg(Chain, X86::AX, MVT::i16, InFlag).getValue(1); + ResultVals.push_back(Chain.getValue(0)); + NodeTys.push_back(MVT::i16); + break; + case MVT::i32: + if (Op.Val->getValueType(1) == MVT::i32) { + Chain = DAG.getCopyFromReg(Chain, X86::EAX, MVT::i32, InFlag).getValue(1); + ResultVals.push_back(Chain.getValue(0)); + Chain = DAG.getCopyFromReg(Chain, X86::EDX, MVT::i32, + Chain.getValue(2)).getValue(1); + ResultVals.push_back(Chain.getValue(0)); + NodeTys.push_back(MVT::i32); + } else { + Chain = DAG.getCopyFromReg(Chain, X86::EAX, MVT::i32, InFlag).getValue(1); + ResultVals.push_back(Chain.getValue(0)); + } + NodeTys.push_back(MVT::i32); + break; + case MVT::f32: + case MVT::f64: { + std::vector Tys; + Tys.push_back(MVT::f64); + Tys.push_back(MVT::Other); + Tys.push_back(MVT::Flag); + std::vector Ops; + Ops.push_back(Chain); + Ops.push_back(InFlag); + SDOperand RetVal = DAG.getNode(X86ISD::FP_GET_RESULT, Tys, + &Ops[0], Ops.size()); + Chain = RetVal.getValue(1); + InFlag = RetVal.getValue(2); + if (X86ScalarSSE) { + // FIXME: Currently the FST is flagged to the FP_GET_RESULT. This + // shouldn't be necessary except that RFP cannot be live across + // multiple blocks. When stackifier is fixed, they can be uncoupled. + MachineFunction &MF = DAG.getMachineFunction(); + int SSFI = MF.getFrameInfo()->CreateStackObject(8, 8); + SDOperand StackSlot = DAG.getFrameIndex(SSFI, getPointerTy()); + Tys.clear(); + Tys.push_back(MVT::Other); + Ops.clear(); + Ops.push_back(Chain); + Ops.push_back(RetVal); + Ops.push_back(StackSlot); + Ops.push_back(DAG.getValueType(RetVT)); + Ops.push_back(InFlag); + Chain = DAG.getNode(X86ISD::FST, Tys, &Ops[0], Ops.size()); + RetVal = DAG.getLoad(RetVT, Chain, StackSlot, + DAG.getSrcValue(NULL)); + Chain = RetVal.getValue(1); + } + + if (RetVT == MVT::f32 && !X86ScalarSSE) + // FIXME: we would really like to remember that this FP_ROUND + // operation is okay to eliminate if we allow excess FP precision. + RetVal = DAG.getNode(ISD::FP_ROUND, MVT::f32, RetVal); + ResultVals.push_back(RetVal); + NodeTys.push_back(RetVT); + break; + } + } + + // If the function returns void, just return the chain. + if (ResultVals.empty()) + return Chain; + + // Otherwise, merge everything together with a MERGE_VALUES node. + NodeTys.push_back(MVT::Other); + ResultVals.push_back(Chain); + SDOperand Res = DAG.getNode(ISD::MERGE_VALUES, NodeTys, + &ResultVals[0], ResultVals.size()); + return Res.getValue(Op.ResNo); +} + +//===----------------------------------------------------------------------===// +// FastCall Calling Convention implementation +//===----------------------------------------------------------------------===// +// +// The X86 'fastcall' calling convention passes up to two integer arguments in +// registers (an appropriate portion of ECX/EDX), passes arguments in C order, +// and requires that the callee pop its arguments off the stack (allowing proper +// tail calls), and has the same return value conventions as C calling convs. +// +// This calling convention always arranges for the callee pop value to be 8n+4 +// bytes, which is needed for tail recursion elimination and stack alignment +// reasons. +// + +/// HowToPassFastCallCCArgument - Returns how an formal argument of the +/// specified type should be passed. If it is through stack, returns the size of +/// the stack slot; if it is through integer register, returns the number of +/// integer registers are needed. +static void +HowToPassFastCallCCArgument(MVT::ValueType ObjectVT, + unsigned NumIntRegs, + unsigned &ObjSize, + unsigned &ObjIntRegs) +{ + ObjSize = 0; + ObjIntRegs = 0; + + switch (ObjectVT) { + default: assert(0 && "Unhandled argument type!"); + case MVT::i8: + if (NumIntRegs < 2) + ObjIntRegs = 1; + else + ObjSize = 1; + break; + case MVT::i16: + if (NumIntRegs < 2) + ObjIntRegs = 1; + else + ObjSize = 2; + break; + case MVT::i32: + if (NumIntRegs < 2) + ObjIntRegs = 1; + else + ObjSize = 4; + break; + case MVT::i64: + if (NumIntRegs+2 <= 2) { + ObjIntRegs = 2; + } else if (NumIntRegs+1 <= 2) { + ObjIntRegs = 1; + ObjSize = 4; + } else + ObjSize = 8; + case MVT::f32: + ObjSize = 4; + break; + case MVT::f64: + ObjSize = 8; + break; + } +} + +SDOperand +X86TargetLowering::LowerFastCallCCArguments(SDOperand Op, SelectionDAG &DAG) { + unsigned NumArgs = Op.Val->getNumValues()-1; + MachineFunction &MF = DAG.getMachineFunction(); + MachineFrameInfo *MFI = MF.getFrameInfo(); + SDOperand Root = Op.getOperand(0); + std::vector ArgValues; + + // Add DAG nodes to load the arguments... On entry to a function the stack + // frame looks like this: + // + // [ESP] -- return address + // [ESP + 4] -- first nonreg argument (leftmost lexically) + // [ESP + 8] -- second nonreg argument, if 1st argument is <= 4 bytes in size + // ... + unsigned ArgOffset = 0; // Frame mechanisms handle retaddr slot + + // Keep track of the number of integer regs passed so far. This can be either + // 0 (neither ECX or EDX used), 1 (ECX is used) or 2 (ECX and EDX are both + // used). + unsigned NumIntRegs = 0; + + for (unsigned i = 0; i < NumArgs; ++i) { + MVT::ValueType ObjectVT = Op.getValue(i).getValueType(); + unsigned ArgIncrement = 4; + unsigned ObjSize = 0; + unsigned ObjIntRegs = 0; + + HowToPassFastCallCCArgument(ObjectVT, NumIntRegs, ObjSize, ObjIntRegs); + if (ObjSize > 4) + ArgIncrement = ObjSize; + + unsigned Reg = 0; + SDOperand ArgValue; + if (ObjIntRegs) { + switch (ObjectVT) { + default: assert(0 && "Unhandled argument type!"); + case MVT::i8: + Reg = AddLiveIn(MF, NumIntRegs ? X86::DL : X86::CL, + X86::GR8RegisterClass); + ArgValue = DAG.getCopyFromReg(Root, Reg, MVT::i8); + break; + case MVT::i16: + Reg = AddLiveIn(MF, NumIntRegs ? X86::DX : X86::CX, + X86::GR16RegisterClass); + ArgValue = DAG.getCopyFromReg(Root, Reg, MVT::i16); + break; + case MVT::i32: + Reg = AddLiveIn(MF, NumIntRegs ? X86::EDX : X86::ECX, + X86::GR32RegisterClass); + ArgValue = DAG.getCopyFromReg(Root, Reg, MVT::i32); + break; + case MVT::i64: + Reg = AddLiveIn(MF, NumIntRegs ? X86::EDX : X86::ECX, + X86::GR32RegisterClass); + ArgValue = DAG.getCopyFromReg(Root, Reg, MVT::i32); + if (ObjIntRegs == 2) { + Reg = AddLiveIn(MF, X86::EDX, X86::GR32RegisterClass); + SDOperand ArgValue2 = DAG.getCopyFromReg(Root, Reg, MVT::i32); + ArgValue= DAG.getNode(ISD::BUILD_PAIR, MVT::i64, ArgValue, ArgValue2); + } + break; + } + + NumIntRegs += ObjIntRegs; + } + + if (ObjSize) { + // Create the SelectionDAG nodes corresponding to a load from this + // parameter. + int FI = MFI->CreateFixedObject(ObjSize, ArgOffset); + SDOperand FIN = DAG.getFrameIndex(FI, getPointerTy()); + if (ObjectVT == MVT::i64 && ObjIntRegs) { + SDOperand ArgValue2 = DAG.getLoad(Op.Val->getValueType(i), Root, FIN, + DAG.getSrcValue(NULL)); + ArgValue = DAG.getNode(ISD::BUILD_PAIR, MVT::i64, ArgValue, ArgValue2); + } else + ArgValue = DAG.getLoad(Op.Val->getValueType(i), Root, FIN, + DAG.getSrcValue(NULL)); + ArgOffset += ArgIncrement; // Move on to the next argument. + } + + ArgValues.push_back(ArgValue); + } + + ArgValues.push_back(Root); + + // Make sure the instruction takes 8n+4 bytes to make sure the start of the + // arguments and the arguments after the retaddr has been pushed are aligned. + if ((ArgOffset & 7) == 0) + ArgOffset += 4; + + VarArgsFrameIndex = 0xAAAAAAA; // fastcc functions can't have varargs. + RegSaveFrameIndex = 0xAAAAAAA; // X86-64 only. + ReturnAddrIndex = 0; // No return address slot generated yet. + BytesToPopOnReturn = ArgOffset; // Callee pops all stack arguments. + BytesCallerReserves = 0; + + MF.getInfo()->setBytesToPopOnReturn(BytesToPopOnReturn); + + // Finally, inform the code generator which regs we return values in. + switch (getValueType(MF.getFunction()->getReturnType())) { + default: assert(0 && "Unknown type!"); + case MVT::isVoid: break; + case MVT::i8: + case MVT::i16: + case MVT::i32: + MF.addLiveOut(X86::ECX); + break; + case MVT::i64: + MF.addLiveOut(X86::ECX); + MF.addLiveOut(X86::EDX); + break; + case MVT::f32: + case MVT::f64: + MF.addLiveOut(X86::ST0); + break; + } + + // Return the new list of results. + std::vector RetVTs(Op.Val->value_begin(), + Op.Val->value_end()); + return DAG.getNode(ISD::MERGE_VALUES, RetVTs, &ArgValues[0],ArgValues.size()); +} + SDOperand X86TargetLowering::getReturnAddressFrameIndex(SelectionDAG &DAG) { if (ReturnAddrIndex == 0) { // Set up a frame object for the return address. @@ -1965,10 +2457,10 @@ } /// WindowsGVRequiresExtraLoad - true if accessing the GV requires an extra -/// load. For Windows, dllimported variables (not functions!) are indirect, -/// loading the value at address GV rather then the value of GV itself. This -/// means that the GlobalAddress must be in the base or index register of the -/// address, not the GV offset field. +/// load. For Windows, dllimported symbols are indirect, loading the value at +/// address GV rather then the value of GV itself. This means that the +/// GlobalAddress must be in the base or index register of the address, not the +/// GV offset field. static bool WindowsGVRequiresExtraLoad(GlobalValue *GV) { return (GV->hasDLLImportLinkage()); } @@ -3790,12 +4282,26 @@ SDOperand X86TargetLowering::LowerCALL(SDOperand Op, SelectionDAG &DAG) { unsigned CallingConv= cast(Op.getOperand(1))->getValue(); + if (Subtarget->is64Bit()) return LowerX86_64CCCCallTo(Op, DAG); - else if (CallingConv == CallingConv::Fast && EnableFastCC) - return LowerFastCCCallTo(Op, DAG); else - return LowerCCCCallTo(Op, DAG); + switch (CallingConv) { + case CallingConv::Fast: + if (EnableFastCC) { + return LowerFastCCCallTo(Op, DAG, false); + } + // Falls through + case CallingConv::C: + case CallingConv::CSRet: + return LowerCCCCallTo(Op, DAG); + case CallingConv::X86_StdCall: + return LowerStdCallCCCallTo(Op, DAG); + case CallingConv::X86_FastCall: + return LowerFastCCCallTo(Op, DAG, true); + default: + assert(0 && "Unsupported calling convention"); + } } SDOperand X86TargetLowering::LowerRET(SDOperand Op, SelectionDAG &DAG) { @@ -3914,10 +4420,25 @@ unsigned CC = cast(Op.getOperand(1))->getValue(); if (Subtarget->is64Bit()) return LowerX86_64CCCArguments(Op, DAG); - else if (CC == CallingConv::Fast && EnableFastCC) - return LowerFastCCArguments(Op, DAG); else - return LowerCCCArguments(Op, DAG); + switch(CC) { + case CallingConv::Fast: + if (EnableFastCC) { + return LowerFastCCArguments(Op, DAG); + } + // Falls through + case CallingConv::C: + case CallingConv::CSRet: + return LowerCCCArguments(Op, DAG); + case CallingConv::X86_StdCall: + MF.getInfo()->setDecorationStyle(StdCall); + return LowerStdCallCCArguments(Op, DAG); + case CallingConv::X86_FastCall: + MF.getInfo()->setDecorationStyle(FastCall); + return LowerFastCallCCArguments(Op, DAG); + default: + assert(0 && "Unsupported calling convention"); + } } SDOperand X86TargetLowering::LowerMEMSET(SDOperand Op, SelectionDAG &DAG) { Index: llvm/lib/Target/X86/X86ISelLowering.h diff -u llvm/lib/Target/X86/X86ISelLowering.h:1.72 llvm/lib/Target/X86/X86ISelLowering.h:1.73 --- llvm/lib/Target/X86/X86ISelLowering.h:1.72 Sun Sep 10 21:19:56 2006 +++ llvm/lib/Target/X86/X86ISelLowering.h Wed Sep 20 17:03:51 2006 @@ -366,7 +366,15 @@ // Fast Calling Convention implementation. SDOperand LowerFastCCArguments(SDOperand Op, SelectionDAG &DAG); - SDOperand LowerFastCCCallTo(SDOperand Op, SelectionDAG &DAG); + SDOperand LowerFastCCCallTo(SDOperand Op, SelectionDAG &DAG, + bool isFastCall); + + // StdCall Calling Convention implementation. + SDOperand LowerStdCallCCArguments(SDOperand Op, SelectionDAG &DAG); + SDOperand LowerStdCallCCCallTo(SDOperand Op, SelectionDAG &DAG); + + // FastCall Calling Convention implementation. + SDOperand LowerFastCallCCArguments(SDOperand Op, SelectionDAG &DAG); SDOperand LowerBUILD_VECTOR(SDOperand Op, SelectionDAG &DAG); SDOperand LowerVECTOR_SHUFFLE(SDOperand Op, SelectionDAG &DAG); Index: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.56 llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.57 --- llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.56 Thu Sep 14 13:23:27 2006 +++ llvm/lib/Target/X86/X86IntelAsmPrinter.cpp Wed Sep 20 17:03:51 2006 @@ -16,6 +16,7 @@ #include "X86IntelAsmPrinter.h" #include "X86TargetAsmInfo.h" #include "X86.h" +#include "llvm/CallingConv.h" #include "llvm/Constants.h" #include "llvm/Module.h" #include "llvm/Assembly/Writer.h" @@ -36,6 +37,16 @@ // Print out labels for the function. const Function* F = MF.getFunction(); + unsigned CC = F->getCallingConv(); + + // Populate function information map. Actually, We don't want to populate + // non-stdcall or non-fastcall functions' information right now. + if (CC == CallingConv::X86_StdCall || CC == CallingConv::X86_FastCall) { + FunctionInfoMap[F] = *(MF.getInfo()); + } + + X86SharedAsmPrinter::decorateName(CurrentFnName, F); + switch (F->getLinkage()) { default: assert(0 && "Unsupported linkage type!"); case Function::InternalLinkage: @@ -132,6 +143,9 @@ bool isCallOp = Modifier && !strcmp(Modifier, "call"); bool isMemOp = Modifier && !strcmp(Modifier, "mem"); GlobalValue *GV = MO.getGlobal(); + std::string Name = Mang->getValueName(GV); + + X86SharedAsmPrinter::decorateName(Name, GV); if (!isMemOp && !isCallOp) O << "OFFSET "; if (GV->hasDLLImportLinkage()) { @@ -139,7 +153,7 @@ // CC's O << "__imp_"; } - O << Mang->getValueName(GV); + O << Name; int Offset = MO.getOffset(); if (Offset > 0) O << " + " << Offset; @@ -322,15 +336,30 @@ // Emit declarations for external functions. for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (I->isExternal()) - O << "\textern " << Mang->getValueName(I) << ":near\n"; - + if (I->isExternal()) { + std::string Name = Mang->getValueName(I); + X86SharedAsmPrinter::decorateName(Name, I); + + O << "\textern " ; + if (I->hasDLLImportLinkage()) { + O << "__imp_"; + } + O << Name << ":near\n"; + } + // Emit declarations for external globals. Note that VC++ always declares // external globals to have type byte, and if that's good enough for VC++... for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) { - if (I->isExternal()) - O << "\textern " << Mang->getValueName(I) << ":byte\n"; + if (I->isExternal()) { + std::string Name = Mang->getValueName(I); + + O << "\textern " ; + if (I->hasDLLImportLinkage()) { + O << "__imp_"; + } + O << Name << ":byte\n"; + } } return false; Index: llvm/lib/Target/X86/X86MachineFunctionInfo.h diff -u llvm/lib/Target/X86/X86MachineFunctionInfo.h:1.2 llvm/lib/Target/X86/X86MachineFunctionInfo.h:1.3 --- llvm/lib/Target/X86/X86MachineFunctionInfo.h:1.2 Fri Jun 9 01:25:10 2006 +++ llvm/lib/Target/X86/X86MachineFunctionInfo.h Wed Sep 20 17:03:51 2006 @@ -18,18 +18,47 @@ namespace llvm { +enum NameDecorationStyle { + None, + StdCall, + FastCall +}; + /// X86FunctionInfo - This class is derived from MachineFunction private /// X86 target-specific information for each MachineFunction. class X86FunctionInfo : public MachineFunctionInfo { - // ForceFramePointer - True if the function is required to use of frame - // pointer for reasons other than it containing dynamic allocation or - // that FP eliminatation is turned off. For example, Cygwin main function - // contains stack pointer re-alignment code which requires FP. + /// ForceFramePointer - True if the function is required to use of frame + /// pointer for reasons other than it containing dynamic allocation or + /// that FP eliminatation is turned off. For example, Cygwin main function + /// contains stack pointer re-alignment code which requires FP. bool ForceFramePointer; + + /// BytesToPopOnReturn - amount of bytes function pops on return. + /// Used on windows platform for stdcall & fastcall name decoration + unsigned BytesToPopOnReturn; + + /// If the function requires additional name decoration, DecorationStyle holds + /// the right way to do so. + NameDecorationStyle DecorationStyle; + public: - X86FunctionInfo(MachineFunction& MF) : ForceFramePointer(false) {} + X86FunctionInfo() : ForceFramePointer(false), + BytesToPopOnReturn(0), + DecorationStyle(None) {} + + X86FunctionInfo(MachineFunction& MF) : ForceFramePointer(false), + BytesToPopOnReturn(0), + DecorationStyle(None) {} + bool getForceFramePointer() const { return ForceFramePointer;} void setForceFramePointer(bool forceFP) { ForceFramePointer = forceFP; } + + unsigned getBytesToPopOnReturn() const { return BytesToPopOnReturn; } + void setBytesToPopOnReturn (unsigned bytes) { BytesToPopOnReturn = bytes;} + + NameDecorationStyle getDecorationStyle() const { return DecorationStyle; } + void setDecorationStyle(NameDecorationStyle style) { DecorationStyle = style;} + }; } // End llvm namespace From nicholas at mxc.ca Wed Sep 20 18:02:40 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 20 Sep 2006 18:02:40 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Message-ID: <200609202302.k8KN2e0F002739@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: PredicateSimplifier.cpp updated: 1.12 -> 1.13 --- Log message: Once we're down to "setcc type constant1, constant2", at least come up with the right answer. --- Diffs of the changes: (+14 -18) PredicateSimplifier.cpp | 32 ++++++++++++++------------------ 1 files changed, 14 insertions(+), 18 deletions(-) Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.12 llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.13 --- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.12 Wed Sep 20 12:04:01 2006 +++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Wed Sep 20 18:02:24 2006 @@ -524,6 +524,9 @@ const PropertySet &KP) { // Attempt to resolve the SetCondInst to a boolean. + static ConstantBool *True = ConstantBool::True, + *False = ConstantBool::False; + Value *SCI0 = resolve(SCI->getOperand(0), KP), *SCI1 = resolve(SCI->getOperand(1), KP); @@ -536,10 +539,8 @@ if (NE != KP.Properties.end()) { switch (SCI->getOpcode()) { - case Instruction::SetEQ: - return ConstantBool::False; - case Instruction::SetNE: - return ConstantBool::True; + case Instruction::SetEQ: return False; + case Instruction::SetNE: return True; case Instruction::SetLE: case Instruction::SetGE: case Instruction::SetLT: @@ -553,25 +554,20 @@ return SCI; } + uint64_t I1 = CI1->getRawValue(), I2 = CI2->getRawValue(); switch(SCI->getOpcode()) { - case Instruction::SetLE: - case Instruction::SetGE: - case Instruction::SetEQ: - if (CI1->getRawValue() == CI2->getRawValue()) - return ConstantBool::True; - else - return ConstantBool::False; - case Instruction::SetLT: - case Instruction::SetGT: - case Instruction::SetNE: - if (CI1->getRawValue() == CI2->getRawValue()) - return ConstantBool::False; - else - return ConstantBool::True; + case Instruction::SetLE: if (I1 <= I2) return True; else return False; + case Instruction::SetGE: if (I1 >= I2) return True; else return False; + case Instruction::SetEQ: if (I1 == I2) return True; else return False; + case Instruction::SetLT: if (I1 < I2) return True; else return False; + case Instruction::SetGT: if (I1 > I2) return True; else return False; + case Instruction::SetNE: if (I1 != I2) return True; else return False; default: assert(0 && "Unknown opcode in SetContInst."); break; } + + return SCI; } Value *PredicateSimplifier::resolve(BinaryOperator *BO, From nicholas at mxc.ca Wed Sep 20 18:02:41 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 20 Sep 2006 18:02:41 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/PredicateSimplifier/2006-09-20-SetCC.ll Message-ID: <200609202302.k8KN2fqp002744@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/PredicateSimplifier: 2006-09-20-SetCC.ll added (r1.1) --- Log message: Once we're down to "setcc type constant1, constant2", at least come up with the right answer. --- Diffs of the changes: (+54 -0) 2006-09-20-SetCC.ll | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 54 insertions(+) Index: llvm/test/Regression/Transforms/PredicateSimplifier/2006-09-20-SetCC.ll diff -c /dev/null llvm/test/Regression/Transforms/PredicateSimplifier/2006-09-20-SetCC.ll:1.1 *** /dev/null Wed Sep 20 18:02:34 2006 --- llvm/test/Regression/Transforms/PredicateSimplifier/2006-09-20-SetCC.ll Wed Sep 20 18:02:24 2006 *************** *** 0 **** --- 1,54 ---- + ; RUN: llvm-as < %s | opt -predsimplify | llvm-dis | grep br | grep bb8 | grep cond_true$ | grep false + + %str = external global [4 x sbyte] ; <[4 x sbyte]*> [#uses=1] + + implementation ; Functions: + + declare int %sprintf(sbyte*, sbyte*, ...) + + int %main() { + entry: + br label %cond_true.outer + + cond_true.outer: ; preds = %cond_true.i, %entry + %i.0.0.ph = phi int [ 0, %entry ], [ %tmp5, %cond_true.i ] ; [#uses=1] + %j.0.0.ph = phi int [ 0, %entry ], [ %tmp312, %cond_true.i ] ; [#uses=2] + br label %cond_true + + cond_true: ; preds = %return.i, %cond_true.outer + %indvar = phi uint [ 0, %cond_true.outer ], [ %indvar.next, %return.i ] ; [#uses=2] + %indvar = cast uint %indvar to int ; [#uses=1] + %i.0.0 = add int %indvar, %i.0.0.ph ; [#uses=3] + %savedstack = call sbyte* %llvm.stacksave( ) ; [#uses=2] + %tmp.i = seteq int %i.0.0, 0 ; [#uses=1] + %tmp5 = add int %i.0.0, 1 ; [#uses=3] + br bool %tmp.i, label %return.i, label %cond_true.i + + cond_true.i: ; preds = %cond_true + %tmp.i = alloca [1000 x sbyte] ; <[1000 x sbyte]*> [#uses=1] + %tmp.sub.i = getelementptr [1000 x sbyte]* %tmp.i, int 0, int 0 ; [#uses=2] + %tmp4.i = call int (sbyte*, sbyte*, ...)* %sprintf( sbyte* %tmp.sub.i, sbyte* getelementptr ([4 x sbyte]* %str, int 0, uint 0), int %i.0.0 ) ; [#uses=0] + %tmp.i = load sbyte* %tmp.sub.i ; [#uses=1] + %tmp7.i = cast sbyte %tmp.i to int ; [#uses=1] + call void %llvm.stackrestore( sbyte* %savedstack ) + %tmp312 = add int %tmp7.i, %j.0.0.ph ; [#uses=2] + %tmp19 = setgt int %tmp5, 9999 ; [#uses=1] + br bool %tmp19, label %bb8, label %cond_true.outer + + return.i: ; preds = %cond_true + call void %llvm.stackrestore( sbyte* %savedstack ) + %tmp21 = setgt int %tmp5, 9999 ; [#uses=1] + %indvar.next = add uint %indvar, 1 ; [#uses=1] + br bool %tmp21, label %bb8, label %cond_true + + bb8: ; preds = %return.i, %cond_true.i + %j.0.1 = phi int [ %j.0.0.ph, %return.i ], [ %tmp312, %cond_true.i ] ; [#uses=1] + %tmp10 = call int (sbyte*, ...)* %printf( sbyte* getelementptr ([4 x sbyte]* %str, int 0, uint 0), int %j.0.1 ) ; [#uses=0] + ret int undef + } + + declare int %printf(sbyte*, ...) + + declare sbyte* %llvm.stacksave() + + declare void %llvm.stackrestore(sbyte*) From evan.cheng at apple.com Wed Sep 20 18:41:13 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 20 Sep 2006 18:41:13 -0500 Subject: [llvm-commits] CVS: llvm-test/configure Makefile.config.in Message-ID: <200609202341.k8KNfDOg003351@zion.cs.uiuc.edu> Changes in directory llvm-test: configure updated: 1.39 -> 1.40 Makefile.config.in updated: 1.23 -> 1.24 --- Log message: Adding HMMER as an external test. --- Diffs of the changes: (+82 -26) Makefile.config.in | 4 ++ configure | 104 +++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 82 insertions(+), 26 deletions(-) Index: llvm-test/configure diff -u llvm-test/configure:1.39 llvm-test/configure:1.40 --- llvm-test/configure:1.39 Sun Sep 3 15:38:14 2006 +++ llvm-test/configure Wed Sep 20 18:40:57 2006 @@ -812,6 +812,8 @@ USE_ALP NURBS_ROOT USE_NURBS +HMMER_ROOT +USE_HMMER DISABLE_LLC_DIFFS CXX CXXFLAGS @@ -1483,6 +1485,7 @@ --with-fpgrowth=DIR Use fpgrowth as a benchmark (srcs in DIR) --with-alp=DIR Use alp as a benchmark (srcs in DIR) --with-nurbs=DIR Use nurbs as a benchmark (srcs in DIR) + --with-hmmer=DIR Use hmmer as a benchmark (srcs in DIR) --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-pic try to use only PIC/non-PIC objects [default=use both] @@ -2555,6 +2558,53 @@ + +# Check whether --with-hmmer was given. +if test "${with_hmmer+set}" = set; then + withval=$with_hmmer; checkresult=$withval +else + checkresult=auto +fi + +{ echo "$as_me:$LINENO: checking for hmmer benchmark sources" >&5 +echo $ECHO_N "checking for hmmer benchmark sources... $ECHO_C" >&6; } +case "$checkresult" in +auto|yes) + defaultdir=${LLVM_EXTERNALS}/hmmer + if test -d "$defaultdir"; then + HMMER_ROOT=$defaultdir + + USE_HMMER=USE_HMMER=1 + + checkresult="yes, found in $defaultdir" + else + checkresult=no + fi + ;; +no) + + + checkresult=no + ;; +*) + if test -d "$checkresult" ; then + HMMER_ROOT="$checkresult" + + USE_HMMER=USE_HMMER=1 + + checkresult="yes, in $checkresult" + else + + + checkresult="no, not found in $checkresult" + fi + ;; +esac +{ echo "$as_me:$LINENO: result: $checkresult" >&5 +echo "${ECHO_T}$checkresult" >&6; } + + + if test -n "$SPEC2006_ROOT" ; then if test -d "$SPEC2006_ROOT" ; then if test `basename "$SPEC2006_ROOT"` != "benchspec"; then @@ -5334,7 +5384,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5337 "configure"' > conftest.$ac_ext + echo '#line 5387 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7499,11 +7549,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7502: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7552: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7506: \$? = $ac_status" >&5 + echo "$as_me:7556: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7767,11 +7817,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7770: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7820: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7774: \$? = $ac_status" >&5 + echo "$as_me:7824: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7871,11 +7921,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7874: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7924: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7878: \$? = $ac_status" >&5 + echo "$as_me:7928: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -10323,7 +10373,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:12844: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12798: \$? = $ac_status" >&5 + echo "$as_me:12848: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -12895,11 +12945,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12898: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12948: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12902: \$? = $ac_status" >&5 + echo "$as_me:12952: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14465,11 +14515,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14468: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14518: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14472: \$? = $ac_status" >&5 + echo "$as_me:14522: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14569,11 +14619,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14572: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14622: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14576: \$? = $ac_status" >&5 + echo "$as_me:14626: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -16804,11 +16854,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16807: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16857: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16811: \$? = $ac_status" >&5 + echo "$as_me:16861: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17072,11 +17122,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17075: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17125: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17079: \$? = $ac_status" >&5 + echo "$as_me:17129: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17176,11 +17226,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17179: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17229: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:17183: \$? = $ac_status" >&5 + echo "$as_me:17233: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -21617,6 +21667,8 @@ USE_ALP!$USE_ALP$ac_delim NURBS_ROOT!$NURBS_ROOT$ac_delim USE_NURBS!$USE_NURBS$ac_delim +HMMER_ROOT!$HMMER_ROOT$ac_delim +USE_HMMER!$USE_HMMER$ac_delim DISABLE_LLC_DIFFS!$DISABLE_LLC_DIFFS$ac_delim CXX!$CXX$ac_delim CXXFLAGS!$CXXFLAGS$ac_delim @@ -21654,8 +21706,6 @@ STRIP!$STRIP$ac_delim CXXCPP!$CXXCPP$ac_delim F77!$F77$ac_delim -FFLAGS!$FFLAGS$ac_delim -ac_ct_F77!$ac_ct_F77$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -21697,6 +21747,8 @@ ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +FFLAGS!$FFLAGS$ac_delim +ac_ct_F77!$ac_ct_F77$ac_delim LIBTOOL!$LIBTOOL$ac_delim USE_F2C!$USE_F2C$ac_delim F2C!$F2C$ac_delim @@ -21715,7 +21767,7 @@ LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 16; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 18; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 Index: llvm-test/Makefile.config.in diff -u llvm-test/Makefile.config.in:1.23 llvm-test/Makefile.config.in:1.24 --- llvm-test/Makefile.config.in:1.23 Sun Sep 3 18:10:17 2006 +++ llvm-test/Makefile.config.in Wed Sep 20 18:40:57 2006 @@ -82,6 +82,10 @@ @USE_NURBS@ NURBS_ROOT := @NURBS_ROOT@ +# Path to the HMMER source code + at USE_HMMER@ +HMMER_ROOT := @HMMER_ROOT@ + # Disable LLC diffs for testing. @DISABLE_LLC_DIFFS@ From evan.cheng at apple.com Wed Sep 20 18:41:13 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 20 Sep 2006 18:41:13 -0500 Subject: [llvm-commits] CVS: llvm-test/autoconf/configure.ac Message-ID: <200609202341.k8KNfDwi003346@zion.cs.uiuc.edu> Changes in directory llvm-test/autoconf: configure.ac updated: 1.37 -> 1.38 --- Log message: Adding HMMER as an external test. --- Diffs of the changes: (+1 -0) configure.ac | 1 + 1 files changed, 1 insertion(+) Index: llvm-test/autoconf/configure.ac diff -u llvm-test/autoconf/configure.ac:1.37 llvm-test/autoconf/configure.ac:1.38 --- llvm-test/autoconf/configure.ac:1.37 Fri Sep 1 19:04:00 2006 +++ llvm-test/autoconf/configure.ac Wed Sep 20 18:40:57 2006 @@ -79,6 +79,7 @@ EXTERNAL_BENCHMARK(fpgrowth,${LLVM_EXTERNALS}/fpgrowth) EXTERNAL_BENCHMARK(alp,${LLVM_EXTERNALS}/alp) EXTERNAL_BENCHMARK(nurbs,${LLVM_EXTERNALS}/nurbs) +EXTERNAL_BENCHMARK(hmmer,${LLVM_EXTERNALS}/hmmer) dnl Check that the paths of provided external benchmark dirs make sense if test -n "$SPEC2006_ROOT" ; then From llvm at cs.uiuc.edu Wed Sep 20 18:41:41 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 20 Sep 2006 18:41:41 -0500 Subject: [llvm-commits] CVS: llvm-test/External/HMMER/ Message-ID: <200609202341.k8KNffGe003376@zion.cs.uiuc.edu> Changes in directory llvm-test/External/HMMER: --- Log message: Directory /var/cvs/llvm/llvm-test/External/HMMER added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From evan.cheng at apple.com Wed Sep 20 18:43:50 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 20 Sep 2006 18:43:50 -0500 Subject: [llvm-commits] CVS: llvm-test/External/HMMER/Makefile README Message-ID: <200609202343.k8KNho6o003448@zion.cs.uiuc.edu> Changes in directory llvm-test/External/HMMER: Makefile added (r1.1) README added (r1.1) --- Log message: Adding HMMER as an external test. --- Diffs of the changes: (+18 -0) Makefile | 16 ++++++++++++++++ README | 2 ++ 2 files changed, 18 insertions(+) Index: llvm-test/External/HMMER/Makefile diff -c /dev/null llvm-test/External/HMMER/Makefile:1.1 *** /dev/null Wed Sep 20 18:43:44 2006 --- llvm-test/External/HMMER/Makefile Wed Sep 20 18:43:34 2006 *************** *** 0 **** --- 1,16 ---- + LEVEL = ../.. + + include $(LEVEL)/Makefile.config + + PROG = hmmcalibrate + SourceDir := $(HMMER_ROOT) + + CPPFLAGS = -DSSE2 + + ifdef LARGE_PROBLEM_SIZE + RUN_OPTIONS = --fixed 400 --cpu 1 --num 200000 $(HMMER_ROOT)/globin.hmm + else + RUN_OPTIONS = --fixed 400 --cpu 1 --num 80000 $(HMMER_ROOT)/globin.hmm + endif + + include $(LEVEL)/MultiSource/Makefile.multisrc Index: llvm-test/External/HMMER/README diff -c /dev/null llvm-test/External/HMMER/README:1.1 *** /dev/null Wed Sep 20 18:43:50 2006 --- llvm-test/External/HMMER/README Wed Sep 20 18:43:34 2006 *************** *** 0 **** --- 1,2 ---- + HMMER - profile hidden Markov models for biological sequence analysis + http://hmmer.wustl.edu/ From evan.cheng at apple.com Wed Sep 20 18:43:49 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 20 Sep 2006 18:43:49 -0500 Subject: [llvm-commits] CVS: llvm-test/External/Makefile Message-ID: <200609202343.k8KNhnPX003441@zion.cs.uiuc.edu> Changes in directory llvm-test/External: Makefile updated: 1.23 -> 1.24 --- Log message: Adding HMMER as an external test. --- Diffs of the changes: (+5 -1) Makefile | 6 +++++- 1 files changed, 5 insertions(+), 1 deletion(-) Index: llvm-test/External/Makefile diff -u llvm-test/External/Makefile:1.23 llvm-test/External/Makefile:1.24 --- llvm-test/External/Makefile:1.23 Fri Apr 21 03:19:02 2006 +++ llvm-test/External/Makefile Wed Sep 20 18:43:34 2006 @@ -8,7 +8,7 @@ # # Create the list of directories to compile # -PARALLEL_DIRS := SPEC Povray Namd FPGrowth BoxedSim Nurbs +PARALLEL_DIRS := SPEC Povray Namd FPGrowth BoxedSim Nurbs HMMER ifndef USE_POVRAY PARALLEL_DIRS := $(filter-out Povray, $(PARALLEL_DIRS)) @@ -30,6 +30,10 @@ PARALLEL_DIRS := $(filter-out Nurbs, $(PARALLEL_DIRS)) endif +ifndef USE_HMMER +PARALLEL_DIRS := $(filter-out HMMER, $(PARALLEL_DIRS)) +endif + # Sparc can't handle Namd: infinite loop, cause unknown ifeq ($(ARCH),Sparc) PARALLEL_DIRS := $(filter-out Namd, $(PARALLEL_DIRS)) From nicholas at mxc.ca Wed Sep 20 20:05:49 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 20 Sep 2006 20:05:49 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Message-ID: <200609210105.k8L15nLr004827@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: PredicateSimplifier.cpp updated: 1.13 -> 1.14 --- Log message: Don't rewrite ConstantExpr::get. --- Diffs of the changes: (+19 -43) PredicateSimplifier.cpp | 62 ++++++++++++++---------------------------------- 1 files changed, 19 insertions(+), 43 deletions(-) Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.13 llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.14 --- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.13 Wed Sep 20 18:02:24 2006 +++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Wed Sep 20 20:05:35 2006 @@ -524,66 +524,42 @@ const PropertySet &KP) { // Attempt to resolve the SetCondInst to a boolean. - static ConstantBool *True = ConstantBool::True, - *False = ConstantBool::False; - Value *SCI0 = resolve(SCI->getOperand(0), KP), *SCI1 = resolve(SCI->getOperand(1), KP); - ConstantIntegral *CI1 = dyn_cast(SCI0), - *CI2 = dyn_cast(SCI1); + PropertySet::ConstPropertyIterator NE = + KP.findProperty(PropertySet::NE, SCI0, SCI1); - if (!CI1 || !CI2) { - PropertySet::ConstPropertyIterator NE = - KP.findProperty(PropertySet::NE, SCI0, SCI1); - - if (NE != KP.Properties.end()) { - switch (SCI->getOpcode()) { - case Instruction::SetEQ: return False; - case Instruction::SetNE: return True; - case Instruction::SetLE: - case Instruction::SetGE: - case Instruction::SetLT: - case Instruction::SetGT: - break; - default: - assert(0 && "Unknown opcode in SetCondInst."); - break; - } + if (NE != KP.Properties.end()) { + switch (SCI->getOpcode()) { + case Instruction::SetEQ: return ConstantBool::False; + case Instruction::SetNE: return ConstantBool::True; + case Instruction::SetLE: + case Instruction::SetGE: + case Instruction::SetLT: + case Instruction::SetGT: + break; + default: + assert(0 && "Unknown opcode in SetCondInst."); + break; } - return SCI; } - - uint64_t I1 = CI1->getRawValue(), I2 = CI2->getRawValue(); - switch(SCI->getOpcode()) { - case Instruction::SetLE: if (I1 <= I2) return True; else return False; - case Instruction::SetGE: if (I1 >= I2) return True; else return False; - case Instruction::SetEQ: if (I1 == I2) return True; else return False; - case Instruction::SetLT: if (I1 < I2) return True; else return False; - case Instruction::SetGT: if (I1 > I2) return True; else return False; - case Instruction::SetNE: if (I1 != I2) return True; else return False; - default: - assert(0 && "Unknown opcode in SetContInst."); - break; - } - return SCI; } Value *PredicateSimplifier::resolve(BinaryOperator *BO, const PropertySet &KP) { - if (SetCondInst *SCI = dyn_cast(BO)) - return resolve(SCI, KP); - Value *lhs = resolve(BO->getOperand(0), KP), *rhs = resolve(BO->getOperand(1), KP); + ConstantIntegral *CI1 = dyn_cast(lhs); ConstantIntegral *CI2 = dyn_cast(rhs); - if (!CI1 || !CI2) return BO; + if (CI1 && CI2) return ConstantExpr::get(BO->getOpcode(), CI1, CI2); + + if (SetCondInst *SCI = dyn_cast(BO)) + return resolve(SCI, KP); - Value *V = ConstantExpr::get(BO->getOpcode(), CI1, CI2); - if (V) return V; return BO; } From nicholas at mxc.ca Wed Sep 20 21:08:45 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 20 Sep 2006 21:08:45 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200609210208.k8L28jFv005798@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.262 -> 1.263 --- Log message: Fix compile error. --- Diffs of the changes: (+4 -4) X86ISelLowering.cpp | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.262 llvm/lib/Target/X86/X86ISelLowering.cpp:1.263 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.262 Wed Sep 20 17:03:51 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Wed Sep 20 21:08:31 2006 @@ -1564,13 +1564,13 @@ default: assert(0 && "Unknown value type!"); case MVT::i8: case MVT::i16: - case MVT::i32: + case MVT::i32: { unsigned MaxNumIntRegs = (isFastCall ? 2 : FASTCC_NUM_INT_ARGS_INREGS); if (NumIntRegs < MaxNumIntRegs) { ++NumIntRegs; break; } - // Fall through + } // Fall through case MVT::f32: NumBytes += 4; break; @@ -1618,7 +1618,7 @@ default: assert(0 && "Unexpected ValueType for argument!"); case MVT::i8: case MVT::i16: - case MVT::i32: + case MVT::i32: { unsigned MaxNumIntRegs = (isFastCall ? 2 : FASTCC_NUM_INT_ARGS_INREGS); if (NumIntRegs < MaxNumIntRegs) { RegsToPass.push_back( @@ -1627,7 +1627,7 @@ ++NumIntRegs; break; } - // Fall through + } // Fall through case MVT::f32: { SDOperand PtrOff = DAG.getConstant(ArgOffset, getPointerTy()); PtrOff = DAG.getNode(ISD::ADD, getPointerTy(), StackPtr, PtrOff); From sabre at nondot.org Thu Sep 21 00:11:15 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 21 Sep 2006 00:11:15 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/IndVarsSimplify/2006-09-20-LFTR-Crash.ll Message-ID: <200609210511.k8L5BFKv008683@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/IndVarsSimplify: 2006-09-20-LFTR-Crash.ll added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+46 -0) 2006-09-20-LFTR-Crash.ll | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 46 insertions(+) Index: llvm/test/Regression/Transforms/IndVarsSimplify/2006-09-20-LFTR-Crash.ll diff -c /dev/null llvm/test/Regression/Transforms/IndVarsSimplify/2006-09-20-LFTR-Crash.ll:1.1 *** /dev/null Thu Sep 21 00:11:11 2006 --- llvm/test/Regression/Transforms/IndVarsSimplify/2006-09-20-LFTR-Crash.ll Thu Sep 21 00:11:01 2006 *************** *** 0 **** --- 1,46 ---- + ; RUN: llvm-as < %s | opt -indvars -disable-output + + %struct.p7prior_s = type { int, int, [200 x float], [200 x [7 x float]], int, [200 x float], [200 x [20 x float]], int, [200 x float], [200 x [20 x float]] } + + implementation ; Functions: + + void %P7DefaultPrior() { + entry: + switch int 0, label %UnifiedReturnBlock [ + int 2, label %bb160 + int 3, label %bb + ] + + bb: ; preds = %entry + br bool false, label %cond_true.i, label %sre_malloc.exit + + cond_true.i: ; preds = %bb + unreachable + + sre_malloc.exit: ; preds = %bb + br label %cond_true + + cond_true: ; preds = %cond_true66, %cond_true, %sre_malloc.exit + %tmp59 = phi int [ 1, %sre_malloc.exit ], [ %phitmp, %cond_true66 ], [ %tmp59, %cond_true ] ; [#uses=2] + %indvar245.0.ph = phi uint [ 0, %sre_malloc.exit ], [ %indvar.next246, %cond_true66 ], [ %indvar245.0.ph, %cond_true ] ; [#uses=2] + br bool false, label %bb57, label %cond_true + + bb57: ; preds = %cond_true + %tmp65 = setgt int 0, %tmp59 ; [#uses=1] + %indvar.next246 = add uint %indvar245.0.ph, 1 ; [#uses=2] + br bool %tmp65, label %cond_true66, label %bb69 + + cond_true66: ; preds = %bb57 + %q.1.0 = cast uint %indvar.next246 to int ; [#uses=1] + %phitmp = add int %q.1.0, 1 ; [#uses=1] + br label %cond_true + + bb69: ; preds = %bb57 + ret void + + bb160: ; preds = %entry + ret void + + UnifiedReturnBlock: ; preds = %entry + ret void + } From sabre at nondot.org Thu Sep 21 00:12:34 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 21 Sep 2006 00:12:34 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp Message-ID: <200609210512.k8L5CYnS008755@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: IndVarSimplify.cpp updated: 1.94 -> 1.95 --- Log message: Fix Transforms/IndVarsSimplify/2006-09-20-LFTR-Crash.ll --- Diffs of the changes: (+22 -15) IndVarSimplify.cpp | 37 ++++++++++++++++++++++--------------- 1 files changed, 22 insertions(+), 15 deletions(-) Index: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp diff -u llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.94 llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.95 --- llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.94 Sun Aug 27 17:42:52 2006 +++ llvm/lib/Transforms/Scalar/IndVarSimplify.cpp Thu Sep 21 00:12:20 2006 @@ -86,8 +86,8 @@ void runOnLoop(Loop *L); void EliminatePointerRecurrence(PHINode *PN, BasicBlock *Preheader, std::set &DeadInsts); - void LinearFunctionTestReplace(Loop *L, SCEV *IterationCount, - SCEVExpander &RW); + Instruction *LinearFunctionTestReplace(Loop *L, SCEV *IterationCount, + SCEVExpander &RW); void RewriteLoopExitValues(Loop *L); void DeleteTriviallyDeadInstructions(std::set &Insts); @@ -209,13 +209,17 @@ /// variable. This pass is able to rewrite the exit tests of any loop where the /// SCEV analysis can determine a loop-invariant trip count of the loop, which /// is actually a much broader range than just linear tests. -void IndVarSimplify::LinearFunctionTestReplace(Loop *L, SCEV *IterationCount, - SCEVExpander &RW) { +/// +/// This method returns a "potentially dead" instruction whose computation chain +/// should be deleted when convenient. +Instruction *IndVarSimplify::LinearFunctionTestReplace(Loop *L, + SCEV *IterationCount, + SCEVExpander &RW) { // Find the exit block for the loop. We can currently only handle loops with // a single exit. std::vector ExitBlocks; L->getExitBlocks(ExitBlocks); - if (ExitBlocks.size() != 1) return; + if (ExitBlocks.size() != 1) return 0; BasicBlock *ExitBlock = ExitBlocks[0]; // Make sure there is only one predecessor block in the loop. @@ -226,19 +230,17 @@ if (ExitingBlock == 0) ExitingBlock = *PI; else - return; // Multiple exits from loop to this block. + return 0; // Multiple exits from loop to this block. } assert(ExitingBlock && "Loop info is broken"); if (!isa(ExitingBlock->getTerminator())) - return; // Can't rewrite non-branch yet + return 0; // Can't rewrite non-branch yet BranchInst *BI = cast(ExitingBlock->getTerminator()); assert(BI->isConditional() && "Must be conditional to be part of loop!"); - std::set InstructionsToDelete; - if (Instruction *Cond = dyn_cast(BI->getCondition())) - InstructionsToDelete.insert(Cond); - + Instruction *PotentiallyDeadInst = dyn_cast(BI->getCondition()); + // If the exiting block is not the same as the backedge block, we must compare // against the preincremented value, otherwise we prefer to compare against // the post-incremented value. @@ -279,8 +281,7 @@ BI->setCondition(Cond); ++NumLFTR; Changed = true; - - DeleteTriviallyDeadInstructions(InstructionsToDelete); + return PotentiallyDeadInst; } @@ -471,7 +472,12 @@ SCEVExpander Rewriter(*SE, *LI); Rewriter.getOrInsertCanonicalInductionVariable(L, IterationCount->getType()); - LinearFunctionTestReplace(L, IterationCount, Rewriter); + if (Instruction *I = LinearFunctionTestReplace(L, IterationCount, + Rewriter)) { + std::set InstructionsToDelete; + InstructionsToDelete.insert(I); + DeleteTriviallyDeadInstructions(InstructionsToDelete); + } } return; } @@ -498,7 +504,8 @@ Changed = true; if (!isa(IterationCount)) - LinearFunctionTestReplace(L, IterationCount, Rewriter); + if (Instruction *DI = LinearFunctionTestReplace(L, IterationCount,Rewriter)) + DeadInsts.insert(DI); // Now that we have a canonical induction variable, we can rewrite any // recurrences in terms of the induction variable. Start with the auxillary From sabre at nondot.org Thu Sep 21 00:46:14 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 21 Sep 2006 00:46:14 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/README.txt Message-ID: <200609210546.k8L5kEVh009369@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: README.txt updated: 1.137 -> 1.138 --- Log message: Fit in 80-cols --- Diffs of the changes: (+10 -9) README.txt | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-) Index: llvm/lib/Target/X86/README.txt diff -u llvm/lib/Target/X86/README.txt:1.137 llvm/lib/Target/X86/README.txt:1.138 --- llvm/lib/Target/X86/README.txt:1.137 Wed Sep 20 01:32:10 2006 +++ llvm/lib/Target/X86/README.txt Thu Sep 21 00:46:00 2006 @@ -544,9 +544,9 @@ br label %cond_true cond_true: ; preds = %cond_true, %entry - %x.0.0 = phi int [ 0, %entry ], [ %tmp9, %cond_true ] ; [#uses=3] - %t_addr.0.0 = phi int [ %t, %entry ], [ %tmp7, %cond_true ] ; [#uses=1] - %tmp2 = getelementptr int* %a, int %x.0.0 ; [#uses=1] + %x.0.0 = phi int [ 0, %entry ], [ %tmp9, %cond_true ] + %t_addr.0.0 = phi int [ %t, %entry ], [ %tmp7, %cond_true ] + %tmp2 = getelementptr int* %a, int %x.0.0 %tmp3 = load int* %tmp2 ; [#uses=1] %tmp5 = add int %t_addr.0.0, %x.0.0 ; [#uses=1] %tmp7 = add int %tmp5, %tmp3 ; [#uses=2] @@ -633,11 +633,12 @@ LBB1_2: #UnifiedReturnBlock ret -In the code above, the 'if' is turned into a 'switch' at the mid-level. It looks -like the 'lower to branches' mode could be improved a little here. In particular, -the fall-through to LBB1_3 doesn't need a branch. It would also be nice to -eliminate the redundant "cmp 6", maybe by lowering to a linear sequence of -compares if there are below a certain number of cases (instead of a binary sequence)? +In the code above, the 'if' is turned into a 'switch' at the mid-level. It +looks like the 'lower to branches' mode could be improved a little here. In +particular, the fall-through to LBB1_3 doesn't need a branch. It would also be +nice to eliminate the redundant "cmp 6", maybe by lowering to a linear sequence +of compares if there are below a certain number of cases (instead of a binary +sequence)? //===---------------------------------------------------------------------===// @@ -645,7 +646,7 @@ int %test(ulong *%tmp) { %tmp = load ulong* %tmp ; [#uses=1] %tmp.mask = shr ulong %tmp, ubyte 50 ; [#uses=1] - %tmp.mask = cast ulong %tmp.mask to ubyte ; [#uses=1] + %tmp.mask = cast ulong %tmp.mask to ubyte %tmp2 = and ubyte %tmp.mask, 3 ; [#uses=1] %tmp2 = cast ubyte %tmp2 to int ; [#uses=1] ret int %tmp2 From sabre at nondot.org Thu Sep 21 01:00:35 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 21 Sep 2006 01:00:35 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200609210600.k8L60ZHr009625@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.190 -> 1.191 --- Log message: Generalize (zext (truncate x)) and (sext (truncate x)) folding to work when the src/dst are not the same size. This catches things like "truncate 32-bit X to 8 bits, then zext to 16", which happens a bit on X86. --- Diffs of the changes: (+24 -9) DAGCombiner.cpp | 33 ++++++++++++++++++++++++--------- 1 files changed, 24 insertions(+), 9 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.190 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.191 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.190 Wed Sep 20 01:41:35 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Sep 21 01:00:20 2006 @@ -1766,12 +1766,18 @@ if (N0.getOpcode() == ISD::SIGN_EXTEND || N0.getOpcode() == ISD::ANY_EXTEND) return DAG.getNode(ISD::SIGN_EXTEND, VT, N0.getOperand(0)); - // fold (sext (truncate x)) -> (sextinreg x) iff x size == sext size. - if (N0.getOpcode() == ISD::TRUNCATE && N0.getOperand(0).getValueType() == VT&& - (!AfterLegalize || - TLI.isOperationLegal(ISD::SIGN_EXTEND_INREG, N0.getValueType()))) - return DAG.getNode(ISD::SIGN_EXTEND_INREG, VT, N0.getOperand(0), + // fold (sext (truncate x)) -> (sextinreg x). + if (N0.getOpcode() == ISD::TRUNCATE && + (!AfterLegalize || TLI.isOperationLegal(ISD::SIGN_EXTEND_INREG, VT))) { + SDOperand Op = N0.getOperand(0); + if (Op.getValueType() < VT) { + Op = DAG.getNode(ISD::ANY_EXTEND, VT, Op); + } else if (Op.getValueType() > VT) { + Op = DAG.getNode(ISD::TRUNCATE, VT, Op); + } + return DAG.getNode(ISD::SIGN_EXTEND_INREG, VT, Op, DAG.getValueType(N0.getValueType())); + } // fold (sext (load x)) -> (sext (truncate (sextload x))) if (N0.getOpcode() == ISD::LOAD && N0.hasOneUse() && @@ -1812,10 +1818,19 @@ // fold (zext (aext x)) -> (zext x) if (N0.getOpcode() == ISD::ZERO_EXTEND || N0.getOpcode() == ISD::ANY_EXTEND) return DAG.getNode(ISD::ZERO_EXTEND, VT, N0.getOperand(0)); - // fold (zext (truncate x)) -> (zextinreg x) iff x size == zext size. - if (N0.getOpcode() == ISD::TRUNCATE && N0.getOperand(0).getValueType() == VT&& - (!AfterLegalize || TLI.isOperationLegal(ISD::AND, N0.getValueType()))) - return DAG.getZeroExtendInReg(N0.getOperand(0), N0.getValueType()); + + // fold (zext (truncate x)) -> (and x, mask) + if (N0.getOpcode() == ISD::TRUNCATE && + (!AfterLegalize || TLI.isOperationLegal(ISD::AND, VT))) { + SDOperand Op = N0.getOperand(0); + if (Op.getValueType() < VT) { + Op = DAG.getNode(ISD::ANY_EXTEND, VT, Op); + } else if (Op.getValueType() > VT) { + Op = DAG.getNode(ISD::TRUNCATE, VT, Op); + } + return DAG.getZeroExtendInReg(Op, N0.getValueType()); + } + // fold (zext (load x)) -> (zext (truncate (zextload x))) if (N0.getOpcode() == ISD::LOAD && N0.hasOneUse() && (!AfterLegalize||TLI.isOperationLegal(ISD::ZEXTLOAD, N0.getValueType()))){ From sabre at nondot.org Thu Sep 21 01:14:45 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 21 Sep 2006 01:14:45 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200609210614.k8L6Ejc2009898@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.191 -> 1.192 --- Log message: Compile: int %test(ulong *%tmp) { %tmp = load ulong* %tmp ; [#uses=1] %tmp.mask = shr ulong %tmp, ubyte 50 ; [#uses=1] %tmp.mask = cast ulong %tmp.mask to ubyte %tmp2 = and ubyte %tmp.mask, 3 ; [#uses=1] %tmp2 = cast ubyte %tmp2 to int ; [#uses=1] ret int %tmp2 } to: _test: movl 4(%esp), %eax movl 4(%eax), %eax shrl $18, %eax andl $3, %eax ret instead of: _test: movl 4(%esp), %eax movl 4(%eax), %eax shrl $18, %eax # TRUNCATE movb %al, %al andb $3, %al movzbl %al, %eax ret --- Diffs of the changes: (+14 -0) DAGCombiner.cpp | 14 ++++++++++++++ 1 files changed, 14 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.191 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.192 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.191 Thu Sep 21 01:00:20 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Sep 21 01:14:31 2006 @@ -1831,6 +1831,20 @@ return DAG.getZeroExtendInReg(Op, N0.getValueType()); } + // fold (zext (and (trunc x), cst)) -> (and x, cst). + if (N0.getOpcode() == ISD::AND && + N0.getOperand(0).getOpcode() == ISD::TRUNCATE && + N0.getOperand(1).getOpcode() == ISD::Constant) { + SDOperand X = N0.getOperand(0).getOperand(0); + if (X.getValueType() < VT) { + X = DAG.getNode(ISD::ANY_EXTEND, VT, X); + } else if (X.getValueType() > VT) { + X = DAG.getNode(ISD::TRUNCATE, VT, X); + } + uint64_t Mask = cast(N0.getOperand(1))->getValue(); + return DAG.getNode(ISD::AND, VT, X, DAG.getConstant(Mask, VT)); + } + // fold (zext (load x)) -> (zext (truncate (zextload x))) if (N0.getOpcode() == ISD::LOAD && N0.hasOneUse() && (!AfterLegalize||TLI.isOperationLegal(ISD::ZEXTLOAD, N0.getValueType()))){ From sabre at nondot.org Thu Sep 21 01:15:08 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 21 Sep 2006 01:15:08 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/README.txt Message-ID: <200609210615.k8L6F8mM009932@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: README.txt updated: 1.138 -> 1.139 --- Log message: implemented --- Diffs of the changes: (+0 -35) README.txt | 35 ----------------------------------- 1 files changed, 35 deletions(-) Index: llvm/lib/Target/X86/README.txt diff -u llvm/lib/Target/X86/README.txt:1.138 llvm/lib/Target/X86/README.txt:1.139 --- llvm/lib/Target/X86/README.txt:1.138 Thu Sep 21 00:46:00 2006 +++ llvm/lib/Target/X86/README.txt Thu Sep 21 01:14:54 2006 @@ -642,41 +642,6 @@ //===---------------------------------------------------------------------===// -Compile: -int %test(ulong *%tmp) { - %tmp = load ulong* %tmp ; [#uses=1] - %tmp.mask = shr ulong %tmp, ubyte 50 ; [#uses=1] - %tmp.mask = cast ulong %tmp.mask to ubyte - %tmp2 = and ubyte %tmp.mask, 3 ; [#uses=1] - %tmp2 = cast ubyte %tmp2 to int ; [#uses=1] - ret int %tmp2 -} - -to: - -_test: - movl 4(%esp), %eax - movl 4(%eax), %eax - shrl $18, %eax - andl $3, %eax - ret - -instead of: - -_test: - movl 4(%esp), %eax - movl 4(%eax), %eax - shrl $18, %eax - # TRUNCATE movb %al, %al - andb $3, %al - movzbl %al, %eax - ret - -This saves a movzbl, and saves a truncate if it doesn't get coallesced right. -This is a simple DAGCombine to propagate the zext through the and. - -//===---------------------------------------------------------------------===// - GCC's ix86_expand_int_movcc function (in i386.c) has a ton of interesting simplifications for integer "x cmp y ? a : b". For example, instead of: From sabre at nondot.org Thu Sep 21 01:17:53 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 21 Sep 2006 01:17:53 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200609210617.k8L6Hr2K009998@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.192 -> 1.193 --- Log message: Check the right value type. This fixes 186.crafty on x86 --- Diffs of the changes: (+2 -1) DAGCombiner.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.192 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.193 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.192 Thu Sep 21 01:14:31 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Sep 21 01:17:39 2006 @@ -1768,7 +1768,8 @@ // fold (sext (truncate x)) -> (sextinreg x). if (N0.getOpcode() == ISD::TRUNCATE && - (!AfterLegalize || TLI.isOperationLegal(ISD::SIGN_EXTEND_INREG, VT))) { + (!AfterLegalize || TLI.isOperationLegal(ISD::SIGN_EXTEND_INREG, + N0.getValueType()))) { SDOperand Op = N0.getOperand(0); if (Op.getValueType() < VT) { Op = DAG.getNode(ISD::ANY_EXTEND, VT, Op); From sabre at nondot.org Thu Sep 21 01:40:57 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 21 Sep 2006 01:40:57 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200609210640.k8L6ev2C010446@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.193 -> 1.194 --- Log message: fold (aext (and (trunc x), cst)) -> (and x, cst). --- Diffs of the changes: (+15 -0) DAGCombiner.cpp | 15 +++++++++++++++ 1 files changed, 15 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.193 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.194 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.193 Thu Sep 21 01:17:39 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Sep 21 01:40:43 2006 @@ -1897,6 +1897,21 @@ return DAG.getNode(ISD::TRUNCATE, VT, TruncOp); return DAG.getNode(ISD::ANY_EXTEND, VT, TruncOp); } + + // fold (aext (and (trunc x), cst)) -> (and x, cst). + if (N0.getOpcode() == ISD::AND && + N0.getOperand(0).getOpcode() == ISD::TRUNCATE && + N0.getOperand(1).getOpcode() == ISD::Constant) { + SDOperand X = N0.getOperand(0).getOperand(0); + if (X.getValueType() < VT) { + X = DAG.getNode(ISD::ANY_EXTEND, VT, X); + } else if (X.getValueType() > VT) { + X = DAG.getNode(ISD::TRUNCATE, VT, X); + } + uint64_t Mask = cast(N0.getOperand(1))->getValue(); + return DAG.getNode(ISD::AND, VT, X, DAG.getConstant(Mask, VT)); + } + // fold (aext (load x)) -> (aext (truncate (extload x))) if (N0.getOpcode() == ISD::LOAD && N0.hasOneUse() && (!AfterLegalize||TLI.isOperationLegal(ISD::EXTLOAD, N0.getValueType()))) { From evan.cheng at apple.com Thu Sep 21 01:58:36 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 21 Sep 2006 01:58:36 -0500 Subject: [llvm-commits] CVS: llvm-test/External/HMMER/Makefile Message-ID: <200609210658.k8L6waCV010738@zion.cs.uiuc.edu> Changes in directory llvm-test/External/HMMER: Makefile updated: 1.1 -> 1.2 --- Log message: Set its random seed to a fixed number. --- Diffs of the changes: (+2 -2) Makefile | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-test/External/HMMER/Makefile diff -u llvm-test/External/HMMER/Makefile:1.1 llvm-test/External/HMMER/Makefile:1.2 --- llvm-test/External/HMMER/Makefile:1.1 Wed Sep 20 18:43:34 2006 +++ llvm-test/External/HMMER/Makefile Thu Sep 21 01:58:22 2006 @@ -8,9 +8,9 @@ CPPFLAGS = -DSSE2 ifdef LARGE_PROBLEM_SIZE -RUN_OPTIONS = --fixed 400 --cpu 1 --num 200000 $(HMMER_ROOT)/globin.hmm +RUN_OPTIONS = --fixed 400 --cpu 1 --num 200000 --seed 1158818515 $(HMMER_ROOT)/globin.hmm else -RUN_OPTIONS = --fixed 400 --cpu 1 --num 80000 $(HMMER_ROOT)/globin.hmm +RUN_OPTIONS = --fixed 400 --cpu 1 --num 80000 --seed 1158818515 $(HMMER_ROOT)/globin.hmm endif include $(LEVEL)/MultiSource/Makefile.multisrc From isanbard at gmail.com Thu Sep 21 03:48:17 2006 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 21 Sep 2006 03:48:17 -0500 Subject: [llvm-commits] CVS: llvm-test/autoconf/configure.ac Message-ID: <200609210848.k8L8mHu9020860@zion.cs.uiuc.edu> Changes in directory llvm-test/autoconf: configure.ac updated: 1.38 -> 1.39 --- Log message: Added generating of the Makefile.nagfortran in the build directory. --- Diffs of the changes: (+1 -0) configure.ac | 1 + 1 files changed, 1 insertion(+) Index: llvm-test/autoconf/configure.ac diff -u llvm-test/autoconf/configure.ac:1.38 llvm-test/autoconf/configure.ac:1.39 --- llvm-test/autoconf/configure.ac:1.38 Wed Sep 20 18:40:57 2006 +++ llvm-test/autoconf/configure.ac Thu Sep 21 03:48:02 2006 @@ -12,6 +12,7 @@ AC_CONFIG_FILES([Makefile.config]) AC_CONFIG_MAKEFILE(Makefile) AC_CONFIG_MAKEFILE(Makefile.common) +AC_CONFIG_MAKEFILE(Makefile.nagfortran) AC_CONFIG_MAKEFILE(Makefile.f2c) AC_CONFIG_MAKEFILE(Makefile.programs) AC_CONFIG_MAKEFILE(Makefile.tests) From isanbard at gmail.com Thu Sep 21 03:48:17 2006 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 21 Sep 2006 03:48:17 -0500 Subject: [llvm-commits] CVS: llvm-test/configure Message-ID: <200609210848.k8L8mHJS020855@zion.cs.uiuc.edu> Changes in directory llvm-test: configure updated: 1.40 -> 1.41 --- Log message: Added generating of the Makefile.nagfortran in the build directory. --- Diffs of the changes: (+29 -23) configure | 52 +++++++++++++++++++++++++++++----------------------- 1 files changed, 29 insertions(+), 23 deletions(-) Index: llvm-test/configure diff -u llvm-test/configure:1.40 llvm-test/configure:1.41 --- llvm-test/configure:1.40 Wed Sep 20 18:40:57 2006 +++ llvm-test/configure Thu Sep 21 03:48:02 2006 @@ -1997,6 +1997,9 @@ ac_config_commands="$ac_config_commands Makefile.common" +ac_config_commands="$ac_config_commands Makefile.nagfortran" + + ac_config_commands="$ac_config_commands Makefile.f2c" @@ -5384,7 +5387,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5387 "configure"' > conftest.$ac_ext + echo '#line 5390 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7549,11 +7552,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7552: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7555: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7556: \$? = $ac_status" >&5 + echo "$as_me:7559: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7817,11 +7820,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7820: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7823: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7824: \$? = $ac_status" >&5 + echo "$as_me:7827: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7921,11 +7924,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7924: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7927: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7928: \$? = $ac_status" >&5 + echo "$as_me:7931: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -10373,7 +10376,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:12847: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12848: \$? = $ac_status" >&5 + echo "$as_me:12851: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -12945,11 +12948,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12948: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12951: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12952: \$? = $ac_status" >&5 + echo "$as_me:12955: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14515,11 +14518,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14518: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14521: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14522: \$? = $ac_status" >&5 + echo "$as_me:14525: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14619,11 +14622,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14622: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14625: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14626: \$? = $ac_status" >&5 + echo "$as_me:14629: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -16854,11 +16857,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16857: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16860: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16861: \$? = $ac_status" >&5 + echo "$as_me:16864: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17122,11 +17125,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17125: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17128: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17129: \$? = $ac_status" >&5 + echo "$as_me:17132: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17226,11 +17229,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17229: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17232: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:17233: \$? = $ac_status" >&5 + echo "$as_me:17236: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -21514,6 +21517,7 @@ "Makefile.config") CONFIG_FILES="$CONFIG_FILES Makefile.config" ;; "Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;; "Makefile.common") CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile.common" ;; + "Makefile.nagfortran") CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile.nagfortran" ;; "Makefile.f2c") CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile.f2c" ;; "Makefile.programs") CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile.programs" ;; "Makefile.tests") CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile.tests" ;; @@ -22072,6 +22076,8 @@ ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/Makefile Makefile ;; "Makefile.common":C) ${llvm_src}/autoconf/mkinstalldirs `dirname Makefile.common` ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/Makefile.common Makefile.common ;; + "Makefile.nagfortran":C) ${llvm_src}/autoconf/mkinstalldirs `dirname Makefile.nagfortran` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/Makefile.nagfortran Makefile.nagfortran ;; "Makefile.f2c":C) ${llvm_src}/autoconf/mkinstalldirs `dirname Makefile.f2c` ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/Makefile.f2c Makefile.f2c ;; "Makefile.programs":C) ${llvm_src}/autoconf/mkinstalldirs `dirname Makefile.programs` From isanbard at gmail.com Thu Sep 21 03:49:37 2006 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 21 Sep 2006 03:49:37 -0500 Subject: [llvm-commits] CVS: llvm-test/Makefile.nagfortran Message-ID: <200609210849.k8L8nbqx020893@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.nagfortran updated: 1.6 -> 1.7 --- Log message: Change so that access to the "filepp" shell script is found in the PROJ_SRC_ROOT instead of LEVEL. --- Diffs of the changes: (+2 -2) Makefile.nagfortran | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-test/Makefile.nagfortran diff -u llvm-test/Makefile.nagfortran:1.6 llvm-test/Makefile.nagfortran:1.7 --- llvm-test/Makefile.nagfortran:1.6 Tue Feb 28 12:08:54 2006 +++ llvm-test/Makefile.nagfortran Thu Sep 21 03:49:23 2006 @@ -39,13 +39,13 @@ $(F95) -w -S -O2 $< -o $@ $(NAGFORTRAN_FLAGS) %.f: %.F - $(LEVEL)/filepp $< -o $@ -M $(SPEC_BENCH_DIR)/src/ $(FPPFLAGS) + $(PROJ_SRC_ROOT)/filepp $< -o $@ -M $(SPEC_BENCH_DIR)/src/ $(FPPFLAGS) %.c: %.f90 $(F95) -w -S -O2 $< -o $@ $(NAGFORTRAN_FLAGS) %.f90: %.F90 - $(LEVEL)/filepp $< -o $@ -M $(SPEC_BENCH_DIR)/src/ $(FPPFLAGS) + $(PROJ_SRC_ROOT)/filepp $< -o $@ -M $(SPEC_BENCH_DIR)/src/ $(FPPFLAGS) CPPFLAGS += -I$(F95_DIR)/lib/NAGWare LDFLAGS += $(F95_DIR)/lib/NAGWare/quickfit.o -Xlinker -flat_namespace $(F95_DIR)/lib/NAGWare/libf97.dylib $(F95_DIR)/lib/NAGWare/libf96.a From isanbard at gmail.com Thu Sep 21 03:50:33 2006 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 21 Sep 2006 03:50:33 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/410.bwaves/Makefile Message-ID: <200609210850.k8L8oX0n020924@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/410.bwaves: Makefile updated: 1.1 -> 1.2 --- Log message: Needed the stdin/stdout filenames. --- Diffs of the changes: (+5 -1) Makefile | 6 +++++- 1 files changed, 5 insertions(+), 1 deletion(-) Index: llvm-test/External/SPEC/CFP2006/410.bwaves/Makefile diff -u llvm-test/External/SPEC/CFP2006/410.bwaves/Makefile:1.1 llvm-test/External/SPEC/CFP2006/410.bwaves/Makefile:1.2 --- llvm-test/External/SPEC/CFP2006/410.bwaves/Makefile:1.1 Fri Sep 1 18:27:13 2006 +++ llvm-test/External/SPEC/CFP2006/410.bwaves/Makefile Thu Sep 21 03:50:19 2006 @@ -10,4 +10,8 @@ FP_ABSTOLERANCE = 1.0e-16 include ../../Makefile.spec2006 -include $(PROJ_SRC_ROOT)/Makefile.FORTRAN +include $(LEVEL)/Makefile.FORTRAN + +STDIN_FILENAME := bwaves.in +STDOUT_FILENAME := bwaves.out +STDERR_FILENAME := bwaves.err From rafael.espindola at gmail.com Thu Sep 21 06:30:06 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Thu, 21 Sep 2006 06:30:06 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Message-ID: <200609211130.k8LBU6S3029666@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMISelDAGToDAG.cpp updated: 1.45 -> 1.46 --- Log message: if a constant can't be an immediate, add it to the constant pool --- Diffs of the changes: (+34 -4) ARMISelDAGToDAG.cpp | 38 ++++++++++++++++++++++++++++++++++---- 1 files changed, 34 insertions(+), 4 deletions(-) Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.45 llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.46 --- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.45 Wed Sep 13 07:09:43 2006 +++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Thu Sep 21 06:29:52 2006 @@ -16,6 +16,7 @@ #include "llvm/CallingConv.h" #include "llvm/DerivedTypes.h" #include "llvm/Function.h" +#include "llvm/Constants.h" #include "llvm/Intrinsics.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineFunction.h" @@ -466,7 +467,7 @@ return false; int32_t t = cast(N)->getValue(); - int max = 2<<12 - 1; + int max = 1<<12; int min = -max; if (t > min && t < max) { Imm = t; @@ -480,15 +481,44 @@ return isInt12Immediate(Op.Val, Imm); } +static uint32_t rotateL(uint32_t x) { + uint32_t bit31 = (x & (1 << 31)) >> 31; + uint32_t t = x << 1; + return t | bit31; +} + +static bool isUInt8Immediate(uint32_t x) { + return x < (1 << 8); +} + +static bool isRotInt8Immediate(uint32_t x) { + int r; + for (r = 0; r < 16; r++) { + if (isUInt8Immediate(x)) + return true; + x = rotateL(rotateL(x)); + } + return false; +} + bool ARMDAGToDAGISel::SelectAddrMode1(SDOperand N, SDOperand &Arg, SDOperand &Shift, SDOperand &ShiftType) { switch(N.getOpcode()) { case ISD::Constant: { - //TODO:check that we have a valid constant - int32_t t = cast(N)->getValue(); - Arg = CurDAG->getTargetConstant(t, MVT::i32); + uint32_t val = cast(N)->getValue(); + if(!isRotInt8Immediate(val)) { + const Type *t = MVT::getTypeForValueType(MVT::i32); + Constant *C = ConstantUInt::get(t, val); + int alignment = 2; + SDOperand Addr = CurDAG->getTargetConstantPool(C, MVT::i32, alignment); + SDOperand Z = CurDAG->getTargetConstant(0, MVT::i32); + SDNode *n = CurDAG->getTargetNode(ARM::ldr, MVT::i32, Z, Addr); + Arg = SDOperand(n, 0); + } else + Arg = CurDAG->getTargetConstant(val, MVT::i32); + Shift = CurDAG->getTargetConstant(0, MVT::i32); ShiftType = CurDAG->getTargetConstant(ARMShift::LSL, MVT::i32); return true; From rafael.espindola at gmail.com Thu Sep 21 06:30:08 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Thu, 21 Sep 2006 06:30:08 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/ARM/constants.ll long.ll ret0.ll Message-ID: <200609211130.k8LBU8hN029673@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/ARM: constants.ll added (r1.1) long.ll updated: 1.1 -> 1.2 ret0.ll (r1.1) removed --- Log message: if a constant can't be an immediate, add it to the constant pool --- Diffs of the changes: (+33 -3) constants.ll | 31 +++++++++++++++++++++++++++++++ long.ll | 5 ++--- 2 files changed, 33 insertions(+), 3 deletions(-) Index: llvm/test/Regression/CodeGen/ARM/constants.ll diff -c /dev/null llvm/test/Regression/CodeGen/ARM/constants.ll:1.1 *** /dev/null Thu Sep 21 06:30:02 2006 --- llvm/test/Regression/CodeGen/ARM/constants.ll Thu Sep 21 06:29:52 2006 *************** *** 0 **** --- 1,31 ---- + ; RUN: llvm-as < %s | llc -march=arm && + ; RUN: llvm-as < %s | llc -march=arm | grep "mov r0, #0" | wc -l | grep 1 && + ; RUN: llvm-as < %s | llc -march=arm | grep "mov r0, #255" | wc -l | grep 1 && + ; RUN: llvm-as < %s | llc -march=arm | grep "mov r0, #256" | wc -l | grep 1 && + ; RUN: llvm-as < %s | llc -march=arm | grep ".word.*257" | wc -l | grep 1 && + ; RUN: llvm-as < %s | llc -march=arm | grep "mov r0, #-1073741761" | wc -l | grep 1 && + ; RUN: llvm-as < %s | llc -march=arm | grep "mov r0, #1008" | wc -l | grep 1 + + uint %f1() { + ret uint 0 + } + + uint %f2() { + ret uint 255 + } + + uint %f3() { + ret uint 256 + } + + uint %f4() { + ret uint 257 + } + + uint %f5() { + ret uint 3221225535 + } + + uint %f6() { + ret uint 1008 + } Index: llvm/test/Regression/CodeGen/ARM/long.ll diff -u llvm/test/Regression/CodeGen/ARM/long.ll:1.1 llvm/test/Regression/CodeGen/ARM/long.ll:1.2 --- llvm/test/Regression/CodeGen/ARM/long.ll:1.1 Mon Sep 4 14:05:01 2006 +++ llvm/test/Regression/CodeGen/ARM/long.ll Thu Sep 21 06:29:52 2006 @@ -1,10 +1,9 @@ ; RUN: llvm-as < %s | llc -march=arm && ; RUN: llvm-as < %s | llc -march=arm | grep "mov r1, #0" | wc -l | grep 4 && ; RUN: llvm-as < %s | llc -march=arm | grep "mov r0, #1" | wc -l | grep 1 && -; RUN: llvm-as < %s | llc -march=arm | grep "mov r0, #2147483647" | wc -l | grep 1 && +; RUN: llvm-as < %s | llc -march=arm | grep ".word.*2147483647" | wc -l | grep 2 && ; RUN: llvm-as < %s | llc -march=arm | grep "mov r0, #-2147483648" | wc -l | grep 1 && -; RUN: llvm-as < %s | llc -march=arm | grep "mov r0, #-1" | wc -l | grep 1 && -; RUN: llvm-as < %s | llc -march=arm | grep "mov r1, #2147483647" | wc -l | grep 1 +; RUN: llvm-as < %s | llc -march=arm | grep ".word.*4294967295" | wc -l | grep 1 long %f1() { entry: From rafael.espindola at gmail.com Thu Sep 21 08:06:41 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Thu, 21 Sep 2006 08:06:41 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Message-ID: <200609211306.k8LD6f20031243@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMISelDAGToDAG.cpp updated: 1.46 -> 1.47 --- Log message: more condition codes --- Diffs of the changes: (+8 -1) ARMISelDAGToDAG.cpp | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletion(-) Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.46 llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.47 --- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.46 Thu Sep 21 06:29:52 2006 +++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Thu Sep 21 08:06:26 2006 @@ -87,7 +87,14 @@ /// DAGCCToARMCC - Convert a DAG integer condition code to an ARM CC static ARMCC::CondCodes DAGCCToARMCC(ISD::CondCode CC) { switch (CC) { - default: assert(0 && "Unknown condition code!"); + default: + std::cerr << "CC = " << CC << "\n"; + assert(0 && "Unknown condition code!"); + case ISD::SETUGT: return ARMCC::HI; + case ISD::SETULE: return ARMCC::LS; + case ISD::SETLE: return ARMCC::LE; + case ISD::SETLT: return ARMCC::LT; + case ISD::SETGT: return ARMCC::GT; case ISD::SETNE: return ARMCC::NE; case ISD::SETEQ: return ARMCC::EQ; case ISD::SETGE: return ARMCC::GE; From rafael.espindola at gmail.com Thu Sep 21 08:06:41 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Thu, 21 Sep 2006 08:06:41 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/ARM/select.ll Message-ID: <200609211306.k8LD6f5F031249@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/ARM: select.ll updated: 1.8 -> 1.9 --- Log message: more condition codes --- Diffs of the changes: (+43 -2) select.ll | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 43 insertions(+), 2 deletions(-) Index: llvm/test/Regression/CodeGen/ARM/select.ll diff -u llvm/test/Regression/CodeGen/ARM/select.ll:1.8 llvm/test/Regression/CodeGen/ARM/select.ll:1.9 --- llvm/test/Regression/CodeGen/ARM/select.ll:1.8 Fri Sep 8 07:52:50 2006 +++ llvm/test/Regression/CodeGen/ARM/select.ll Thu Sep 21 08:06:26 2006 @@ -1,8 +1,49 @@ -; RUN: llvm-as < %s | llc -march=arm +; RUN: llvm-as < %s | llc -march=arm && +; RUN: llvm-as < %s | llc -march=arm | grep moveq | wc -l | grep 1 && +; RUN: llvm-as < %s | llc -march=arm | grep movgt | wc -l | grep 1 && +; RUN: llvm-as < %s | llc -march=arm | grep movlt | wc -l | grep 1 && +; RUN: llvm-as < %s | llc -march=arm | grep movle | wc -l | grep 1 && +; RUN: llvm-as < %s | llc -march=arm | grep movls | wc -l | grep 1 && +; RUN: llvm-as < %s | llc -march=arm | grep movhi | wc -l | grep 1 -int %f(int %a) { +int %f1(int %a) { entry: %tmp = seteq int %a, 4 ; [#uses=1] %tmp1 = select bool %tmp, int 2, int 3 ret int %tmp1 } + +int %f2(int %a) { +entry: + %tmp = setgt int %a, 4 ; [#uses=1] + %tmp1 = select bool %tmp, int 2, int 3 + ret int %tmp1 +} + +int %f3(int %a, int %b) { +entry: + %tmp = setlt int %a, %b ; [#uses=1] + %tmp1 = select bool %tmp, int 2, int 3 + ret int %tmp1 +} + +int %f4(int %a, int %b) { +entry: + %tmp = setle int %a, %b ; [#uses=1] + %tmp1 = select bool %tmp, int 2, int 3 + ret int %tmp1 +} + +int %f5(uint %a, uint %b) { +entry: + %tmp = setle uint %a, %b ; [#uses=1] + %tmp1 = select bool %tmp, int 2, int 3 + ret int %tmp1 +} + +int %f6(uint %a, uint %b) { +entry: + %tmp = setgt uint %a, %b ; [#uses=1] + %tmp1 = select bool %tmp, int 2, int 3 + ret int %tmp1 +} From jlaskey at apple.com Thu Sep 21 11:29:13 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 21 Sep 2006 11:29:13 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200609211629.k8LGTDXQ002174@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.194 -> 1.195 --- Log message: Basic "in frame" alias analysis. --- Diffs of the changes: (+49 -1) DAGCombiner.cpp | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 49 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.194 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.195 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.194 Thu Sep 21 01:40:43 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Sep 21 11:28:59 2006 @@ -35,6 +35,7 @@ #include "llvm/Support/MathExtras.h" #include "llvm/Target/TargetLowering.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/CommandLine.h" #include #include #include @@ -43,8 +44,17 @@ namespace { static Statistic<> NodesCombined ("dagcombiner", "Number of dag nodes combined"); + - class VISIBILITY_HIDDEN DAGCombiner { +#ifndef NDEBUG +static cl::opt + CombinerAA("combiner-alias-analysis", cl::Hidden, + cl::desc("Turn on alias analysis turning testing")); +#else + static const bool CombinerAA = 0; +#endif + +class VISIBILITY_HIDDEN DAGCombiner { SelectionDAG &DAG; TargetLowering &TLI; bool AfterLegalize; @@ -231,6 +241,7 @@ SDOperand BuildSDIV(SDNode *N); SDOperand BuildUDIV(SDNode *N); SDNode *MatchRotate(SDOperand LHS, SDOperand RHS); + bool isNotAlias(SDOperand Ptr1, SDOperand Ptr2); public: DAGCombiner(SelectionDAG &D) : DAG(D), TLI(D.getTargetLoweringInfo()), AfterLegalize(false) {} @@ -2577,6 +2588,27 @@ return SDOperand(); } +/// isNotAlias - Return true if we have definitive knowlege that the two +/// addresses don't overlap. +bool DAGCombiner::isNotAlias(SDOperand Ptr1, SDOperand Ptr2) { + // Mind the flag. + if (!CombinerAA) return false; + + // If they are the same then they are simple aliases. + if (Ptr1 == Ptr2) return false; + + // If either operand is a frame value (not the same location from above test) + // then they can't alias. + FrameIndexSDNode *FI1 = dyn_cast(Ptr1); + FrameIndexSDNode *FI2 = dyn_cast(Ptr2); + if (FI1 || FI2) { + return true; + } + + // Otherwise we don't know and have to play it safe. + return false; +} + SDOperand DAGCombiner::visitSTORE(SDNode *N) { SDOperand Chain = N->getOperand(0); SDOperand Value = N->getOperand(1); @@ -2607,6 +2639,22 @@ if (0 && Value.getOpcode() == ISD::BIT_CONVERT) return DAG.getNode(ISD::STORE, MVT::Other, Chain, Value.getOperand(0), Ptr, SrcValue); + + // If the previous store is not an alias then break artificial chain. + if (Chain.getOpcode() == ISD::STORE && isNotAlias(Ptr, Chain.getOperand(2))) { + // Replace the chain to void dependency. + SDNode *PrevStore = Chain.Val; + SDOperand ReplStore = DAG.getNode(ISD::STORE, MVT::Other, + PrevStore->getOperand(0), Value, Ptr, + SrcValue); + // Create token to keep both stores around. + SDOperand Token = DAG.getNode(ISD::TokenFactor, MVT::Other, + Chain, ReplStore); + // Replace uses with token. + CombineTo(N, Token); + // Don't recombine on token. + return SDOperand(N, 0); + } return SDOperand(); } From dpatel at apple.com Thu Sep 21 12:23:11 2006 From: dpatel at apple.com (Devang Patel) Date: Thu, 21 Sep 2006 12:23:11 -0500 Subject: [llvm-commits] CVS: llvm/tools/lto/lto.cpp Message-ID: <200609211723.k8LHNBZv003055@zion.cs.uiuc.edu> Changes in directory llvm/tools/lto: lto.cpp updated: 1.16 -> 1.17 --- Log message: Use abstract class to facilitate dlopen() interface. --- Diffs of the changes: (+5 -5) lto.cpp | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) Index: llvm/tools/lto/lto.cpp diff -u llvm/tools/lto/lto.cpp:1.16 llvm/tools/lto/lto.cpp:1.17 --- llvm/tools/lto/lto.cpp:1.16 Thu Sep 14 00:49:10 2006 +++ llvm/tools/lto/lto.cpp Thu Sep 21 12:22:55 2006 @@ -44,7 +44,7 @@ extern "C" llvm::LinkTimeOptimizer *createLLVMOptimizer() { - llvm::LinkTimeOptimizer *l = new llvm::LinkTimeOptimizer(); + llvm::LTO *l = new llvm::LTO(); return l; } @@ -105,7 +105,7 @@ /// InputFilename is a LLVM bytecode file. If Module with InputFilename is /// available then return it. Otherwise parseInputFilename. Module * -LinkTimeOptimizer::getModule(const std::string &InputFilename) +LTO::getModule(const std::string &InputFilename) { Module *m = NULL; @@ -122,7 +122,7 @@ /// InputFilename is a LLVM bytecode file. Reade this bytecode file and /// set corresponding target triplet string. void -LinkTimeOptimizer::getTargetTriple(const std::string &InputFilename, +LTO::getTargetTriple(const std::string &InputFilename, std::string &targetTriple) { Module *m = getModule(InputFilename); @@ -135,7 +135,7 @@ /// Collect external references in references vector. /// Return LTO_READ_SUCCESS if there is no error. enum LTOStatus -LinkTimeOptimizer::readLLVMObjectFile(const std::string &InputFilename, +LTO::readLLVMObjectFile(const std::string &InputFilename, NameToSymbolMap &symbols, std::set &references) { @@ -310,7 +310,7 @@ /// native object file using OutputFilename /// Return appropriate LTOStatus. enum LTOStatus -LinkTimeOptimizer::optimizeModules(const std::string &OutputFilename, +LTO::optimizeModules(const std::string &OutputFilename, std::vector &exportList, std::string &targetTriple) { From dpatel at apple.com Thu Sep 21 12:23:10 2006 From: dpatel at apple.com (Devang Patel) Date: Thu, 21 Sep 2006 12:23:10 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/LinkTimeOptimizer.h Message-ID: <200609211723.k8LHNAeW003050@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: LinkTimeOptimizer.h updated: 1.7 -> 1.8 --- Log message: Use abstract class to facilitate dlopen() interface. --- Diffs of the changes: (+20 -2) LinkTimeOptimizer.h | 22 ++++++++++++++++++++-- 1 files changed, 20 insertions(+), 2 deletions(-) Index: llvm/include/llvm/LinkTimeOptimizer.h diff -u llvm/include/llvm/LinkTimeOptimizer.h:1.7 llvm/include/llvm/LinkTimeOptimizer.h:1.8 --- llvm/include/llvm/LinkTimeOptimizer.h:1.7 Wed Sep 6 15:16:28 2006 +++ llvm/include/llvm/LinkTimeOptimizer.h Thu Sep 21 12:22:55 2006 @@ -75,10 +75,28 @@ return (strcmp(left, right) == 0); } }; - + + /// This is abstract class to facilitate dlopen() interface. + /// See LTO below for more info. + class LinkTimeOptimizer { + public: + typedef hash_map, + string_compare> NameToSymbolMap; + typedef hash_map, + string_compare> NameToModuleMap; + virtual enum LTOStatus readLLVMObjectFile(const std::string &, + NameToSymbolMap &, + std::set &) = 0; + virtual enum LTOStatus optimizeModules(const std::string &, + std::vector &, + std::string &) = 0; + virtual void getTargetTriple(const std::string &, std::string &) = 0; + virtual ~LinkTimeOptimizer() = 0; + }; + /// This is the main link time optimization class. It exposes simple API /// to perform link time optimization using LLVM intermodular optimizer. - class LinkTimeOptimizer { + class LTO : public LinkTimeOptimizer { public: typedef hash_map, From jlaskey at apple.com Thu Sep 21 12:36:01 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 21 Sep 2006 12:36:01 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200609211736.k8LHa1la003323@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.195 -> 1.196 --- Log message: core corrections --- Diffs of the changes: (+4 -10) DAGCombiner.cpp | 14 ++++---------- 1 files changed, 4 insertions(+), 10 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.195 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.196 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.195 Thu Sep 21 11:28:59 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Sep 21 12:35:47 2006 @@ -46,13 +46,9 @@ "Number of dag nodes combined"); -#ifndef NDEBUG static cl::opt CombinerAA("combiner-alias-analysis", cl::Hidden, cl::desc("Turn on alias analysis turning testing")); -#else - static const bool CombinerAA = 0; -#endif class VISIBILITY_HIDDEN DAGCombiner { SelectionDAG &DAG; @@ -2594,14 +2590,14 @@ // Mind the flag. if (!CombinerAA) return false; - // If they are the same then they are simple aliases. + // If they are the same then they must be aliases. if (Ptr1 == Ptr2) return false; - // If either operand is a frame value (not the same location from above test) + // If both operands are frame values (not the same location from above test) // then they can't alias. FrameIndexSDNode *FI1 = dyn_cast(Ptr1); FrameIndexSDNode *FI2 = dyn_cast(Ptr2); - if (FI1 || FI2) { + if (FI1 && FI2) { return true; } @@ -2651,9 +2647,7 @@ SDOperand Token = DAG.getNode(ISD::TokenFactor, MVT::Other, Chain, ReplStore); // Replace uses with token. - CombineTo(N, Token); - // Don't recombine on token. - return SDOperand(N, 0); + return Token; } return SDOperand(); From isanbard at gmail.com Thu Sep 21 13:14:59 2006 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 21 Sep 2006 13:14:59 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/410.bwaves/Makefile Message-ID: <200609211814.k8LIExli004031@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/410.bwaves: Makefile updated: 1.2 -> 1.3 --- Log message: For some reason, I'd modified this to pick up the Makefile.FORTRAN at "LEVEL" instead of "PROJ_SRC_ROOT". --- Diffs of the changes: (+1 -1) Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/External/SPEC/CFP2006/410.bwaves/Makefile diff -u llvm-test/External/SPEC/CFP2006/410.bwaves/Makefile:1.2 llvm-test/External/SPEC/CFP2006/410.bwaves/Makefile:1.3 --- llvm-test/External/SPEC/CFP2006/410.bwaves/Makefile:1.2 Thu Sep 21 03:50:19 2006 +++ llvm-test/External/SPEC/CFP2006/410.bwaves/Makefile Thu Sep 21 13:14:45 2006 @@ -10,7 +10,7 @@ FP_ABSTOLERANCE = 1.0e-16 include ../../Makefile.spec2006 -include $(LEVEL)/Makefile.FORTRAN +include $(PROJ_SRC_ROOT)/Makefile.FORTRAN STDIN_FILENAME := bwaves.in STDOUT_FILENAME := bwaves.out From sabre at nondot.org Thu Sep 21 13:28:41 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 21 Sep 2006 13:28:41 -0500 Subject: [llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp Message-ID: <200609211828.k8LISft3004311@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: DAGISelEmitter.cpp updated: 1.261 -> 1.262 --- Log message: Fit to 80 columns. --- Diffs of the changes: (+13 -13) DAGISelEmitter.cpp | 26 +++++++++++++------------- 1 files changed, 13 insertions(+), 13 deletions(-) Index: llvm/utils/TableGen/DAGISelEmitter.cpp diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.261 llvm/utils/TableGen/DAGISelEmitter.cpp:1.262 --- llvm/utils/TableGen/DAGISelEmitter.cpp:1.261 Tue Sep 19 14:08:04 2006 +++ llvm/utils/TableGen/DAGISelEmitter.cpp Thu Sep 21 13:28:27 2006 @@ -830,7 +830,7 @@ for (unsigned i = 0, e = getNumChildren()-1; i != e; ++i) if (!getChild(i)->isLeaf() && getChild(i)->getOperator()->getName() == "imm") { - Reason = "Immediate value must be on the RHS of commutative operators!"; + Reason="Immediate value must be on the RHS of commutative operators!"; return false; } } @@ -1590,8 +1590,8 @@ // can never do anything with this pattern: report it to the user. InferredAllPatternTypes = Pattern->InferAllTypes(); - // Infer as many types as possible. If we cannot infer all of them, we can - // never do anything with this pattern: report it to the user. + // Infer as many types as possible. If we cannot infer all of them, we + // can never do anything with this pattern: report it to the user. InferredAllResultTypes = Result->InferAllTypes(); // Apply the type of the result to the source pattern. This helps us @@ -2466,8 +2466,8 @@ Val + ")->getSymbol(), " + getEnumName(N->getTypeNum(0)) + ");"); NodeOps.push_back("Tmp" + utostr(ResNo)); - // Add Tmp to VariableMap, so that we don't multiply select this - // value if used multiple times by this pattern result. + // Add Tmp to VariableMap, so that we don't multiply select + // this value if used multiple times by this pattern result. Val = "Tmp"+utostr(ResNo); } else { NodeOps.push_back(Val); @@ -2481,8 +2481,8 @@ ")->getGlobal(), " + getEnumName(N->getTypeNum(0)) + ");"); NodeOps.push_back("Tmp" + utostr(ResNo)); - // Add Tmp to VariableMap, so that we don't multiply select this - // value if used multiple times by this pattern result. + // Add Tmp to VariableMap, so that we don't multiply select + // this value if used multiple times by this pattern result. Val = "Tmp"+utostr(ResNo); } else { NodeOps.push_back(Val); @@ -2765,8 +2765,8 @@ utostr(i) + "), SDOperand(ResNode, " + utostr(i) + "));"); if (InputHasChain) emitCode("ReplaceUses(SDOperand(N.Val, " + - utostr(PatResults) + "), SDOperand(" + ChainName + ".Val, " + - ChainName + ".ResNo" + "));"); + utostr(PatResults) + "), SDOperand(" + ChainName + ".Val, " + + ChainName + ".ResNo" + "));"); } else RetSelected = true; @@ -3266,8 +3266,8 @@ ++II) { MVT::ValueType OpVT = II->first; std::vector &Patterns = II->second; - typedef std::vector > CodeList; - typedef std::vector >::iterator CodeListI; + typedef std::vector > CodeList; + typedef std::vector >::iterator CodeListI; std::vector > CodeForPatterns; std::vector > PatternOpcodes; @@ -3408,8 +3408,8 @@ // Emit all of the patterns now, grouped together to share code. EmitPatterns(CodeForPatterns, 2, OS); - // If the last pattern has predicates (which could fail) emit code to catch - // the case where nothing handles a pattern. + // If the last pattern has predicates (which could fail) emit code to + // catch the case where nothing handles a pattern. if (mightNotMatch) { OS << " std::cerr << \"Cannot yet select: \";\n"; if (OpcodeInfo.getEnumName() != "ISD::INTRINSIC_W_CHAIN" && From evan.cheng at apple.com Thu Sep 21 14:04:20 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 21 Sep 2006 14:04:20 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200609211904.k8LJ4KXh004893@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.196 -> 1.197 --- Log message: Make it work for DAG combine of multi-value nodes. --- Diffs of the changes: (+7 -2) DAGCombiner.cpp | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.196 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.197 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.196 Thu Sep 21 12:35:47 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Sep 21 14:04:05 2006 @@ -407,8 +407,13 @@ std::cerr << "\nWith: "; RV.Val->dump(&DAG); std::cerr << '\n'); std::vector NowDead; - SDOperand OpV = RV; - DAG.ReplaceAllUsesWith(N, &OpV, &NowDead); + if (N->getNumValues() == RV.Val->getNumValues()) + DAG.ReplaceAllUsesWith(N, RV.Val, &NowDead); + else { + assert(N->getValueType(0) == RV.getValueType() && "Type mismatch"); + SDOperand OpV = RV; + DAG.ReplaceAllUsesWith(N, &OpV, &NowDead); + } // Push the new node and any users onto the worklist WorkList.push_back(RV.Val); From sabre at nondot.org Thu Sep 21 15:46:27 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 21 Sep 2006 15:46:27 -0500 Subject: [llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp Message-ID: <200609212046.k8LKkRB5006583@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: DAGISelEmitter.cpp updated: 1.262 -> 1.263 --- Log message: don't allow 'imm' or specific imms, like '1' on the LHS of a binop. This shrinks X86GenDAGISel by ~330 lines. --- Diffs of the changes: (+13 -4) DAGISelEmitter.cpp | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) Index: llvm/utils/TableGen/DAGISelEmitter.cpp diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.262 llvm/utils/TableGen/DAGISelEmitter.cpp:1.263 --- llvm/utils/TableGen/DAGISelEmitter.cpp:1.262 Thu Sep 21 13:28:27 2006 +++ llvm/utils/TableGen/DAGISelEmitter.cpp Thu Sep 21 15:46:13 2006 @@ -800,6 +800,17 @@ } } +/// OnlyOnRHSOfCommutative - Return true if this value is only allowed on the +/// RHS of a commutative operation, not the on LHS. +static bool OnlyOnRHSOfCommutative(TreePatternNode *N) { + if (!N->isLeaf() && N->getOperator()->getName() == "imm") + return true; + if (N->isLeaf() && dynamic_cast(N->getLeafValue())) + return true; + return false; +} + + /// canPatternMatch - If it is impossible for this pattern to match on this /// target, fill in Reason and return false. Otherwise, return true. This is /// used as a santity check for .td files (to prevent people from writing stuff @@ -825,11 +836,9 @@ if (NodeInfo.hasProperty(SDNodeInfo::SDNPCommutative)) { // Scan all of the operands of the node and make sure that only the last one // is a constant node, unless the RHS also is. - if (getChild(getNumChildren()-1)->isLeaf() || - getChild(getNumChildren()-1)->getOperator()->getName() != "imm") { + if (!OnlyOnRHSOfCommutative(getChild(getNumChildren()-1))) { for (unsigned i = 0, e = getNumChildren()-1; i != e; ++i) - if (!getChild(i)->isLeaf() && - getChild(i)->getOperator()->getName() == "imm") { + if (OnlyOnRHSOfCommutative(getChild(i))) { Reason="Immediate value must be on the RHS of commutative operators!"; return false; } From dpatel at apple.com Thu Sep 21 20:05:49 2006 From: dpatel at apple.com (Devang Patel) Date: Thu, 21 Sep 2006 20:05:49 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/ET-Forest.h Message-ID: <200609220105.k8M15nhq010598@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: ET-Forest.h updated: 1.6 -> 1.7 --- Log message: Use iterative algorith to assign DFS number. This reduces call stack depth. --- Diffs of the changes: (+1 -10) ET-Forest.h | 11 +---------- 1 files changed, 1 insertion(+), 10 deletions(-) Index: llvm/include/llvm/Analysis/ET-Forest.h diff -u llvm/include/llvm/Analysis/ET-Forest.h:1.6 llvm/include/llvm/Analysis/ET-Forest.h:1.7 --- llvm/include/llvm/Analysis/ET-Forest.h:1.6 Thu Sep 14 16:43:24 2006 +++ llvm/include/llvm/Analysis/ET-Forest.h Thu Sep 21 20:05:33 2006 @@ -250,16 +250,7 @@ return this->Below(other); } - void assignDFSNumber(int &num) { - DFSNumIn = num++; - - if (Son) { - Son->assignDFSNumber(num); - for (ETNode *son = Son->Right; son != Son; son = son->Right) - son->assignDFSNumber(num); - } - DFSNumOut = num++; - } + void assignDFSNumber (int); bool hasFather() const { return Father != NULL; From dpatel at apple.com Thu Sep 21 20:05:49 2006 From: dpatel at apple.com (Devang Patel) Date: Thu, 21 Sep 2006 20:05:49 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Dominators.cpp Message-ID: <200609220105.k8M15nKE010593@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Dominators.cpp updated: 1.75 -> 1.76 --- Log message: Use iterative algorith to assign DFS number. This reduces call stack depth. --- Diffs of the changes: (+47 -0) Dominators.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 47 insertions(+) Index: llvm/lib/VMCore/Dominators.cpp diff -u llvm/lib/VMCore/Dominators.cpp:1.75 llvm/lib/VMCore/Dominators.cpp:1.76 --- llvm/lib/VMCore/Dominators.cpp:1.75 Thu Sep 14 16:43:24 2006 +++ llvm/lib/VMCore/Dominators.cpp Thu Sep 21 20:05:33 2006 @@ -809,6 +809,53 @@ return occmin->OccFor; } +void ETNode::assignDFSNumber(int num) { + std::vector workStack; + std::set visitedNodes; + + workStack.push_back(this); + visitedNodes.insert(this); + this->DFSNumIn = num++; + + while (!workStack.empty()) { + ETNode *Node = workStack.back(); + + // If this is leaf node then set DFSNumOut and pop the stack + if (!Node->Son) { + Node->DFSNumOut = num++; + workStack.pop_back(); + continue; + } + + ETNode *son = Node->Son; + + // Visit Node->Son first + if (visitedNodes.count(son) == 0) { + son->DFSNumIn = num++; + workStack.push_back(son); + visitedNodes.insert(son); + continue; + } + + bool visitChild = false; + // Visit remaining children + for (ETNode *s = son->Right; s != son && !visitChild; s = s->Right) { + if (visitedNodes.count(s) == 0) { + visitChild = true; + s->DFSNumIn = num++; + workStack.push_back(s); + visitedNodes.insert(s); + } + } + + if (!visitChild) { + // If we reach here means all children are visited + Node->DFSNumOut = num++; + workStack.pop_back(); + } + } +} + //===----------------------------------------------------------------------===// // ETForest implementation //===----------------------------------------------------------------------===// From dpatel at apple.com Thu Sep 21 20:08:11 2006 From: dpatel at apple.com (Devang Patel) Date: Thu, 21 Sep 2006 20:08:11 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Dominators.cpp Message-ID: <200609220108.k8M18BLm010647@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Dominators.cpp updated: 1.76 -> 1.77 --- Log message: remove extra white spaces. --- Diffs of the changes: (+1 -1) Dominators.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/VMCore/Dominators.cpp diff -u llvm/lib/VMCore/Dominators.cpp:1.76 llvm/lib/VMCore/Dominators.cpp:1.77 --- llvm/lib/VMCore/Dominators.cpp:1.76 Thu Sep 21 20:05:33 2006 +++ llvm/lib/VMCore/Dominators.cpp Thu Sep 21 20:07:57 2006 @@ -844,7 +844,7 @@ visitChild = true; s->DFSNumIn = num++; workStack.push_back(s); - visitedNodes.insert(s); + visitedNodes.insert(s); } } From natebegeman at mac.com Fri Sep 22 00:02:11 2006 From: natebegeman at mac.com (Nate Begeman) Date: Fri, 22 Sep 2006 00:02:11 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp PPCInstrInfo.td README.txt Message-ID: <200609220502.k8M52B0b014212@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCISelDAGToDAG.cpp updated: 1.210 -> 1.211 PPCInstrInfo.td updated: 1.241 -> 1.242 README.txt updated: 1.99 -> 1.100 --- Log message: Fold AND and ROTL more often --- Diffs of the changes: (+62 -62) PPCISelDAGToDAG.cpp | 66 +++++++++++++++++++++++++++++----------------------- PPCInstrInfo.td | 24 ++++++++++++++++++ README.txt | 34 -------------------------- 3 files changed, 62 insertions(+), 62 deletions(-) Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp diff -u llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.210 llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.211 --- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.210 Tue Sep 19 23:33:27 2006 +++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Fri Sep 22 00:01:56 2006 @@ -76,6 +76,17 @@ return CurDAG->getTargetConstant(Imm, PPCLowering.getPointerTy()); } + /// isRunOfOnes - Returns true iff Val consists of one contiguous run of 1s + /// with any number of 0s on either side. The 1s are allowed to wrap from + /// LSB to MSB, so 0x000FFF0, 0x0000FFFF, and 0xFF0000FF are all runs. + /// 0x0F0F0000 is not, since all 1s are not contiguous. + static bool isRunOfOnes(unsigned Val, unsigned &MB, unsigned &ME); + + + /// isRotateAndMask - Returns true if Mask and Shift can be folded into a + /// rotate and mask opcode and mask operation. + static bool isRotateAndMask(SDNode *N, unsigned Mask, bool IsShiftMask, + unsigned &SH, unsigned &MB, unsigned &ME); /// getGlobalBaseReg - insert code into the entry mbb to materialize the PIC /// base register. Return the virtual register that holds this value. @@ -324,12 +335,7 @@ return N->getOpcode() == Opc && isInt32Immediate(N->getOperand(1).Val, Imm); } - -// isRunOfOnes - Returns true iff Val consists of one contiguous run of 1s with -// any number of 0s on either side. The 1s are allowed to wrap from LSB to -// MSB, so 0x000FFF0, 0x0000FFFF, and 0xFF0000FF are all runs. 0x0F0F0000 is -// not, since all 1s are not contiguous. -static bool isRunOfOnes(unsigned Val, unsigned &MB, unsigned &ME) { +bool PPCDAGToDAGISel::isRunOfOnes(unsigned Val, unsigned &MB, unsigned &ME) { if (isShiftedMask_32(Val)) { // look for the first non-zero bit MB = CountLeadingZeros_32(Val); @@ -350,10 +356,9 @@ return false; } -// isRotateAndMask - Returns true if Mask and Shift can be folded into a rotate -// and mask opcode and mask operation. -static bool isRotateAndMask(SDNode *N, unsigned Mask, bool IsShiftMask, - unsigned &SH, unsigned &MB, unsigned &ME) { +bool PPCDAGToDAGISel::isRotateAndMask(SDNode *N, unsigned Mask, + bool IsShiftMask, unsigned &SH, + unsigned &MB, unsigned &ME) { // Don't even go down this path for i64, since different logic will be // necessary for rldicl/rldicr/rldimi. if (N->getValueType(0) != MVT::i32) @@ -378,6 +383,8 @@ Indeterminant = ~(0xFFFFFFFFu >> Shift); // adjust for the left rotate Shift = 32 - Shift; + } else if (Opcode == ISD::ROTL) { + Indeterminant = 0; } else { return false; } @@ -1024,30 +1031,33 @@ break; } case ISD::AND: { - unsigned Imm, Imm2; + unsigned Imm, Imm2, SH, MB, ME; + // If this is an and of a value rotated between 0 and 31 bits and then and'd // with a mask, emit rlwinm if (isInt32Immediate(N->getOperand(1), Imm) && - (isShiftedMask_32(Imm) || isShiftedMask_32(~Imm))) { - SDOperand Val; - unsigned SH, MB, ME; - if (isRotateAndMask(N->getOperand(0).Val, Imm, false, SH, MB, ME)) { - Val = N->getOperand(0).getOperand(0); - AddToISelQueue(Val); - } else if (Imm == 0) { - // AND X, 0 -> 0, not "rlwinm 32". - AddToISelQueue(N->getOperand(1)); - ReplaceUses(SDOperand(N, 0), N->getOperand(1)); - return NULL; - } else { - Val = N->getOperand(0); - AddToISelQueue(Val); - isRunOfOnes(Imm, MB, ME); - SH = 0; - } + isRotateAndMask(N->getOperand(0).Val, Imm, false, SH, MB, ME)) { + SDOperand Val = N->getOperand(0).getOperand(0); + AddToISelQueue(Val); SDOperand Ops[] = { Val, getI32Imm(SH), getI32Imm(MB), getI32Imm(ME) }; return CurDAG->SelectNodeTo(N, PPC::RLWINM, MVT::i32, Ops, 4); } + // If this is just a masked value where the input is not handled above, and + // is not a rotate-left (handled by a pattern in the .td file), emit rlwinm + if (isInt32Immediate(N->getOperand(1), Imm) && + isRunOfOnes(Imm, MB, ME) && + N->getOperand(0).getOpcode() != ISD::ROTL) { + SDOperand Val = N->getOperand(0); + AddToISelQueue(Val); + SDOperand Ops[] = { Val, getI32Imm(0), getI32Imm(MB), getI32Imm(ME) }; + return CurDAG->SelectNodeTo(N, PPC::RLWINM, MVT::i32, Ops, 4); + } + // AND X, 0 -> 0, not "rlwinm 32". + if (isInt32Immediate(N->getOperand(1), Imm) && (Imm == 0)) { + AddToISelQueue(N->getOperand(1)); + ReplaceUses(SDOperand(N, 0), N->getOperand(1)); + return NULL; + } // ISD::OR doesn't get all the bitfield insertion fun. // (and (or x, c1), c2) where isRunOfOnes(~(c1^c2)) is a bitfield insert if (isInt32Immediate(N->getOperand(1), Imm) && Index: llvm/lib/Target/PowerPC/PPCInstrInfo.td diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.241 llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.242 --- llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.241 Fri Aug 11 04:02:24 2006 +++ llvm/lib/Target/PowerPC/PPCInstrInfo.td Fri Sep 22 00:01:56 2006 @@ -129,7 +129,27 @@ signed int Val = N->getValue(); return getI32Imm((Val - (signed short)Val) >> 16); }]>; +def MB : SDNodeXFormgetValue(), mb, me); + return getI32Imm(mb); +}]>; +def ME : SDNodeXFormgetValue(), mb, me); + return getI32Imm(me); +}]>; +def maskimm32 : PatLeaf<(imm), [{ + // maskImm predicate - True if immediate is a run of ones. + unsigned mb, me; + if (N->getValueType(0) == MVT::i32) + return isRunOfOnes((unsigned)N->getValue(), mb, me); + else + return false; +}]>; def immSExt16 : PatLeaf<(imm), [{ // immSExt16 predicate - True if the immediate fits in a 16-bit sign extended @@ -923,6 +943,10 @@ def : Pat<(rotl GPRC:$in, (i32 imm:$imm)), (RLWINM GPRC:$in, imm:$imm, 0, 31)>; +// RLWNM +def : Pat<(and (rotl GPRC:$in, GPRC:$sh), maskimm32:$imm), + (RLWNM GPRC:$in, GPRC:$sh, (MB maskimm32:$imm), (ME maskimm32:$imm))>; + // Calls def : Pat<(PPCcall tglobaladdr:$dst), (BL tglobaladdr:$dst)>; Index: llvm/lib/Target/PowerPC/README.txt diff -u llvm/lib/Target/PowerPC/README.txt:1.99 llvm/lib/Target/PowerPC/README.txt:1.100 --- llvm/lib/Target/PowerPC/README.txt:1.99 Wed Sep 20 01:41:56 2006 +++ llvm/lib/Target/PowerPC/README.txt Fri Sep 22 00:01:56 2006 @@ -6,40 +6,6 @@ ===-------------------------------------------------------------------------=== -We only produce the rlwnm instruction for rotate instructions. We should -at least match stuff like: - -unsigned rot_and(unsigned X, int Y) { - unsigned T = (X << Y) | (X >> (32-Y)); - T &= 127; - return T; -} - -_foo3: - rlwnm r2, r3, r4, 0, 31 - rlwinm r3, r2, 0, 25, 31 - blr - -... which is the basic pattern that should be written in the instr. It may -also be useful for stuff like: - -long long foo2(long long X, int C) { - return X << (C&~32); -} - -which currently produces: - -_foo2: - rlwinm r2, r5, 0, 27, 25 - subfic r5, r2, 32 - slw r3, r3, r2 - srw r5, r4, r5 - or r3, r3, r5 - slw r4, r4, r2 - blr - -===-------------------------------------------------------------------------=== - Support 'update' load/store instructions. These are cracked on the G5, but are still a codesize win. From isanbard at gmail.com Fri Sep 22 00:34:39 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 22 Sep 2006 00:34:39 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CFrontend/2006-09-21-IncompleteElementType.c Message-ID: <200609220534.k8M5YdFS014703@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CFrontend: 2006-09-21-IncompleteElementType.c added (r1.1) --- Log message: Regression testcase for PR855: http://llvm.org/PR855 . --- Diffs of the changes: (+3 -0) 2006-09-21-IncompleteElementType.c | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/test/Regression/CFrontend/2006-09-21-IncompleteElementType.c diff -c /dev/null llvm/test/Regression/CFrontend/2006-09-21-IncompleteElementType.c:1.1 *** /dev/null Fri Sep 22 00:34:35 2006 --- llvm/test/Regression/CFrontend/2006-09-21-IncompleteElementType.c Fri Sep 22 00:34:25 2006 *************** *** 0 **** --- 1,3 ---- + // RUN: %llvmgcc %s -S -o /dev/null 2>&1 | not grep 'internal compiler error' + + struct A X[(927 - 37) / sizeof(struct A)]; From natebegeman at mac.com Fri Sep 22 00:50:12 2006 From: natebegeman at mac.com (Nate Begeman) Date: Fri, 22 Sep 2006 00:50:12 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/rlwinm2.ll Message-ID: <200609220550.k8M5oCRs014962@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/PowerPC: rlwinm2.ll added (r1.1) --- Log message: Testcase for better rotate left and mask support --- Diffs of the changes: (+30 -0) rlwinm2.ll | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+) Index: llvm/test/Regression/CodeGen/PowerPC/rlwinm2.ll diff -c /dev/null llvm/test/Regression/CodeGen/PowerPC/rlwinm2.ll:1.1 *** /dev/null Fri Sep 22 00:50:07 2006 --- llvm/test/Regression/CodeGen/PowerPC/rlwinm2.ll Fri Sep 22 00:49:57 2006 *************** *** 0 **** --- 1,30 ---- + ; All of these ands and shifts should be folded into rlw[i]nm instructions + ; RUN: llvm-as < %s | llc -march=ppc32 | not grep and && + ; RUN: llvm-as < %s | llc -march=ppc32 | not grep srawi && + ; RUN: llvm-as < %s | llc -march=ppc32 | not grep srwi && + ; RUN: llvm-as < %s | llc -march=ppc32 | not grep slwi && + ; RUN: llvm-as < %s | llc -march=ppc32 | grep rlwnm | wc -l | grep 1 && + ; RUN: llvm-as < %s | llc -march=ppc32 | grep rlwinm | wc -l | grep 1 + + + implementation ; Functions: + + uint %test1(uint %X, int %Y) { + entry: + %tmp = cast int %Y to ubyte ; [#uses=2] + %tmp1 = shl uint %X, ubyte %tmp ; [#uses=1] + %tmp2 = sub ubyte 32, %tmp ; [#uses=1] + %tmp3 = shr uint %X, ubyte %tmp2 ; [#uses=1] + %tmp4 = or uint %tmp1, %tmp3 ; [#uses=1] + %tmp6 = and uint %tmp4, 127 ; [#uses=1] + ret uint %tmp6 + } + + uint %test2(uint %X) { + entry: + %tmp1 = shr uint %X, ubyte 27 ; [#uses=1] + %tmp2 = shl uint %X, ubyte 5 ; [#uses=1] + %tmp2.masked = and uint %tmp2, 96 ; [#uses=1] + %tmp5 = or uint %tmp1, %tmp2.masked ; [#uses=1] + ret uint %tmp5 + } From isanbard at gmail.com Fri Sep 22 02:09:16 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 22 Sep 2006 02:09:16 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/C++Frontend/2006-09-08-powi.cpp 2006-09-12-OpaqueStructCrash.cpp Message-ID: <200609220709.k8M79GoS017897@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/C++Frontend: 2006-09-08-powi.cpp updated: 1.1 -> 1.2 2006-09-12-OpaqueStructCrash.cpp updated: 1.1 -> 1.2 --- Log message: Use "%llvmgxx" instead of "llvm-g++". --- Diffs of the changes: (+2 -2) 2006-09-08-powi.cpp | 2 +- 2006-09-12-OpaqueStructCrash.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/test/Regression/C++Frontend/2006-09-08-powi.cpp diff -u llvm/test/Regression/C++Frontend/2006-09-08-powi.cpp:1.1 llvm/test/Regression/C++Frontend/2006-09-08-powi.cpp:1.2 --- llvm/test/Regression/C++Frontend/2006-09-08-powi.cpp:1.1 Sat Sep 9 01:02:16 2006 +++ llvm/test/Regression/C++Frontend/2006-09-08-powi.cpp Fri Sep 22 02:09:01 2006 @@ -1,4 +1,4 @@ -// RUN: llvm-g++ -O3 -S -o - %s +// RUN: %llvmgxx -O3 -S -o - %s #include Index: llvm/test/Regression/C++Frontend/2006-09-12-OpaqueStructCrash.cpp diff -u llvm/test/Regression/C++Frontend/2006-09-12-OpaqueStructCrash.cpp:1.1 llvm/test/Regression/C++Frontend/2006-09-12-OpaqueStructCrash.cpp:1.2 --- llvm/test/Regression/C++Frontend/2006-09-12-OpaqueStructCrash.cpp:1.1 Tue Sep 12 11:28:14 2006 +++ llvm/test/Regression/C++Frontend/2006-09-12-OpaqueStructCrash.cpp Fri Sep 22 02:09:01 2006 @@ -1,4 +1,4 @@ -// RUN: llvm-g++ -O3 -S -o - %s +// RUN: %llvmgxx -O3 -S -o - %s struct A { virtual ~A(); From rafael.espindola at gmail.com Fri Sep 22 06:36:31 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Fri, 22 Sep 2006 06:36:31 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/README.txt Message-ID: <200609221136.k8MBaVoQ030693@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: README.txt updated: 1.1 -> 1.2 --- Log message: add a note --- Diffs of the changes: (+21 -0) README.txt | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+) Index: llvm/lib/Target/ARM/README.txt diff -u llvm/lib/Target/ARM/README.txt:1.1 llvm/lib/Target/ARM/README.txt:1.2 --- llvm/lib/Target/ARM/README.txt:1.1 Tue Aug 22 07:22:46 2006 +++ llvm/lib/Target/ARM/README.txt Fri Sep 22 06:36:17 2006 @@ -7,3 +7,24 @@ cmp x, y moveq dst, a movne dst, b + +---------------------------------------------------------- + + +%tmp1 = shl int %b, ubyte %c +%tmp4 = add int %a, %tmp1 + +compiles to + +add r0, r0, r1, lsl r2 + +but + +%tmp1 = shl int %b, ubyte %c +%tmp4 = add int %tmp1, %a + +compiles to +mov r1, r1, lsl r2 +add r0, r1, r0 + +---------------------------------------------------------- From isanbard at gmail.com Fri Sep 22 13:41:47 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 22 Sep 2006 13:41:47 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/436.cactusADM/Makefile Message-ID: <200609221841.k8MIflUs005792@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/436.cactusADM: Makefile updated: 1.3 -> 1.4 --- Log message: Needed to increase the "continuation" limit to something that's reflected in the programs. --- Diffs of the changes: (+2 -0) Makefile | 2 ++ 1 files changed, 2 insertions(+) Index: llvm-test/External/SPEC/CFP2006/436.cactusADM/Makefile diff -u llvm-test/External/SPEC/CFP2006/436.cactusADM/Makefile:1.3 llvm-test/External/SPEC/CFP2006/436.cactusADM/Makefile:1.4 --- llvm-test/External/SPEC/CFP2006/436.cactusADM/Makefile:1.3 Thu Sep 7 19:59:14 2006 +++ llvm-test/External/SPEC/CFP2006/436.cactusADM/Makefile Fri Sep 22 13:41:33 2006 @@ -156,6 +156,8 @@ -I$(SPEC_BENCH_DIR)/src \ -I$(SPEC_BENCH_DIR)/src/include +NAGFORTRAN_FLAGS += -maxcontin=39 + include ../../Makefile.spec2006 include $(PROJ_SRC_ROOT)/Makefile.FORTRAN From evan.cheng at apple.com Fri Sep 22 16:44:13 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 22 Sep 2006 16:44:13 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86InstrInfo.td X86RegisterInfo.cpp Message-ID: <200609222144.k8MLiD6x008905@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86InstrInfo.td updated: 1.286 -> 1.287 X86RegisterInfo.cpp updated: 1.170 -> 1.171 --- Log message: Delete dead code; fix 80 col violations. --- Diffs of the changes: (+4 -14) X86InstrInfo.td | 15 ++++----------- X86RegisterInfo.cpp | 3 --- 2 files changed, 4 insertions(+), 14 deletions(-) Index: llvm/lib/Target/X86/X86InstrInfo.td diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.286 llvm/lib/Target/X86/X86InstrInfo.td:1.287 --- llvm/lib/Target/X86/X86InstrInfo.td:1.286 Sun Sep 10 21:19:56 2006 +++ llvm/lib/Target/X86/X86InstrInfo.td Fri Sep 22 16:43:59 2006 @@ -456,22 +456,15 @@ // Tail call stuff. let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, noResults = 1 in - def TAILJMPd : IBr<0xE9, (ops i32imm:$dst), "jmp ${dst:call} # TAIL CALL", []>; + def TAILJMPd : IBr<0xE9, (ops i32imm:$dst), "jmp ${dst:call} # TAIL CALL", + []>; let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, noResults = 1 in - def TAILJMPr : I<0xFF, MRM4r, (ops GR32:$dst), "jmp {*}$dst # TAIL CALL", []>; + def TAILJMPr : I<0xFF, MRM4r, (ops GR32:$dst), "jmp {*}$dst # TAIL CALL", + []>; let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, noResults = 1 in def TAILJMPm : I<0xFF, MRM4m, (ops i32mem:$dst), "jmp {*}$dst # TAIL CALL", []>; -// ADJSTACKPTRri - This is a standard ADD32ri instruction, identical in every -// way, except that it is marked as being a terminator. This causes the epilog -// inserter to insert reloads of callee saved registers BEFORE this. We need -// this until we have a more accurate way of tracking where the stack pointer is -// within a function. -let isTerminator = 1, isTwoAddress = 1 in - def ADJSTACKPTRri : Ii32<0x81, MRM0r, (ops GR32:$dst, GR32:$src1, i32imm:$src2), - "add{l} {$src2, $dst|$dst, $src2}", []>; - //===----------------------------------------------------------------------===// // Miscellaneous Instructions... // Index: llvm/lib/Target/X86/X86RegisterInfo.cpp diff -u llvm/lib/Target/X86/X86RegisterInfo.cpp:1.170 llvm/lib/Target/X86/X86RegisterInfo.cpp:1.171 --- llvm/lib/Target/X86/X86RegisterInfo.cpp:1.170 Sun Sep 17 15:25:45 2006 +++ llvm/lib/Target/X86/X86RegisterInfo.cpp Fri Sep 22 16:43:59 2006 @@ -1093,9 +1093,6 @@ PI->getOperand(0).getReg() == StackPtr) { NumBytes -= PI->getOperand(2).getImmedValue(); MBB.erase(PI); - } else if (PI->getOpcode() == X86::ADJSTACKPTRri) { - NumBytes += PI->getOperand(1).getImmedValue(); - MBB.erase(PI); } } From sabre at nondot.org Fri Sep 22 23:04:00 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 22 Sep 2006 23:04:00 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/BasicBlock.h Message-ID: <200609230404.k8N440vd014770@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: BasicBlock.h updated: 1.59 -> 1.60 --- Log message: add method, correct comment --- Diffs of the changes: (+7 -3) BasicBlock.h | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) Index: llvm/include/llvm/BasicBlock.h diff -u llvm/include/llvm/BasicBlock.h:1.59 llvm/include/llvm/BasicBlock.h:1.60 --- llvm/include/llvm/BasicBlock.h:1.59 Thu Jun 8 10:46:17 2006 +++ llvm/include/llvm/BasicBlock.h Fri Sep 22 23:03:45 2006 @@ -109,10 +109,14 @@ /// void eraseFromParent(); - /// moveBefore - Unlink this instruction from its current function and - /// insert it into the function that MovePos lives in, right before - /// MovePos. + /// moveBefore - Unlink this basic block from its current function and + /// insert it into the function that MovePos lives in, right before MovePos. void moveBefore(BasicBlock *MovePos); + + /// moveAfter - Unlink this basic block from its current function and + /// insert it into the function that MovePos lives in, right after MovePos. + void moveAfter(BasicBlock *MovePos); + /// getSinglePredecessor - If this basic block has a single predecessor block, /// return the block, otherwise return a null pointer. From sabre at nondot.org Fri Sep 22 23:04:00 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 22 Sep 2006 23:04:00 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/BasicBlock.cpp Message-ID: <200609230404.k8N440Hb014776@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: BasicBlock.cpp updated: 1.73 -> 1.74 --- Log message: add method, correct comment --- Diffs of the changes: (+10 -3) BasicBlock.cpp | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) Index: llvm/lib/VMCore/BasicBlock.cpp diff -u llvm/lib/VMCore/BasicBlock.cpp:1.73 llvm/lib/VMCore/BasicBlock.cpp:1.74 --- llvm/lib/VMCore/BasicBlock.cpp:1.73 Sun Aug 27 07:54:02 2006 +++ llvm/lib/VMCore/BasicBlock.cpp Fri Sep 22 23:03:45 2006 @@ -103,14 +103,21 @@ getParent()->getBasicBlockList().erase(this); } -/// moveBefore - Unlink this instruction from its current function and -/// insert it into the function that MovePos lives in, right before -/// MovePos. +/// moveBefore - Unlink this basic block from its current function and +/// insert it into the function that MovePos lives in, right before MovePos. void BasicBlock::moveBefore(BasicBlock *MovePos) { MovePos->getParent()->getBasicBlockList().splice(MovePos, getParent()->getBasicBlockList(), this); } +/// moveAfter - Unlink this basic block from its current function and +/// insert it into the function that MovePos lives in, right after MovePos. +void BasicBlock::moveAfter(BasicBlock *MovePos) { + Function::iterator I = MovePos; + MovePos->getParent()->getBasicBlockList().splice(++I, + getParent()->getBasicBlockList(), this); +} + TerminatorInst *BasicBlock::getTerminator() { if (InstList.empty()) return 0; From sabre at nondot.org Sat Sep 23 01:09:59 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 23 Sep 2006 01:09:59 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Type.h Message-ID: <200609230609.k8N69xk1016718@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Type.h updated: 1.88 -> 1.89 --- Log message: remove misleading comment --- Diffs of the changes: (+1 -7) Type.h | 8 +------- 1 files changed, 1 insertion(+), 7 deletions(-) Index: llvm/include/llvm/Type.h diff -u llvm/include/llvm/Type.h:1.88 llvm/include/llvm/Type.h:1.89 --- llvm/include/llvm/Type.h:1.88 Tue Jul 25 18:22:00 2006 +++ llvm/include/llvm/Type.h Sat Sep 23 01:09:45 2006 @@ -371,13 +371,7 @@ //===----------------------------------------------------------------------===// // Define some inline methods for the AbstractTypeUser.h:PATypeHandle class. // These are defined here because they MUST be inlined, yet are dependent on -// the definition of the Type class. Of course Type derives from Value, which -// contains an AbstractTypeUser instance, so there is no good way to factor out -// the code. Hence this bit of uglyness. -// -// In the long term, Type should not derive from Value, allowing -// AbstractTypeUser.h to #include Type.h, allowing us to eliminate this -// nastyness entirely. +// the definition of the Type class. // inline void PATypeHandle::addUser() { assert(Ty && "Type Handle has a null type!"); From sabre at nondot.org Sat Sep 23 02:41:07 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 23 Sep 2006 02:41:07 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/LoopSimplify.cpp Message-ID: <200609230741.k8N7f7FP026606@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: LoopSimplify.cpp updated: 1.74 -> 1.75 --- Log message: Teach UpdateDomInfoForRevectoredPreds to handle revectored preds that are not reachable, making it general purpose enough for use by InsertPreheaderForLoop. Eliminate custom dominfo updating code in InsertPreheaderForLoop, using UpdateDomInfoForRevectoredPreds instead. --- Diffs of the changes: (+49 -91) LoopSimplify.cpp | 140 +++++++++++++++++++------------------------------------ 1 files changed, 49 insertions(+), 91 deletions(-) Index: llvm/lib/Transforms/Utils/LoopSimplify.cpp diff -u llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.74 llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.75 --- llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.74 Sun Aug 27 17:42:52 2006 +++ llvm/lib/Transforms/Utils/LoopSimplify.cpp Sat Sep 23 02:40:52 2006 @@ -353,9 +353,10 @@ if (!L->contains(*PI)) // Coming in from outside the loop? OutsideBlocks.push_back(*PI); // Keep track of it... - // Split out the loop pre-header + // Split out the loop pre-header. BasicBlock *NewBB = SplitBlockPredecessors(Header, ".preheader", OutsideBlocks); + //===--------------------------------------------------------------------===// // Update analysis results now that we have performed the transformation @@ -365,86 +366,7 @@ if (Loop *Parent = L->getParentLoop()) Parent->addBasicBlockToLoop(NewBB, *LI); - DominatorSet &DS = getAnalysis(); // Update dominator info - DominatorTree &DT = getAnalysis(); - - - // Update the dominator tree information. - // The immediate dominator of the preheader is the immediate dominator of - // the old header. - DominatorTree::Node *PHDomTreeNode = - DT.createNewNode(NewBB, DT.getNode(Header)->getIDom()); - BasicBlock *oldHeaderIDom = DT.getNode(Header)->getIDom()->getBlock(); - - // Change the header node so that PNHode is the new immediate dominator - DT.changeImmediateDominator(DT.getNode(Header), PHDomTreeNode); - - { - // The blocks that dominate NewBB are the blocks that dominate Header, - // minus Header, plus NewBB. - DominatorSet::DomSetType DomSet = DS.getDominators(Header); - DomSet.erase(Header); // Header does not dominate us... - DS.addBasicBlock(NewBB, DomSet); - - // The newly created basic block dominates all nodes dominated by Header. - for (df_iterator DFI = df_begin(PHDomTreeNode), - E = df_end(PHDomTreeNode); DFI != E; ++DFI) - DS.addDominator((*DFI)->getBlock(), NewBB); - } - - // Update immediate dominator information if we have it... - if (ImmediateDominators *ID = getAnalysisToUpdate()) { - // Whatever i-dominated the header node now immediately dominates NewBB - ID->addNewBlock(NewBB, ID->get(Header)); - - // The preheader now is the immediate dominator for the header node... - ID->setImmediateDominator(Header, NewBB); - } - - // Update ET Forest information if we have it... - if (ETForest *EF = getAnalysisToUpdate()) { - // Whatever i-dominated the header node now immediately dominates NewBB - EF->addNewBlock(NewBB, oldHeaderIDom); - - // The preheader now is the immediate dominator for the header node... - EF->setImmediateDominator(Header, NewBB); - } - - // Update dominance frontier information... - if (DominanceFrontier *DF = getAnalysisToUpdate()) { - // The DF(NewBB) is just (DF(Header)-Header), because NewBB dominates - // everything that Header does, and it strictly dominates Header in - // addition. - assert(DF->find(Header) != DF->end() && "Header node doesn't have DF set?"); - DominanceFrontier::DomSetType NewDFSet = DF->find(Header)->second; - NewDFSet.erase(Header); - DF->addBasicBlock(NewBB, NewDFSet); - - // Now we must loop over all of the dominance frontiers in the function, - // replacing occurrences of Header with NewBB in some cases. If a block - // dominates a (now) predecessor of NewBB, but did not strictly dominate - // Header, it will have Header in it's DF set, but should now have NewBB in - // its set. - for (unsigned i = 0, e = OutsideBlocks.size(); i != e; ++i) { - // Get all of the dominators of the predecessor... - const DominatorSet::DomSetType &PredDoms = - DS.getDominators(OutsideBlocks[i]); - for (DominatorSet::DomSetType::const_iterator PDI = PredDoms.begin(), - PDE = PredDoms.end(); PDI != PDE; ++PDI) { - BasicBlock *PredDom = *PDI; - // If the loop header is in DF(PredDom), then PredDom didn't dominate - // the header but did dominate a predecessor outside of the loop. Now - // we change this entry to include the preheader in the DF instead of - // the header. - DominanceFrontier::iterator DFI = DF->find(PredDom); - assert(DFI != DF->end() && "No dominance frontier for node?"); - if (DFI->second.count(Header)) { - DF->removeFromFrontier(DFI, Header); - DF->addToFrontier(DFI, NewBB); - } - } - } - } + UpdateDomInfoForRevectoredPreds(NewBB, OutsideBlocks); } /// RewriteLoopExitBlock - Ensure that the loop preheader dominates all exit @@ -727,10 +649,26 @@ // intersection of the dominators of predecessors, plus the block itself. // DominatorSet::DomSetType NewBBDomSet = DS.getDominators(PredBlocks[0]); - for (unsigned i = 1, e = PredBlocks.size(); i != e; ++i) - set_intersect(NewBBDomSet, DS.getDominators(PredBlocks[i])); - NewBBDomSet.insert(NewBB); // All blocks dominate themselves... - DS.addBasicBlock(NewBB, NewBBDomSet); + { + unsigned i, e = PredBlocks.size(); + // It is possible for some preds to not be reachable, and thus have empty + // dominator sets (all blocks must dom themselves, so no domset would + // otherwise be empty). If we see any of these, don't intersect with them, + // as that would certainly leave the resultant set empty. + for (i = 1; NewBBDomSet.empty(); ++i) { + assert(i != e && "Didn't find reachable pred?"); + NewBBDomSet = DS.getDominators(PredBlocks[i]); + } + + // Intersect the rest of the non-empty sets. + for (; i != e; ++i) { + const DominatorSet::DomSetType &PredDS = DS.getDominators(PredBlocks[i]); + if (!PredDS.empty()) + set_intersect(NewBBDomSet, PredDS); + } + NewBBDomSet.insert(NewBB); // All blocks dominate themselves. + DS.addBasicBlock(NewBB, NewBBDomSet); + } // The newly inserted basic block will dominate existing basic blocks iff the // PredBlocks dominate all of the non-pred blocks. If all predblocks dominate @@ -739,8 +677,14 @@ bool NewBBDominatesNewBBSucc = true; { BasicBlock *OnePred = PredBlocks[0]; - for (unsigned i = 1, e = PredBlocks.size(); i != e; ++i) - if (PredBlocks[i] != OnePred) { + unsigned i, e = PredBlocks.size(); + for (i = 1; !DS.isReachable(OnePred); ++i) { + assert(i != e && "Didn't find reachable pred?"); + OnePred = PredBlocks[i]; + } + + for (; i != e; ++i) + if (PredBlocks[i] != OnePred && DS.isReachable(PredBlocks[i])) { NewBBDominatesNewBBSucc = false; break; } @@ -777,15 +721,22 @@ DS.addDominator(I, NewBB); } - // Update immediate dominator information if we have it... + // Update immediate dominator information if we have it. BasicBlock *NewBBIDom = 0; if (ImmediateDominators *ID = getAnalysisToUpdate()) { // To find the immediate dominator of the new exit node, we trace up the // immediate dominators of a predecessor until we find a basic block that // dominates the exit block. // - BasicBlock *Dom = PredBlocks[0]; // Some random predecessor... - while (!NewBBDomSet.count(Dom)) { // Loop until we find a dominator... + BasicBlock *Dom = PredBlocks[0]; // Some random predecessor. + + // Find a reachable pred. + for (unsigned i = 1; !DS.isReachable(Dom); ++i) { + assert(i != PredBlocks.size() && "Didn't find reachable pred!"); + Dom = PredBlocks[i]; + } + + while (!NewBBDomSet.count(Dom)) { // Loop until we find a dominator. assert(Dom != 0 && "No shared dominator found???"); Dom = ID->get(Dom); } @@ -809,7 +760,14 @@ if (NewBBIDom) { NewBBIDomNode = DT->getNode(NewBBIDom); } else { - NewBBIDomNode = DT->getNode(PredBlocks[0]); // Random pred + // Scan all the pred blocks that were pulled out. Any individual one may + // actually be unreachable, which would mean it doesn't have dom info. + NewBBIDomNode = 0; + for (unsigned i = 0; !NewBBIDomNode; ++i) { + assert(i != PredBlocks.size() && "No reachable preds?"); + NewBBIDomNode = DT->getNode(PredBlocks[i]); + } + while (!NewBBDomSet.count(NewBBIDomNode->getBlock())) { NewBBIDomNode = NewBBIDomNode->getIDom(); assert(NewBBIDomNode && "No shared dominator found??"); From sabre at nondot.org Sat Sep 23 03:19:41 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 23 Sep 2006 03:19:41 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/LoopSimplify.cpp Message-ID: <200609230819.k8N8JfSA027217@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: LoopSimplify.cpp updated: 1.75 -> 1.76 --- Log message: Be far more careful when splitting a loop header, either to form a preheader or when splitting loops with a common header into multiple loops. In particular the old code would always insert the preheader before the old loop header. This is disasterous in cases where the loop hasn't been rotated. For example, it can produce code like: .. outside the loop... jmp LBB1_2 #bb13.outer LBB1_1: #bb1 movsd 8(%esp,%esi,8), %xmm1 mulsd (%edi), %xmm1 addsd %xmm0, %xmm1 addl $24, %edi incl %esi jmp LBB1_3 #bb13 LBB1_2: #bb13.outer leal (%edx,%eax,8), %edi pxor %xmm1, %xmm1 xorl %esi, %esi LBB1_3: #bb13 movapd %xmm1, %xmm0 cmpl $4, %esi jl LBB1_1 #bb1 Note that the loop body is actually LBB1_1 + LBB1_3, which means that the loop now contains an uncond branch WITHIN it to jump around the inserted loop header (LBB1_2). Doh. This patch changes the preheader insertion code to insert it in the right spot, producing this code: ... outside the loop, fall into the header ... LBB1_1: #bb13.outer leal (%edx,%eax,8), %esi pxor %xmm0, %xmm0 xorl %edi, %edi jmp LBB1_3 #bb13 LBB1_2: #bb1 movsd 8(%esp,%edi,8), %xmm0 mulsd (%esi), %xmm0 addsd %xmm1, %xmm0 addl $24, %esi incl %edi LBB1_3: #bb13 movapd %xmm0, %xmm1 cmpl $4, %edi jl LBB1_2 #bb1 Totally crazy, no branch in the loop! :) --- Diffs of the changes: (+50 -1) LoopSimplify.cpp | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 50 insertions(+), 1 deletion(-) Index: llvm/lib/Transforms/Utils/LoopSimplify.cpp diff -u llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.75 llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.76 --- llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.75 Sat Sep 23 02:40:52 2006 +++ llvm/lib/Transforms/Utils/LoopSimplify.cpp Sat Sep 23 03:19:21 2006 @@ -84,7 +84,10 @@ void InsertPreheaderForLoop(Loop *L); Loop *SeparateNestedLoop(Loop *L); void InsertUniqueBackedgeBlock(Loop *L); - + void PlaceSplitBlockCarefully(BasicBlock *NewBB, + std::vector &SplitPreds, + Loop *L); + void UpdateDomInfoForRevectoredPreds(BasicBlock *NewBB, std::vector &PredBlocks); }; @@ -367,6 +370,10 @@ Parent->addBasicBlockToLoop(NewBB, *LI); UpdateDomInfoForRevectoredPreds(NewBB, OutsideBlocks); + + // Make sure that NewBB is put someplace intelligent, which doesn't mess up + // code layout too horribly. + PlaceSplitBlockCarefully(NewBB, OutsideBlocks, L); } /// RewriteLoopExitBlock - Ensure that the loop preheader dominates all exit @@ -435,6 +442,44 @@ return 0; } +// PlaceSplitBlockCarefully - If the block isn't already, move the new block to +// right after some 'outside block' block. This prevents the preheader from +// being placed inside the loop body, e.g. when the loop hasn't been rotated. +void LoopSimplify::PlaceSplitBlockCarefully(BasicBlock *NewBB, + std::vector&SplitPreds, + Loop *L) { + // Check to see if NewBB is already well placed. + Function::iterator BBI = NewBB; --BBI; + for (unsigned i = 0, e = SplitPreds.size(); i != e; ++i) { + if (&*BBI == SplitPreds[i]) + return; + } + + // If it isn't already after an outside block, move it after one. This is + // always good as it makes the uncond branch from the outside block into a + // fall-through. + + // Figure out *which* outside block to put this after. Prefer an outside + // block that neighbors a BB actually in the loop. + BasicBlock *FoundBB = 0; + for (unsigned i = 0, e = SplitPreds.size(); i != e; ++i) { + Function::iterator BBI = SplitPreds[i]; + if (++BBI != NewBB->getParent()->end() && + L->contains(BBI)) { + FoundBB = SplitPreds[i]; + break; + } + } + + // If our heuristic for a *good* bb to place this after doesn't find + // anything, just pick something. It's likely better than leaving it within + // the loop. + if (!FoundBB) + FoundBB = SplitPreds[0]; + NewBB->moveAfter(FoundBB); +} + + /// SeparateNestedLoop - If this loop has multiple backedges, try to pull one of /// them out into a nested loop. This is important for code that looks like /// this: @@ -471,6 +516,10 @@ // Update dominator information (set, immdom, domtree, and domfrontier) UpdateDomInfoForRevectoredPreds(NewBB, OuterLoopPreds); + // Make sure that NewBB is put someplace intelligent, which doesn't mess up + // code layout too horribly. + PlaceSplitBlockCarefully(NewBB, OuterLoopPreds, L); + // Create the new outer loop. Loop *NewOuter = new Loop(); From nicholas at mxc.ca Sat Sep 23 10:13:23 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Sat, 23 Sep 2006 10:13:23 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Message-ID: <200609231513.k8NFDNHo003380@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: PredicateSimplifier.cpp updated: 1.14 -> 1.15 --- Log message: Style changes only. Remove dead code, fix a comment. --- Diffs of the changes: (+4 -11) PredicateSimplifier.cpp | 15 ++++----------- 1 files changed, 4 insertions(+), 11 deletions(-) Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.14 llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.15 --- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.14 Wed Sep 20 20:05:35 2006 +++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Sat Sep 23 10:13:08 2006 @@ -72,10 +72,6 @@ return leaders.empty(); } - typename std::vector::size_type countLeaders() const { - return leaders.size(); - } - iterator findLeader(ElemTy e) { typename std::map::iterator MI = mapping.find(e); if (MI == mapping.end()) return 0; @@ -140,8 +136,7 @@ /// Represents the set of equivalent Value*s and provides insertion /// and fast lookup. Also stores the set of inequality relationships. class PropertySet { - /// Returns true if V1 is a better choice than V2. Note that it is - /// not a total ordering. + /// Returns true if V1 is a better choice than V2. bool compare(Value *V1, Value *V2) const { if (isa(V1)) { if (!isa(V2)) { @@ -393,8 +388,6 @@ void debug(std::ostream &os) const { static const char *OpcodeTable[] = { "EQ", "NE" }; - unsigned int size = union_find.countLeaders(); - union_find.debug(os); for (std::vector::const_iterator I = Properties.begin(), E = Properties.end(); I != E; ++I) { @@ -552,8 +545,8 @@ Value *lhs = resolve(BO->getOperand(0), KP), *rhs = resolve(BO->getOperand(1), KP); - ConstantIntegral *CI1 = dyn_cast(lhs); - ConstantIntegral *CI2 = dyn_cast(rhs); + ConstantIntegral *CI1 = dyn_cast(lhs), + *CI2 = dyn_cast(rhs); if (CI1 && CI2) return ConstantExpr::get(BO->getOpcode(), CI1, CI2); @@ -612,7 +605,7 @@ if (V != Oper) { modified = true; ++NumVarsReplaced; - DEBUG(std::cerr << "resolving " << *I); + DEBUG(std::cerr << "Resolving " << *I); I->setOperand(i, V); DEBUG(std::cerr << "into " << *I); } From nicholas at mxc.ca Sat Sep 23 19:08:32 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Sat, 23 Sep 2006 19:08:32 -0500 Subject: [llvm-commits] CVS: llvm/tools/gccas/gccas.cpp Message-ID: <200609240008.k8O08WcF011338@zion.cs.uiuc.edu> Changes in directory llvm/tools/gccas: gccas.cpp updated: 1.118 -> 1.119 --- Log message: Enable 'predsimplify' optimization. --- 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.118 llvm/tools/gccas/gccas.cpp:1.119 --- llvm/tools/gccas/gccas.cpp:1.118 Fri Aug 18 03:43:06 2006 +++ llvm/tools/gccas/gccas.cpp Sat Sep 23 19:08:16 2006 @@ -103,6 +103,7 @@ addPass(PM, createCFGSimplificationPass()); // Merge & remove BBs addPass(PM, createScalarReplAggregatesPass()); // Break up aggregate allocas addPass(PM, createInstructionCombiningPass()); // Combine silly seq's + addPass(PM, createPredicateSimplifierPass()); // Canonicalize registers addPass(PM, createCondPropagationPass()); // Propagate conditionals addPass(PM, createTailCallEliminationPass()); // Eliminate tail calls From nicholas at mxc.ca Sat Sep 23 19:08:32 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Sat, 23 Sep 2006 19:08:32 -0500 Subject: [llvm-commits] CVS: llvm/tools/gccld/GenerateCode.cpp Message-ID: <200609240008.k8O08Wc7011341@zion.cs.uiuc.edu> Changes in directory llvm/tools/gccld: GenerateCode.cpp updated: 1.62 -> 1.63 --- Log message: Enable 'predsimplify' optimization. --- Diffs of the changes: (+1 -0) GenerateCode.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/tools/gccld/GenerateCode.cpp diff -u llvm/tools/gccld/GenerateCode.cpp:1.62 llvm/tools/gccld/GenerateCode.cpp:1.63 --- llvm/tools/gccld/GenerateCode.cpp:1.62 Sat Sep 9 16:30:13 2006 +++ llvm/tools/gccld/GenerateCode.cpp Sat Sep 23 19:08:16 2006 @@ -248,6 +248,7 @@ // The IPO passes may leave cruft around. Clean up after them. addPass(Passes, createInstructionCombiningPass()); + addPass(Passes, createPredicateSimplifierPass()); addPass(Passes, createScalarReplAggregatesPass()); // Break up allocas From evan.cheng at apple.com Sun Sep 24 00:22:53 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Sun, 24 Sep 2006 00:22:53 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200609240522.k8O5Mr3C016074@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.277 -> 1.278 --- Log message: PIC jump table entries are always 32-bit. This fixes PIC jump table support on X86-64. --- Diffs of the changes: (+4 -5) SelectionDAGISel.cpp | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.277 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.278 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.277 Mon Sep 18 12:59:35 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sun Sep 24 00:22:38 2006 @@ -857,18 +857,17 @@ MVT::ValueType PTy = TLI.getPointerTy(); assert((PTy == MVT::i32 || PTy == MVT::i64) && "Jump table entries are 32-bit values"); + bool isPIC = TLI.getTargetMachine().getRelocationModel() == Reloc::PIC_; // PIC jump table entries are 32-bit values. - unsigned EntrySize = - (TLI.getTargetMachine().getRelocationModel() == Reloc::PIC_) - ? 4 : MVT::getSizeInBits(PTy)/8; + unsigned EntrySize = isPIC ? 4 : MVT::getSizeInBits(PTy)/8; SDOperand Copy = DAG.getCopyFromReg(getRoot(), JT.Reg, PTy); SDOperand IDX = DAG.getNode(ISD::MUL, PTy, Copy, DAG.getConstant(EntrySize, PTy)); SDOperand TAB = DAG.getJumpTable(JT.JTI,PTy); SDOperand ADD = DAG.getNode(ISD::ADD, PTy, IDX, TAB); - SDOperand LD = DAG.getLoad(PTy, Copy.getValue(1), ADD, + SDOperand LD = DAG.getLoad(isPIC ? MVT::i32 : PTy, Copy.getValue(1), ADD, DAG.getSrcValue(0)); - if (TLI.getTargetMachine().getRelocationModel() == Reloc::PIC_) { + if (isPIC) { ADD = DAG.getNode(ISD::ADD, PTy, ((PTy != MVT::i32) ? DAG.getNode(ISD::SIGN_EXTEND, PTy, LD) : LD), TAB); DAG.setRoot(DAG.getNode(ISD::BRIND, MVT::Other, LD.getValue(1), ADD)); From alenhar2 at cs.uiuc.edu Sun Sep 24 08:13:25 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sun, 24 Sep 2006 08:13:25 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/Readme.txt Message-ID: <200609241313.k8ODDPFY026591@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: Readme.txt updated: 1.4 -> 1.5 --- Log message: jump table note --- Diffs of the changes: (+150 -0) Readme.txt | 150 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 150 insertions(+) Index: llvm/lib/Target/Alpha/Readme.txt diff -u llvm/lib/Target/Alpha/Readme.txt:1.4 llvm/lib/Target/Alpha/Readme.txt:1.5 --- llvm/lib/Target/Alpha/Readme.txt:1.4 Wed Sep 20 10:05:49 2006 +++ llvm/lib/Target/Alpha/Readme.txt Sun Sep 24 08:13:10 2006 @@ -1,3 +1,153 @@ +Fix jump table support. currently it uses 64bit absolute address. +gcc uses gprel32. This way I won't keep fighting Evan as he keeps +breaking 64bit entries in jump tables... + +#include +#include + +int main(int x, char** y) +{ +char* foo; +switch(x) { +case 1: +foo = "1"; +break; +case 2: +foo = "2"; +break; +case 3: +foo = "3"; +break; +case 4: +foo = "4"; +break; +case 5: +foo = "5"; +break; +case 6: +foo = "6"; +break; +case 7: +foo = "7"; +break; +case 8: +foo = "8"; +break; +}; +print(foo); +return 0; + +} + + + .set noreorder + .set volatile + .set noat + .set nomacro + .section .rodata.str1.1,"aMS", at progbits,1 +$LC6: + .ascii "7\0" +$LC7: + .ascii "8\0" +$LC0: + .ascii "1\0" +$LC1: + .ascii "2\0" +$LC2: + .ascii "3\0" +$LC3: + .ascii "4\0" +$LC4: + .ascii "5\0" +$LC5: + .ascii "6\0" + .text + .align 2 + .align 4 + .globl main + .ent main +main: + .frame $30,16,$26,0 + .mask 0x4000000,-16 + ldah $29,0($27) !gpdisp!1 + lda $29,0($29) !gpdisp!1 +$main..ng: + zapnot $16,15,$16 + lda $30,-16($30) + cmpule $16,8,$1 + stq $26,0($30) + .prologue 1 + beq $1,$L2 + ldah $6,$L11($29) !gprelhigh + lda $5,$L11($6) !gprellow + s4addq $16,$5,$0 + ldl $2,0($0) + addq $29,$2,$3 + jmp $31,($3),$L2 + .section .rodata + .align 2 + .align 2 +$L11: + .gprel32 $L2 + .gprel32 $L3 + .gprel32 $L4 + .gprel32 $L5 + .gprel32 $L6 + .gprel32 $L7 + .gprel32 $L8 + .gprel32 $L9 + .gprel32 $L10 + .text +$L9: + ldah $20,$LC6($29) !gprelhigh + lda $4,$LC6($20) !gprellow + .align 4 +$L2: + mov $4,$16 + ldq $27,print($29) !literal!2 + jsr $26,($27),print !lituse_jsr!2 + ldah $29,0($26) !gpdisp!3 + mov $31,$0 + bis $31,$31,$31 + lda $29,0($29) !gpdisp!3 + ldq $26,0($30) + lda $30,16($30) + ret $31,($26),1 +$L10: + ldah $21,$LC7($29) !gprelhigh + lda $4,$LC7($21) !gprellow + br $31,$L2 +$L3: + ldah $7,$LC0($29) !gprelhigh + lda $4,$LC0($7) !gprellow + br $31,$L2 +$L4: + ldah $8,$LC1($29) !gprelhigh + lda $4,$LC1($8) !gprellow + br $31,$L2 +$L5: + ldah $16,$LC2($29) !gprelhigh + lda $4,$LC2($16) !gprellow + br $31,$L2 +$L6: + ldah $17,$LC3($29) !gprelhigh + lda $4,$LC3($17) !gprellow + br $31,$L2 +$L7: + ldah $18,$LC4($29) !gprelhigh + lda $4,$LC4($18) !gprellow + br $31,$L2 +$L8: + ldah $19,$LC5($29) !gprelhigh + lda $4,$LC5($19) !gprellow + br $31,$L2 + .end main + .section .note.GNU-stack,"", at progbits + .ident "GCC: (GNU) 3.4.4 20050314 (prerelease) (Debian 3.4.3-13)" + + + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Fix Ordered/Unordered FP stuff From alenhar2 at cs.uiuc.edu Sun Sep 24 14:42:17 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sun, 24 Sep 2006 14:42:17 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Alpha/jmp_table.ll Message-ID: <200609241942.k8OJgHKd000353@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Alpha: jmp_table.ll added (r1.1) --- Log message: basic jump table test --- Diffs of the changes: (+98 -0) jmp_table.ll | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 98 insertions(+) Index: llvm/test/Regression/CodeGen/Alpha/jmp_table.ll diff -c /dev/null llvm/test/Regression/CodeGen/Alpha/jmp_table.ll:1.1 *** /dev/null Sun Sep 24 14:42:12 2006 --- llvm/test/Regression/CodeGen/Alpha/jmp_table.ll Sun Sep 24 14:42:02 2006 *************** *** 0 **** --- 1,98 ---- + ; try to check that we have the most important instructions, which shouldn't appear otherwise + ; RUN: llvm-as < %s | llc -march=alpha | grep 'jmp' + ; RUN: llvm-as < %s | llc -march=alpha | grep 'gprel32' + ; RUN: llvm-as < %s | llc -march=alpha | grep 'ldl' + + target endian = little + target pointersize = 64 + target triple = "alphaev67-unknown-linux-gnu" + %str = internal constant [2 x sbyte] c"1\00" ; <[2 x sbyte]*> [#uses=1] + %str1 = internal constant [2 x sbyte] c"2\00" ; <[2 x sbyte]*> [#uses=1] + %str2 = internal constant [2 x sbyte] c"3\00" ; <[2 x sbyte]*> [#uses=1] + %str3 = internal constant [2 x sbyte] c"4\00" ; <[2 x sbyte]*> [#uses=1] + %str4 = internal constant [2 x sbyte] c"5\00" ; <[2 x sbyte]*> [#uses=1] + %str5 = internal constant [2 x sbyte] c"6\00" ; <[2 x sbyte]*> [#uses=1] + %str6 = internal constant [2 x sbyte] c"7\00" ; <[2 x sbyte]*> [#uses=1] + %str7 = internal constant [2 x sbyte] c"8\00" ; <[2 x sbyte]*> [#uses=1] + + implementation ; Functions: + + int %main(int %x, sbyte** %y) { + entry: + %x_addr = alloca int ; [#uses=2] + %y_addr = alloca sbyte** ; [#uses=1] + %retval = alloca int, align 4 ; [#uses=2] + %tmp = alloca int, align 4 ; [#uses=2] + %foo = alloca sbyte*, align 8 ; [#uses=9] + "alloca point" = cast int 0 to int ; [#uses=0] + store int %x, int* %x_addr + store sbyte** %y, sbyte*** %y_addr + %tmp = load int* %x_addr ; [#uses=1] + switch int %tmp, label %bb15 [ + int 1, label %bb + int 2, label %bb1 + int 3, label %bb3 + int 4, label %bb5 + int 5, label %bb7 + int 6, label %bb9 + int 7, label %bb11 + int 8, label %bb13 + ] + + bb: ; preds = %entry + %tmp = getelementptr [2 x sbyte]* %str, int 0, ulong 0 ; [#uses=1] + store sbyte* %tmp, sbyte** %foo + br label %bb16 + + bb1: ; preds = %entry + %tmp2 = getelementptr [2 x sbyte]* %str1, int 0, ulong 0 ; [#uses=1] + store sbyte* %tmp2, sbyte** %foo + br label %bb16 + + bb3: ; preds = %entry + %tmp4 = getelementptr [2 x sbyte]* %str2, int 0, ulong 0 ; [#uses=1] + store sbyte* %tmp4, sbyte** %foo + br label %bb16 + + bb5: ; preds = %entry + %tmp6 = getelementptr [2 x sbyte]* %str3, int 0, ulong 0 ; [#uses=1] + store sbyte* %tmp6, sbyte** %foo + br label %bb16 + + bb7: ; preds = %entry + %tmp8 = getelementptr [2 x sbyte]* %str4, int 0, ulong 0 ; [#uses=1] + store sbyte* %tmp8, sbyte** %foo + br label %bb16 + + bb9: ; preds = %entry + %tmp10 = getelementptr [2 x sbyte]* %str5, int 0, ulong 0 ; [#uses=1] + store sbyte* %tmp10, sbyte** %foo + br label %bb16 + + bb11: ; preds = %entry + %tmp12 = getelementptr [2 x sbyte]* %str6, int 0, ulong 0 ; [#uses=1] + store sbyte* %tmp12, sbyte** %foo + br label %bb16 + + bb13: ; preds = %entry + %tmp14 = getelementptr [2 x sbyte]* %str7, int 0, ulong 0 ; [#uses=1] + store sbyte* %tmp14, sbyte** %foo + br label %bb16 + + bb15: ; preds = %entry + br label %bb16 + + bb16: ; preds = %bb15, %bb13, %bb11, %bb9, %bb7, %bb5, %bb3, %bb1, %bb + %tmp17 = load sbyte** %foo ; [#uses=1] + %tmp18 = call int (...)* %print( sbyte* %tmp17 ) ; [#uses=0] + store int 0, int* %tmp + %tmp19 = load int* %tmp ; [#uses=1] + store int %tmp19, int* %retval + br label %return + + return: ; preds = %bb16 + %retval = load int* %retval ; [#uses=1] + ret int %retval + } + + declare int %print(...) From alenhar2 at cs.uiuc.edu Sun Sep 24 14:43:46 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sun, 24 Sep 2006 14:43:46 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGNodes.h Message-ID: <200609241943.k8OJhkGS000409@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: SelectionDAGNodes.h updated: 1.147 -> 1.148 --- Log message: Add support for other relocation bases to jump tables, as well as custom asm directives --- Diffs of the changes: (+3 -0) SelectionDAGNodes.h | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.147 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.148 --- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.147 Thu Sep 14 02:30:48 2006 +++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Sun Sep 24 14:43:29 2006 @@ -82,6 +82,9 @@ Constant, ConstantFP, GlobalAddress, FrameIndex, JumpTable, ConstantPool, ExternalSymbol, + // The relocation value to add to the value loaded from a jump table + JumpTableRelocBase, + // TargetConstant* - Like Constant*, but the DAG does not do any folding or // simplification of the constant. TargetConstant, From alenhar2 at cs.uiuc.edu Sun Sep 24 14:43:46 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sun, 24 Sep 2006 14:43:46 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetAsmInfo.h Message-ID: <200609241943.k8OJhk04000414@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetAsmInfo.h updated: 1.2 -> 1.3 --- Log message: Add support for other relocation bases to jump tables, as well as custom asm directives --- Diffs of the changes: (+4 -0) TargetAsmInfo.h | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm/include/llvm/Target/TargetAsmInfo.h diff -u llvm/include/llvm/Target/TargetAsmInfo.h:1.2 llvm/include/llvm/Target/TargetAsmInfo.h:1.3 --- llvm/include/llvm/Target/TargetAsmInfo.h:1.2 Thu Sep 7 17:06:40 2006 +++ llvm/include/llvm/Target/TargetAsmInfo.h Sun Sep 24 14:43:29 2006 @@ -108,6 +108,7 @@ const char *Data16bitsDirective; // Defaults to "\t.short\t" const char *Data32bitsDirective; // Defaults to "\t.long\t" const char *Data64bitsDirective; // Defaults to "\t.quad\t" + const char *JumpTableDirective; // if used, the jump table reloc flag //===--- Alignment Information ----------------------------------------===// @@ -323,6 +324,9 @@ const char *getData64bitsDirective() const { return Data64bitsDirective; } + const char *getJumpTableDirective() const { + return JumpTableDirective; + } const char *getAlignDirective() const { return AlignDirective; } From alenhar2 at cs.uiuc.edu Sun Sep 24 14:45:24 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sun, 24 Sep 2006 14:45:24 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp SelectionDAGISel.cpp Message-ID: <200609241945.k8OJjONp000502@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.399 -> 1.400 SelectionDAGISel.cpp updated: 1.278 -> 1.279 --- Log message: Add support for other relocation bases to jump tables, as well as custom asm directives --- Diffs of the changes: (+13 -1) LegalizeDAG.cpp | 11 +++++++++++ SelectionDAGISel.cpp | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.399 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.400 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.399 Tue Sep 19 22:38:48 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Sun Sep 24 14:44:59 2006 @@ -558,6 +558,17 @@ #endif assert(0 && "Do not know how to legalize this operator!"); abort(); + case ISD::JumpTableRelocBase: + switch (TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0))) { + case TargetLowering::Custom: + Tmp1 = TLI.LowerOperation(Op, DAG); + if (Tmp1.Val) Result = Tmp1; + break; + default: + Result = LegalizeOp(Node->getOperand(0)); + break; + } + break; case ISD::GlobalAddress: case ISD::ExternalSymbol: case ISD::ConstantPool: Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.278 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.279 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.278 Sun Sep 24 00:22:38 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sun Sep 24 14:44:59 2006 @@ -868,8 +868,9 @@ SDOperand LD = DAG.getLoad(isPIC ? MVT::i32 : PTy, Copy.getValue(1), ADD, DAG.getSrcValue(0)); if (isPIC) { + SDOperand Reloc = DAG.getNode(ISD::JumpTableRelocBase, PTy, TAB); ADD = DAG.getNode(ISD::ADD, PTy, - ((PTy != MVT::i32) ? DAG.getNode(ISD::SIGN_EXTEND, PTy, LD) : LD), TAB); + ((PTy != MVT::i32) ? DAG.getNode(ISD::SIGN_EXTEND, PTy, LD) : LD), Reloc); DAG.setRoot(DAG.getNode(ISD::BRIND, MVT::Other, LD.getValue(1), ADD)); } else { DAG.setRoot(DAG.getNode(ISD::BRIND, MVT::Other, LD.getValue(1), LD)); From alenhar2 at cs.uiuc.edu Sun Sep 24 14:45:24 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sun, 24 Sep 2006 14:45:24 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp Message-ID: <200609241945.k8OJjOYN000497@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.97 -> 1.98 --- Log message: Add support for other relocation bases to jump tables, as well as custom asm directives --- Diffs of the changes: (+8 -3) AsmPrinter.cpp | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.97 llvm/lib/CodeGen/AsmPrinter.cpp:1.98 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.97 Mon Sep 18 13:00:18 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Sun Sep 24 14:44:59 2006 @@ -187,7 +187,10 @@ // JTEntryDirective is a string to print sizeof(ptr) for non-PIC jump tables, // and 32 bits for PIC since PIC jump table entries are differences, not // pointers to blocks. - const char *JTEntryDirective = TAI->getData32bitsDirective(); + // Use the architecture specific relocation directive, if it is set + const char *JTEntryDirective = TAI->getJumpTableDirective(); + if (!JTEntryDirective) + JTEntryDirective = TAI->getData32bitsDirective(); // Pick the directive to use to print the jump table entries, and switch to // the appropriate section. @@ -227,8 +230,10 @@ << '_' << i << "_set_" << JTBBs[ii]->getNumber(); } else if (TM.getRelocationModel() == Reloc::PIC_) { printBasicBlockLabel(JTBBs[ii], false, false); - O << '-' << TAI->getPrivateGlobalPrefix() << "JTI" - << getFunctionNumber() << '_' << i; + //If the arch uses custom Jump Table directives, don't calc relative to JT + if (!TAI->getJumpTableDirective()) + O << '-' << TAI->getPrivateGlobalPrefix() << "JTI" + << getFunctionNumber() << '_' << i; } else { printBasicBlockLabel(JTBBs[ii], false, false); } From alenhar2 at cs.uiuc.edu Sun Sep 24 14:46:12 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sun, 24 Sep 2006 14:46:12 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetAsmInfo.cpp Message-ID: <200609241946.k8OJkCrm000548@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetAsmInfo.cpp updated: 1.2 -> 1.3 --- Log message: Add support for other relocation bases to jump tables, as well as custom asm directives --- 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.2 llvm/lib/Target/TargetAsmInfo.cpp:1.3 --- llvm/lib/Target/TargetAsmInfo.cpp:1.2 Wed Sep 6 14:21:41 2006 +++ llvm/lib/Target/TargetAsmInfo.cpp Sun Sep 24 14:45:58 2006 @@ -47,6 +47,7 @@ ConstantPoolSection("\t.section .rodata\n"), JumpTableDataSection("\t.section .rodata\n"), JumpTableTextSection("\t.text\n"), + JumpTableDirective(0), StaticCtorsSection("\t.section .ctors,\"aw\", at progbits"), StaticDtorsSection("\t.section .dtors,\"aw\", at progbits"), FourByteConstantSection(0), From alenhar2 at cs.uiuc.edu Sun Sep 24 14:47:10 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sun, 24 Sep 2006 14:47:10 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelLowering.cpp AlphaTargetAsmInfo.cpp AlphaTargetMachine.cpp Message-ID: <200609241947.k8OJlAaU000586@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelLowering.cpp updated: 1.61 -> 1.62 AlphaTargetAsmInfo.cpp updated: 1.1 -> 1.2 AlphaTargetMachine.cpp updated: 1.32 -> 1.33 --- Log message: Fix jump tables to match gcc (and the ABI and whatnot) --- Diffs of the changes: (+7 -0) AlphaISelLowering.cpp | 4 ++++ AlphaTargetAsmInfo.cpp | 2 ++ AlphaTargetMachine.cpp | 1 + 3 files changed, 7 insertions(+) Index: llvm/lib/Target/Alpha/AlphaISelLowering.cpp diff -u llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.61 llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.62 --- llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.61 Mon Sep 18 13:01:03 2006 +++ llvm/lib/Target/Alpha/AlphaISelLowering.cpp Sun Sep 24 14:46:56 2006 @@ -129,6 +129,8 @@ setOperationAction(ISD::RET, MVT::Other, Custom); setOperationAction(ISD::JumpTable, MVT::i64, Custom); + setOperationAction(ISD::JumpTable, MVT::i32, Custom); + setOperationAction(ISD::JumpTableRelocBase, MVT::i64, Custom); setStackPointerRegisterToSaveRestore(Alpha::R30); @@ -412,6 +414,8 @@ GP, RA); case ISD::RET: return LowerRET(Op,DAG, getVRegRA()); case ISD::JumpTable: return LowerJumpTable(Op, DAG); + case ISD::JumpTableRelocBase: + return DAG.getNode(AlphaISD::GlobalBaseReg, MVT::i64); case ISD::SINT_TO_FP: { assert(MVT::i64 == Op.getOperand(0).getValueType() && Index: llvm/lib/Target/Alpha/AlphaTargetAsmInfo.cpp diff -u llvm/lib/Target/Alpha/AlphaTargetAsmInfo.cpp:1.1 llvm/lib/Target/Alpha/AlphaTargetAsmInfo.cpp:1.2 --- llvm/lib/Target/Alpha/AlphaTargetAsmInfo.cpp:1.1 Thu Sep 7 17:05:02 2006 +++ llvm/lib/Target/Alpha/AlphaTargetAsmInfo.cpp Sun Sep 24 14:46:56 2006 @@ -18,4 +18,6 @@ AlphaTargetAsmInfo::AlphaTargetAsmInfo(const AlphaTargetMachine &TM) { AlignmentIsInBytes = false; PrivateGlobalPrefix = "$"; + JumpTableDirective = ".gprel32"; + JumpTableTextSection = "\t.section .rodata\n"; } Index: llvm/lib/Target/Alpha/AlphaTargetMachine.cpp diff -u llvm/lib/Target/Alpha/AlphaTargetMachine.cpp:1.32 llvm/lib/Target/Alpha/AlphaTargetMachine.cpp:1.33 --- llvm/lib/Target/Alpha/AlphaTargetMachine.cpp:1.32 Mon Sep 18 14:44:29 2006 +++ llvm/lib/Target/Alpha/AlphaTargetMachine.cpp Sun Sep 24 14:46:56 2006 @@ -59,6 +59,7 @@ FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0), JITInfo(*this), Subtarget(M, FS) { + setRelocationModel(Reloc::PIC_); } From alenhar2 at cs.uiuc.edu Sun Sep 24 14:50:08 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sun, 24 Sep 2006 14:50:08 -0500 Subject: [llvm-commits] CVS: llvm-poolalloc/runtime/FL2Allocator/PoolAllocator.cpp Message-ID: <200609241950.k8OJo8ik000676@zion.cs.uiuc.edu> Changes in directory llvm-poolalloc/runtime/FL2Allocator: PoolAllocator.cpp updated: 1.54 -> 1.55 --- Log message: Add a trace statement --- Diffs of the changes: (+1 -0) PoolAllocator.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm-poolalloc/runtime/FL2Allocator/PoolAllocator.cpp diff -u llvm-poolalloc/runtime/FL2Allocator/PoolAllocator.cpp:1.54 llvm-poolalloc/runtime/FL2Allocator/PoolAllocator.cpp:1.55 --- llvm-poolalloc/runtime/FL2Allocator/PoolAllocator.cpp:1.54 Thu Jun 29 16:47:25 2006 +++ llvm-poolalloc/runtime/FL2Allocator/PoolAllocator.cpp Sun Sep 24 14:49:54 2006 @@ -666,6 +666,7 @@ // If we are not allowed to grow this pool, don't. if (!PoolTraits::CanGrowPool) { + DO_IF_TRACE(fprintf(stderr, "Pool Overflow, not growable\n")); abort(); return 0; }