[llvm-commits] CVS: llvm/include/llvm/ValueSymbolTable.h BasicBlock.h
Changes in directory llvm/include/llvm: ValueSymbolTable.h updated: 1.13 -> 1.14 BasicBlock.h updated: 1.68 -> 1.69 --- Log message: better portability for intptr_t. --- Diffs of the changes: (+2 -0) BasicBlock.h |1 + ValueSymbolTable.h |1 + 2 files changed, 2 insertions(+) Index: llvm/include/llvm/ValueSymbolTable.h diff -u llvm/include/llvm/ValueSymbolTable.h:1.13 llvm/include/llvm/ValueSymbolTable.h:1.14 --- llvm/include/llvm/ValueSymbolTable.h:1.13 Wed Apr 25 09:27:10 2007 +++ llvm/include/llvm/ValueSymbolTable.hFri May 18 02:07:05 2007 @@ -16,6 +16,7 @@ #include "llvm/Value.h" #include "llvm/ADT/StringMap.h" +#include "llvm/Support/DataTypes.h" namespace llvm { template Index: llvm/include/llvm/BasicBlock.h diff -u llvm/include/llvm/BasicBlock.h:1.68 llvm/include/llvm/BasicBlock.h:1.69 --- llvm/include/llvm/BasicBlock.h:1.68 Tue Apr 17 13:16:39 2007 +++ llvm/include/llvm/BasicBlock.h Fri May 18 02:07:05 2007 @@ -17,6 +17,7 @@ #include "llvm/Instruction.h" #include "llvm/SymbolTableListTraits.h" #include "llvm/ADT/ilist" +#include "llvm/Support/DataTypes.h" namespace llvm { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [release_20] CVS: llvm/include/llvm/BasicBlock.h ValueSymbolTable.h
Changes in directory llvm/include/llvm: BasicBlock.h updated: 1.68 -> 1.68.2.1 ValueSymbolTable.h updated: 1.13 -> 1.13.2.1 --- Log message: merge portability fix from mainline --- Diffs of the changes: (+2 -0) BasicBlock.h |1 + ValueSymbolTable.h |1 + 2 files changed, 2 insertions(+) Index: llvm/include/llvm/BasicBlock.h diff -u llvm/include/llvm/BasicBlock.h:1.68 llvm/include/llvm/BasicBlock.h:1.68.2.1 --- llvm/include/llvm/BasicBlock.h:1.68 Tue Apr 17 13:16:39 2007 +++ llvm/include/llvm/BasicBlock.h Fri May 18 02:07:27 2007 @@ -17,6 +17,7 @@ #include "llvm/Instruction.h" #include "llvm/SymbolTableListTraits.h" #include "llvm/ADT/ilist" +#include "llvm/Support/DataTypes.h" namespace llvm { Index: llvm/include/llvm/ValueSymbolTable.h diff -u llvm/include/llvm/ValueSymbolTable.h:1.13 llvm/include/llvm/ValueSymbolTable.h:1.13.2.1 --- llvm/include/llvm/ValueSymbolTable.h:1.13 Wed Apr 25 09:27:10 2007 +++ llvm/include/llvm/ValueSymbolTable.hFri May 18 02:07:27 2007 @@ -16,6 +16,7 @@ #include "llvm/Value.h" #include "llvm/ADT/StringMap.h" +#include "llvm/Support/DataTypes.h" namespace llvm { template ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [release_20] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp
Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.399 -> 1.399.2.1 --- Log message: Merging from mainline. --- Diffs of the changes: (+4 -3) X86ISelLowering.cpp |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.399 llvm/lib/Target/X86/X86ISelLowering.cpp:1.399.2.1 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.399 Thu May 3 11:52:29 2007 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Fri May 18 00:59:52 2007 @@ -4725,18 +4725,19 @@ case 'I': if (ConstantSDNode *C = dyn_cast(Op)) { if (C->getValue() <= 31) -return Op; +return DAG.getTargetConstant(C->getValue(), Op.getValueType()); } return SDOperand(0,0); case 'N': if (ConstantSDNode *C = dyn_cast(Op)) { if (C->getValue() <= 255) -return Op; +return DAG.getTargetConstant(C->getValue(), Op.getValueType()); } return SDOperand(0,0); case 'i': { // Literal immediates are always ok. -if (isa(Op)) return Op; +if (ConstantSDNode *CST = dyn_cast(Op)) + return DAG.getTargetConstant(CST->getValue(), Op.getValueType()); // If we are in non-pic codegen mode, we allow the address of a global (with // an optional displacement) to be used with 'i'. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/docs/ReleaseNotes.html
Changes in directory llvm/docs: ReleaseNotes.html updated: 1.384 -> 1.385 --- Log message: Fix typo. --- Diffs of the changes: (+2 -2) ReleaseNotes.html |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/docs/ReleaseNotes.html diff -u llvm/docs/ReleaseNotes.html:1.384 llvm/docs/ReleaseNotes.html:1.385 --- llvm/docs/ReleaseNotes.html:1.384 Fri May 18 01:38:51 2007 +++ llvm/docs/ReleaseNotes.html Fri May 18 04:04:20 2007 @@ -693,7 +693,7 @@ See http://gcc.gnu.org/onlinedocs/gcc/Constructing-Calls.html#Constructing%20Calls";>Constructing Calls: Dispatching a call to another function. -llvm-gcc partially supports tthese GCC extensions: +llvm-gcc partially supports these GCC extensions: http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html#Nested%20Functions";>Nested Functions: As in Algol and Pascal, lexical scoping of functions. Nested functions are supported, but llvm-gcc does not support non-local @@ -849,7 +849,7 @@ src="http://www.w3.org/Icons/valid-html401"; alt="Valid HTML 4.01!" /> http://llvm.org/";>LLVM Compiler Infrastructure - Last modified: $Date: 2007/05/18 06:38:51 $ + Last modified: $Date: 2007/05/18 09:04:20 $ ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/lib/llvm.exp
Changes in directory llvm/test/lib: llvm.exp updated: 1.23 -> 1.24 --- Log message: Fix typo. --- Diffs of the changes: (+1 -1) llvm.exp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/lib/llvm.exp diff -u llvm/test/lib/llvm.exp:1.23 llvm/test/lib/llvm.exp:1.24 --- llvm/test/lib/llvm.exp:1.23 Mon Apr 23 16:21:53 2007 +++ llvm/test/lib/llvm.exp Fri May 18 07:13:34 2007 @@ -39,7 +39,7 @@ return $resultmsg } -# This prcoedure performs variable substitutions on the RUN: lines of a test +# This procedure performs variable substitutions on the RUN: lines of a test # cases. proc substitute { line test tmpFile } { global srcroot objroot srcdir objdir subdir target_triplet prcontext ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IfConversion.cpp
Changes in directory llvm/lib/CodeGen: IfConversion.cpp updated: 1.6 -> 1.7 --- Log message: Watch out for blocks that end with a return. --- Diffs of the changes: (+2 -2) IfConversion.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/IfConversion.cpp diff -u llvm/lib/CodeGen/IfConversion.cpp:1.6 llvm/lib/CodeGen/IfConversion.cpp:1.7 --- llvm/lib/CodeGen/IfConversion.cpp:1.6 Thu May 17 20:55:58 2007 +++ llvm/lib/CodeGen/IfConversion.cpp Fri May 18 12:06:53 2007 @@ -316,7 +316,7 @@ // Either the 'true' block fallthrough to another block or it ends with a // return. If it's the former, add a conditional branch to its successor. -if (!TrueBBI.TrueBB) +if (!TrueBBI.TrueBB && BBI.TrueBB->succ_size()) TII->InsertBranch(*BBI.TrueBB, *BBI.TrueBB->succ_begin(), NULL, BBI.Cond); // Predicate the 'false' block. @@ -326,7 +326,7 @@ // Either the 'false' block fallthrough to another block or it ends with a // return. If it's the former, add a conditional branch to its successor. -if (!FalseBBI.TrueBB) +if (!FalseBBI.TrueBB && BBI.FalseBB->succ_size()) TII->InsertBranch(*BBI.FalseBB, *BBI.FalseBB->succ_begin(), NULL,NewCond); // Merge the 'true' and 'false' blocks by copying the instructions ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [release_20] CVS: llvm-test/SingleSource/Makefile
Changes in directory llvm-test/SingleSource: Makefile updated: 1.13 -> 1.13.2.1 --- Log message: Remove CustomChecked --- Diffs of the changes: (+0 -4) Makefile |4 1 files changed, 4 deletions(-) Index: llvm-test/SingleSource/Makefile diff -u llvm-test/SingleSource/Makefile:1.13 llvm-test/SingleSource/Makefile:1.13.2.1 --- llvm-test/SingleSource/Makefile:1.13Fri May 4 16:50:39 2007 +++ llvm-test/SingleSource/Makefile Fri May 18 12:01:32 2007 @@ -2,10 +2,6 @@ PARALLEL_DIRS = UnitTests Regression Benchmarks -ifndef REMOTE_HOST -PARALLEL_DIRS += CustomChecked -endif - LDFLAGS += -lm include Makefile.singlesrc ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [see] CVS: llvm-poolalloc/lib/DSA/Local.cpp Makefile
Changes in directory llvm-poolalloc/lib/DSA: Local.cpp updated: 1.158.2.4.2.9 -> 1.158.2.4.2.10 Makefile updated: 1.5.2.2 -> 1.5.2.2.2.1 --- Log message: new memcpy --- Diffs of the changes: (+70 -16) Local.cpp | 85 +++--- Makefile |1 2 files changed, 70 insertions(+), 16 deletions(-) Index: llvm-poolalloc/lib/DSA/Local.cpp diff -u llvm-poolalloc/lib/DSA/Local.cpp:1.158.2.4.2.9 llvm-poolalloc/lib/DSA/Local.cpp:1.158.2.4.2.10 --- llvm-poolalloc/lib/DSA/Local.cpp:1.158.2.4.2.9 Mon Apr 9 15:20:07 2007 +++ llvm-poolalloc/lib/DSA/Local.cppFri May 18 12:38:28 2007 @@ -12,7 +12,6 @@ // external interface to this file is the DSGraph constructor. // //===--===// - #include "llvm/ADT/Statistic.h" #include "dsa/DataStructure.h" #include "dsa/DSGraph.h" @@ -650,12 +649,21 @@ case Intrinsic::memcpy_i64: case Intrinsic::memmove_i32: case Intrinsic::memmove_i64: { -// Merge the first & second arguments, and mark the memory read and -// modified. -DSNodeHandle RetNH = getValueDest(**CS.arg_begin()); -RetNH.mergeWith(getValueDest(**(CS.arg_begin()+1))); -if (DSNode *N = RetNH.getNode()) - N->setModifiedMarker()->setReadMarker(); +DSNodeHandle destNH = getValueDest(**CS.arg_begin()); +DSNodeHandle srcNH = getValueDest(**(CS.arg_begin()+1)); +if (!destNH.getNode()) { + setDestTo(**CS.arg_begin(), createNode()); + destNH = getValueDest(**CS.arg_begin()); +} +if (!srcNH.getNode()) { + setDestTo(**(CS.arg_begin() + 1), createNode()); + srcNH = getValueDest(**(CS.arg_begin() + 1)); +} +destNH.getNode()->foldNodeCompletely(); +srcNH.getNode()->foldNodeCompletely(); +getLink(destNH.getNode()).mergeWith(getLink(srcNH.getNode())); +destNH.getNode()->setModifiedMarker(); +srcNH.getNode()->setReadMarker(); return true; } case Intrinsic::memset_i32: @@ -788,7 +796,7 @@ N->setModifiedMarker()->setUnknownNodeMarker(); const Type *RetTy = F->getFunctionType()->getReturnType(); if (const PointerType *PTy = dyn_cast(RetTy)) - N->mergeTypeInfo(PTy->getElementType(), Result.getOffset()); +N->mergeTypeInfo(PTy->getElementType(), Result.getOffset()); } // If this is freopen, merge the file descriptor passed in with the @@ -1101,12 +1109,21 @@ } else if (F->getName() == "llva_memcpy") { if (CS.getCaller()->getName() == "kmem_cache_alloc") return false; -// Merge the first & second arguments, and mark the memory read and -// modified. -DSNodeHandle RetNH = getValueDest(**CS.arg_begin()); -RetNH.mergeWith(getValueDest(**(CS.arg_begin()+1))); -if (DSNode *N = RetNH.getNode()) - N->setModifiedMarker()->setReadMarker(); +DSNodeHandle destNH = getValueDest(**CS.arg_begin()); +DSNodeHandle srcNH = getValueDest(**(CS.arg_begin()+1)); +if (!destNH.getNode()) { + setDestTo(**CS.arg_begin(), createNode()); + destNH = getValueDest(**CS.arg_begin()); +} +if (!srcNH.getNode()) { + setDestTo(**(CS.arg_begin() + 1), createNode()); + srcNH = getValueDest(**(CS.arg_begin() + 1)); +} +destNH.getNode()->foldNodeCompletely(); +srcNH.getNode()->foldNodeCompletely(); +getLink(destNH.getNode()).mergeWith(getLink(srcNH.getNode())); +destNH.getNode()->setModifiedMarker(); +srcNH.getNode()->setReadMarker(); return true; #if 1 } else if (F->getName() == "llva_save_stackp") { @@ -1137,7 +1154,7 @@ #endif } #endif - + return false; } @@ -1145,6 +1162,16 @@ Value *Callee = CS.getCalledValue(); if (Function *F = dyn_cast(Callee)) { +// if (F->getName() == "printk") { +// CallSite::arg_iterator AI = CS.arg_begin(), E = CS.arg_end(); +// for (; AI != E; ++AI) { +// // printf reads all pointer arguments. +// if (isPointerType((*AI)->getType())) +// if (DSNode *N = getValueDest(**AI).getNode()) +// N->setReadMarker(); +// } +// return; +// } if (F->isExternal()) if (F->isIntrinsic() && visitIntrinsic(CS, F)) return; @@ -1171,6 +1198,34 @@ if (visitExternal(CS,F)) return; + +if (F->getName() == "llva_invoke") { + Value* FF = *(CS.arg_begin() + 1); + if (isa(FF)) { +FF = cast(FF)->getOperand(0); + } + if (isa(FF) && cast(FF)->getOpcode() == Instruction::Cast) { +FF = cast(FF)->getOperand(0); + } + //std::cerr << "invoke special for: "; FF->dump(); std::cerr << "\n"; + std::vector Args; +// Calculate the arguments vector... + for (CallSite::arg_iterator I = CS.arg_begin() + 2, E = CS.arg_end(); I != E; ++I) { +Value* AA = *I; +if (isa(AA)) { + AA = cast(AA)->getOpe
[llvm-commits] CVS: llvm-test/RunSafely.sh
Changes in directory llvm-test: RunSafely.sh updated: 1.31 -> 1.32 --- Log message: reid's patch from yesterday broke darwin --- Diffs of the changes: (+1 -2) RunSafely.sh |3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm-test/RunSafely.sh diff -u llvm-test/RunSafely.sh:1.31 llvm-test/RunSafely.sh:1.32 --- llvm-test/RunSafely.sh:1.31 Thu May 17 22:34:23 2007 +++ llvm-test/RunSafely.sh Fri May 18 12:34:06 2007 @@ -35,7 +35,6 @@ # is the path to the program to run # are the arguments to pass to the program. # - if [ $# -lt 4 ]; then echo "./RunSafely.sh " exit 1 @@ -103,7 +102,7 @@ fi if [ "x$RHOST" = x ] ; then - ( eval $ULIMITCMD time -p sh -c "$COMMAND >$OUTFILE 2>&1 < $INFILE" ; echo exit $? ) 2>&1 \ + ( sh -c "$ULIMITCMD"; time -p sh -c "$COMMAND >$OUTFILE 2>&1 < $INFILE" ; echo exit $? ) 2>&1 \ | awk -- '\ BEGIN { cpu = 0.0; } /^user/ { cpu += $2; print; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm-test/RunSafely.sh
On Fri, 2007-05-18 at 12:34 -0500, Chris Lattner wrote: > > Changes in directory llvm-test: > > RunSafely.sh updated: 1.31 -> 1.32 > --- > Log message: > > reid's patch from yesterday broke darwin You realize that reverting that patch means that all tests are not guarded by any of the ulimit controls? Reid. > > > --- > Diffs of the changes: (+1 -2) > > RunSafely.sh |3 +-- > 1 files changed, 1 insertion(+), 2 deletions(-) > > > Index: llvm-test/RunSafely.sh > diff -u llvm-test/RunSafely.sh:1.31 llvm-test/RunSafely.sh:1.32 > --- llvm-test/RunSafely.sh:1.31 Thu May 17 22:34:23 2007 > +++ llvm-test/RunSafely.shFri May 18 12:34:06 2007 > @@ -35,7 +35,6 @@ > # is the path to the program to run > # are the arguments to pass to the program. > # > - > if [ $# -lt 4 ]; then >echo "./RunSafely.sh > " >exit 1 > @@ -103,7 +102,7 @@ > fi > > if [ "x$RHOST" = x ] ; then > - ( eval $ULIMITCMD time -p sh -c "$COMMAND >$OUTFILE 2>&1 < $INFILE" ; echo > exit $? ) 2>&1 \ > + ( sh -c "$ULIMITCMD"; time -p sh -c "$COMMAND >$OUTFILE 2>&1 < $INFILE" ; > echo exit $? ) 2>&1 \ > | awk -- '\ > BEGIN { cpu = 0.0; } > /^user/ { cpu += $2; print; } > > > > ___ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp SelectionDAGISel.cpp SelectionDAGPrinter.cpp TargetLowering.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.493 -> 1.494 SelectionDAGISel.cpp updated: 1.451 -> 1.452 SelectionDAGPrinter.cpp updated: 1.45 -> 1.46 TargetLowering.cpp updated: 1.115 -> 1.116 --- Log message: Qualify several calls to functions in the MVT namespace, for consistency. --- Diffs of the changes: (+25 -23) LegalizeDAG.cpp | 28 +++- SelectionDAGISel.cpp| 14 +++--- SelectionDAGPrinter.cpp |2 +- TargetLowering.cpp |4 ++-- 4 files changed, 25 insertions(+), 23 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.493 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.494 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.493 Thu May 17 13:15:41 2007 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri May 18 12:52:13 2007 @@ -2722,7 +2722,7 @@ case TargetLowering::Promote: { MVT::ValueType OVT = Tmp1.getValueType(); MVT::ValueType NVT = TLI.getTypeToPromoteTo(Node->getOpcode(), OVT); - unsigned DiffBits = getSizeInBits(NVT) - getSizeInBits(OVT); + unsigned DiffBits = MVT::getSizeInBits(NVT) - MVT::getSizeInBits(OVT); Tmp1 = DAG.getNode(ISD::ZERO_EXTEND, NVT, Tmp1); Tmp1 = DAG.getNode(ISD::BSWAP, NVT, Tmp1); @@ -2760,16 +2760,16 @@ case ISD::CTTZ: //if Tmp1 == sizeinbits(NVT) then Tmp1 = sizeinbits(Old VT) Tmp2 = DAG.getSetCC(TLI.getSetCCResultTy(), Tmp1, -DAG.getConstant(getSizeInBits(NVT), NVT), +DAG.getConstant(MVT::getSizeInBits(NVT), NVT), ISD::SETEQ); Result = DAG.getNode(ISD::SELECT, NVT, Tmp2, - DAG.getConstant(getSizeInBits(OVT),NVT), Tmp1); + DAG.getConstant(MVT::getSizeInBits(OVT),NVT), Tmp1); break; case ISD::CTLZ: // Tmp1 = Tmp1 - (sizeinbits(NVT) - sizeinbits(Old VT)) Result = DAG.getNode(ISD::SUB, NVT, Tmp1, - DAG.getConstant(getSizeInBits(NVT) - - getSizeInBits(OVT), NVT)); + DAG.getConstant(MVT::getSizeInBits(NVT) - + MVT::getSizeInBits(OVT), NVT)); break; } break; @@ -3527,7 +3527,8 @@ Tmp1 = DAG.getNode(ISD::ZERO_EXTEND, NVT, Tmp1); Tmp1 = DAG.getNode(ISD::BSWAP, NVT, Tmp1); Result = DAG.getNode(ISD::SRL, NVT, Tmp1, - DAG.getConstant(getSizeInBits(NVT) - getSizeInBits(VT), + DAG.getConstant(MVT::getSizeInBits(NVT) - + MVT::getSizeInBits(VT), TLI.getShiftAmountTy())); break; case ISD::CTPOP: @@ -3544,15 +3545,16 @@ case ISD::CTTZ: // if Tmp1 == sizeinbits(NVT) then Tmp1 = sizeinbits(Old VT) Tmp2 = DAG.getSetCC(TLI.getSetCCResultTy(), Tmp1, - DAG.getConstant(getSizeInBits(NVT), NVT), ISD::SETEQ); + DAG.getConstant(MVT::getSizeInBits(NVT), NVT), + ISD::SETEQ); Result = DAG.getNode(ISD::SELECT, NVT, Tmp2, - DAG.getConstant(getSizeInBits(VT), NVT), Tmp1); + DAG.getConstant(MVT::getSizeInBits(VT), NVT), Tmp1); break; case ISD::CTLZ: //Tmp1 = Tmp1 - (sizeinbits(NVT) - sizeinbits(Old VT)) Result = DAG.getNode(ISD::SUB, NVT, Tmp1, - DAG.getConstant(getSizeInBits(NVT) - - getSizeInBits(VT), NVT)); + DAG.getConstant(MVT::getSizeInBits(NVT) - + MVT::getSizeInBits(VT), NVT)); break; } break; @@ -4639,7 +4641,7 @@ }; MVT::ValueType VT = Op.getValueType(); MVT::ValueType ShVT = TLI.getShiftAmountTy(); -unsigned len = getSizeInBits(VT); +unsigned len = MVT::getSizeInBits(VT); for (unsigned i = 0; (1U << i) <= (len / 2); ++i) { //x = (x & mask[i][len/8]) + (x >> (1 << i) & mask[i][len/8]) SDOperand Tmp2 = DAG.getConstant(mask[i], VT); @@ -4662,7 +4664,7 @@ // but see also: http://www.hackersdelight.org/HDcode/nlz.cc MVT::ValueType VT = Op.getValueType(); MVT::ValueType ShVT = TLI.getShiftAmountTy(); -unsigned len = getSizeInBits(VT); +unsigned len = MVT::getSizeInBits(VT); for (unsigned i = 0; (1U << i) <= (len / 2); ++i) { SDOperand Tmp3 = DAG.getConstant(1ULL << i, ShVT); Op = DAG.getNode(ISD::OR, VT, Op, DAG.getNode(ISD::SRL, VT, Op, Tmp3)); @@ -4684,7 +4686,7 @@ if (!TLI.isOperationLegal(ISD::CTPOP, VT) && TLI.isOperationLegal(ISD::CTLZ, VT)) return DAG.getNode(ISD::SUB, VT, - DAG.getConstant(getSizeI
[llvm-commits] CVS: llvm/lib/CodeGen/IfConversion.cpp
Changes in directory llvm/lib/CodeGen: IfConversion.cpp updated: 1.7 -> 1.8 --- Log message: Some restructuring in preparation for most aggressive if-conversion. --- Diffs of the changes: (+71 -40) IfConversion.cpp | 111 +++ 1 files changed, 71 insertions(+), 40 deletions(-) Index: llvm/lib/CodeGen/IfConversion.cpp diff -u llvm/lib/CodeGen/IfConversion.cpp:1.7 llvm/lib/CodeGen/IfConversion.cpp:1.8 --- llvm/lib/CodeGen/IfConversion.cpp:1.7 Fri May 18 12:06:53 2007 +++ llvm/lib/CodeGen/IfConversion.cpp Fri May 18 13:14:37 2007 @@ -39,16 +39,20 @@ /// if-conversion feasibility analysis. This includes results from /// TargetInstrInfo::AnalyzeBranch() (i.e. TBB, FBB, and Cond), and its /// classification, and common tail block of its successors (if it's a -/// diamond shape). +/// diamond shape), its size, whether it's predicable, and whether any +/// instruction can clobber the 'would-be' predicate. struct BBInfo { BBICKind Kind; + unsigned Size; + bool isPredicable; + bool ClobbersPred; MachineBasicBlock *BB; MachineBasicBlock *TrueBB; MachineBasicBlock *FalseBB; MachineBasicBlock *TailBB; std::vector Cond; - unsigned Size; - BBInfo() : Kind(ICInvalid), BB(0), TrueBB(0), FalseBB(0), TailBB(0), Size(0) {} + BBInfo() : Kind(ICInvalid), Size(0), isPredicable(false), + ClobbersPred(false), BB(0), TrueBB(0), FalseBB(0), TailBB(0) {} }; /// BBAnalysis - Results of if-conversion feasibility analysis indexed by @@ -66,12 +70,12 @@ virtual const char *getPassName() const { return "If converter"; } private: -void AnalyzeBlock(MachineBasicBlock *BB); +void StructuralAnalysis(MachineBasicBlock *BB); +void FeasibilityAnalysis(BBInfo &BBI); void InitialFunctionAnalysis(MachineFunction &MF, std::vector &Candidates); -bool IfConvertDiamond(BBInfo &BBI); bool IfConvertTriangle(BBInfo &BBI); -bool isBlockPredicable(MachineBasicBlock *BB) const; +bool IfConvertDiamond(BBInfo &BBI); void PredicateBlock(MachineBasicBlock *BB, std::vector &Cond, bool IgnoreTerm = false); @@ -127,7 +131,10 @@ return NULL; } -void IfConverter::AnalyzeBlock(MachineBasicBlock *BB) { +/// StructuralAnalysis - Analyze the structure of the sub-CFG starting from +/// the specified block. Record its successors and whether it looks like an +/// if-conversion candidate. +void IfConverter::StructuralAnalysis(MachineBasicBlock *BB) { BBInfo &BBI = BBAnalysis[BB->getNumber()]; if (BBI.Kind != ICInvalid) @@ -147,7 +154,7 @@ return; // Not a candidate if 'true' block is going to be if-converted. - AnalyzeBlock(BBI.TrueBB); + StructuralAnalysis(BBI.TrueBB); BBInfo &TrueBBI = BBAnalysis[BBI.TrueBB->getNumber()]; if (TrueBBI.Kind != ICNotClassfied) return; @@ -168,7 +175,7 @@ return; // Not a candidate if 'false' block is going to be if-converted. - AnalyzeBlock(BBI.FalseBB); + StructuralAnalysis(BBI.FalseBB); BBInfo &FalseBBI = BBAnalysis[BBI.FalseBB->getNumber()]; if (FalseBBI.Kind != ICNotClassfied) return; @@ -203,13 +210,36 @@ return; } +/// FeasibilityAnalysis - Determine if the block is predicable. In most +/// cases, that means all the instructions in the block has M_PREDICABLE flag. +/// Also checks if the block contains any instruction which can clobber a +/// predicate (e.g. condition code register). If so, the block is not +/// predicable unless it's the last instruction. Note, this function assumes +/// all the terminator instructions can be converted or deleted so it ignore +/// them. +void IfConverter::FeasibilityAnalysis(BBInfo &BBI) { + if (BBI.Size == 0 || BBI.Size > TLI->getIfCvtBlockSizeLimit()) +return; + + for (MachineBasicBlock::iterator I = BBI.BB->begin(), E = BBI.BB->end(); + I != E; ++I) { +// TODO: check if instruction clobbers predicate. +if (TII->isTerminatorInstr(I->getOpcode())) + break; +if (!I->isPredicable()) + return; + } + + BBI.isPredicable = true; +} + /// InitialFunctionAnalysis - Analyze all blocks and find entries for all /// if-conversion candidates. void IfConverter::InitialFunctionAnalysis(MachineFunction &MF, std::vector &Candidates) { for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) { MachineBasicBlock *BB = I; -AnalyzeBlock(BB); +StructuralAnalysis(BB); BBInfo &BBI = BBAnalysis[BB->getNumber()]; if (BBI.Kind == ICTriangleEntry || BBI.Kind == ICDiamondEntry) Candidates.push_back(BB->getNumber()); @@ -245,8 +275,10 @@ /// IfConvertTriangle - If convert a triangle sub-CFG. /// bool IfConverter::IfConvertTriangle(BBInfo &BBI) { - if (isBlockPredicable(BBI.TrueBB)) { -BBInfo &True
Re: [llvm-commits] CVS: llvm-test/RunSafely.sh
On May 18, 2007, at 10:42 AM, Reid Spencer wrote: > On Fri, 2007-05-18 at 12:34 -0500, Chris Lattner wrote: >> >> Changes in directory llvm-test: >> >> RunSafely.sh updated: 1.31 -> 1.32 >> --- >> Log message: >> >> reid's patch from yesterday broke darwin > > You realize that reverting that patch means that all tests are not > guarded by any of the ulimit controls? Yes. You realize with the patch applied, all tests fail on darwin? -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp
Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.404 -> 1.405 --- Log message: Use MVT::FIRST_VECTOR_VALUETYPE and MVT::LAST_VECTOR_VALUETYPE. --- Diffs of the changes: (+2 -2) X86ISelLowering.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.404 llvm/lib/Target/X86/X86ISelLowering.cpp:1.405 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.404 Thu May 17 13:45:50 2007 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Fri May 18 13:44:07 2007 @@ -309,8 +309,8 @@ // First set operation action for all vector types to expand. Then we // will selectively turn on ones that can be effectively codegen'd. - for (unsigned VT = (unsigned)MVT::Vector + 1; - VT != (unsigned)MVT::LAST_VALUETYPE; VT++) { + for (unsigned VT = (unsigned)MVT::FIRST_VECTOR_VALUETYPE; + VT <= (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++VT) { setOperationAction(ISD::ADD , (MVT::ValueType)VT, Expand); setOperationAction(ISD::SUB , (MVT::ValueType)VT, Expand); setOperationAction(ISD::FADD, (MVT::ValueType)VT, Expand); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/README.txt
Changes in directory llvm/lib/CodeGen: README.txt updated: 1.5 -> 1.6 --- Log message: Document an inefficiency in tail merging. --- Diffs of the changes: (+19 -0) README.txt | 19 +++ 1 files changed, 19 insertions(+) Index: llvm/lib/CodeGen/README.txt diff -u llvm/lib/CodeGen/README.txt:1.5 llvm/lib/CodeGen/README.txt:1.6 --- llvm/lib/CodeGen/README.txt:1.5 Mon Apr 30 13:42:09 2007 +++ llvm/lib/CodeGen/README.txt Fri May 18 13:46:40 2007 @@ -142,3 +142,22 @@ load [T + 7] ... load [T + 15] +//===-===// +Tail merging issue: +When we're trying to merge the tails of predecessors of a block I, and there +are more than 2 predecessors, we don't do it optimally. Suppose predecessors +are A,B,C where B and C have 5 instructions in common, and A has 2 in common +with B or C. We want to get: +A: + jmp C3 +B: + jmp C2 +C: +C2: 3 common to B and C but not A +C3: 2 common to all 3 +You get this if B and C are merged first, but currently it might randomly decide +to merge A and B first, which results in not sharing the C2 instructions. We +could look at all N*(N-1) combinations of predecessors and merge the ones with +the most instructions in common first. Usually that will be fast, but it +could get slow on big graphs (e.g. large switches tend to have blocks with many +predecessors). ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm-test/RunSafely.sh
On Fri, 2007-05-18 at 11:24 -0700, Chris Lattner wrote: > On May 18, 2007, at 10:42 AM, Reid Spencer wrote: > > > On Fri, 2007-05-18 at 12:34 -0500, Chris Lattner wrote: > >> > >> Changes in directory llvm-test: > >> > >> RunSafely.sh updated: 1.31 -> 1.32 > >> --- > >> Log message: > >> > >> reid's patch from yesterday broke darwin > > > > You realize that reverting that patch means that all tests are not > > guarded by any of the ulimit controls? > > Yes. You realize with the patch applied, all tests fail on darwin? Yes. I'm not saying you did the wrong thing, just that we'll need to find a solution that works for all platforms. BTW, what error do you get or what happens when you try it with "eval" ? Reid. > > -Chris > ___ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [see] CVS: llvm-poolalloc/lib/DSA/Local.cpp
Changes in directory llvm-poolalloc/lib/DSA: Local.cpp updated: 1.158.2.4.2.10 -> 1.158.2.4.2.11 --- Log message: revert --- Diffs of the changes: (+15 -70) Local.cpp | 85 ++ 1 files changed, 15 insertions(+), 70 deletions(-) Index: llvm-poolalloc/lib/DSA/Local.cpp diff -u llvm-poolalloc/lib/DSA/Local.cpp:1.158.2.4.2.10 llvm-poolalloc/lib/DSA/Local.cpp:1.158.2.4.2.11 --- llvm-poolalloc/lib/DSA/Local.cpp:1.158.2.4.2.10 Fri May 18 12:38:28 2007 +++ llvm-poolalloc/lib/DSA/Local.cppFri May 18 13:26:25 2007 @@ -12,6 +12,7 @@ // external interface to this file is the DSGraph constructor. // //===--===// + #include "llvm/ADT/Statistic.h" #include "dsa/DataStructure.h" #include "dsa/DSGraph.h" @@ -649,21 +650,12 @@ case Intrinsic::memcpy_i64: case Intrinsic::memmove_i32: case Intrinsic::memmove_i64: { -DSNodeHandle destNH = getValueDest(**CS.arg_begin()); -DSNodeHandle srcNH = getValueDest(**(CS.arg_begin()+1)); -if (!destNH.getNode()) { - setDestTo(**CS.arg_begin(), createNode()); - destNH = getValueDest(**CS.arg_begin()); -} -if (!srcNH.getNode()) { - setDestTo(**(CS.arg_begin() + 1), createNode()); - srcNH = getValueDest(**(CS.arg_begin() + 1)); -} -destNH.getNode()->foldNodeCompletely(); -srcNH.getNode()->foldNodeCompletely(); -getLink(destNH.getNode()).mergeWith(getLink(srcNH.getNode())); -destNH.getNode()->setModifiedMarker(); -srcNH.getNode()->setReadMarker(); +// Merge the first & second arguments, and mark the memory read and +// modified. +DSNodeHandle RetNH = getValueDest(**CS.arg_begin()); +RetNH.mergeWith(getValueDest(**(CS.arg_begin()+1))); +if (DSNode *N = RetNH.getNode()) + N->setModifiedMarker()->setReadMarker(); return true; } case Intrinsic::memset_i32: @@ -796,7 +788,7 @@ N->setModifiedMarker()->setUnknownNodeMarker(); const Type *RetTy = F->getFunctionType()->getReturnType(); if (const PointerType *PTy = dyn_cast(RetTy)) -N->mergeTypeInfo(PTy->getElementType(), Result.getOffset()); + N->mergeTypeInfo(PTy->getElementType(), Result.getOffset()); } // If this is freopen, merge the file descriptor passed in with the @@ -1109,21 +1101,12 @@ } else if (F->getName() == "llva_memcpy") { if (CS.getCaller()->getName() == "kmem_cache_alloc") return false; -DSNodeHandle destNH = getValueDest(**CS.arg_begin()); -DSNodeHandle srcNH = getValueDest(**(CS.arg_begin()+1)); -if (!destNH.getNode()) { - setDestTo(**CS.arg_begin(), createNode()); - destNH = getValueDest(**CS.arg_begin()); -} -if (!srcNH.getNode()) { - setDestTo(**(CS.arg_begin() + 1), createNode()); - srcNH = getValueDest(**(CS.arg_begin() + 1)); -} -destNH.getNode()->foldNodeCompletely(); -srcNH.getNode()->foldNodeCompletely(); -getLink(destNH.getNode()).mergeWith(getLink(srcNH.getNode())); -destNH.getNode()->setModifiedMarker(); -srcNH.getNode()->setReadMarker(); +// Merge the first & second arguments, and mark the memory read and +// modified. +DSNodeHandle RetNH = getValueDest(**CS.arg_begin()); +RetNH.mergeWith(getValueDest(**(CS.arg_begin()+1))); +if (DSNode *N = RetNH.getNode()) + N->setModifiedMarker()->setReadMarker(); return true; #if 1 } else if (F->getName() == "llva_save_stackp") { @@ -1154,7 +1137,7 @@ #endif } #endif - + return false; } @@ -1162,16 +1145,6 @@ Value *Callee = CS.getCalledValue(); if (Function *F = dyn_cast(Callee)) { -// if (F->getName() == "printk") { -// CallSite::arg_iterator AI = CS.arg_begin(), E = CS.arg_end(); -// for (; AI != E; ++AI) { -// // printf reads all pointer arguments. -// if (isPointerType((*AI)->getType())) -// if (DSNode *N = getValueDest(**AI).getNode()) -// N->setReadMarker(); -// } -// return; -// } if (F->isExternal()) if (F->isIntrinsic() && visitIntrinsic(CS, F)) return; @@ -1198,34 +1171,6 @@ if (visitExternal(CS,F)) return; - -if (F->getName() == "llva_invoke") { - Value* FF = *(CS.arg_begin() + 1); - if (isa(FF)) { -FF = cast(FF)->getOperand(0); - } - if (isa(FF) && cast(FF)->getOpcode() == Instruction::Cast) { -FF = cast(FF)->getOperand(0); - } - //std::cerr << "invoke special for: "; FF->dump(); std::cerr << "\n"; - std::vector Args; -// Calculate the arguments vector... - for (CallSite::arg_iterator I = CS.arg_begin() + 2, E = CS.arg_end(); I != E; ++I) { -Value* AA = *I; -if (isa(AA)) { - AA = cast(AA)->getOperand(0); -} -if (isPointerType(AA->get
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.307 -> 1.308 --- Log message: Qualify calls to getTypeForValueType with MVT:: too. --- Diffs of the changes: (+3 -3) DAGCombiner.cpp |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.307 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.308 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.307 Wed May 16 17:45:30 2007 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri May 18 13:41:29 2007 @@ -2689,7 +2689,7 @@ TLI.isOperationLegal(ISD::LOAD, VT)) { LoadSDNode *LN0 = cast(N0); unsigned Align = TLI.getTargetMachine().getTargetData()-> - getABITypeAlignment(getTypeForValueType(VT)); + getABITypeAlignment(MVT::getTypeForValueType(VT)); unsigned OrigAlign = LN0->getAlignment(); if (Align <= OrigAlign) { SDOperand Load = DAG.getLoad(VT, LN0->getChain(), LN0->getBasePtr(), @@ -3569,7 +3569,7 @@ unsigned Align = ST->getAlignment(); MVT::ValueType SVT = Value.getOperand(0).getValueType(); unsigned OrigAlign = TLI.getTargetMachine().getTargetData()-> - getABITypeAlignment(getTypeForValueType(SVT)); + getABITypeAlignment(MVT::getTypeForValueType(SVT)); if (Align <= OrigAlign && TLI.isOperationLegal(ISD::STORE, SVT)) return DAG.getStore(Chain, Value.getOperand(0), Ptr, ST->getSrcValue(), ST->getSrcValueOffset()); @@ -3765,7 +3765,7 @@ if (VecIn2.Val) { Ops[1] = VecIn2; } else { - // Use an undef vbuild_vector as input for the second operand. + // Use an undef vbuild_vector as input for the second operand. std::vector UnOps(NumInScalars, DAG.getNode(ISD::UNDEF, cast(EltType)->getVT())); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] Use of MVT::LAST_VECTOR_VALUETYPE in PowerPC target
Hello all, While doing some experiments with vector ValueTypes, I noticed that the PowerPC target uses MVT::LAST_VECTOR_VALUETYPE inconsistently with the way it is declared. I don't have the resources to test PowerPC changes, so I'm just sending this patch to the list in case anyone who does is interested in it. Dan Index: lib/Target/PowerPC/PPCISelLowering.cpp === RCS file: /var/cvs/llvm/llvm/lib/Target/PowerPC/PPCISelLowering.cpp,v retrieving revision 1.270 diff -u -r1.270 PPCISelLowering.cpp --- lib/Target/PowerPC/PPCISelLowering.cpp +++ lib/Target/PowerPC/PPCISelLowering.cpp @@ -222,7 +222,7 @@ // First set operation action for all vector types to expand. Then we // will selectively turn on ones that can be effectively codegen'd. for (unsigned VT = (unsigned)MVT::FIRST_VECTOR_VALUETYPE; - VT != (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++VT) { + VT <= (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++VT) { // add/sub are legal for all supported vector VT's. setOperationAction(ISD::ADD , (MVT::ValueType)VT, Legal); setOperationAction(ISD::SUB , (MVT::ValueType)VT, Legal); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IfConversion.cpp
Changes in directory llvm/lib/CodeGen: IfConversion.cpp updated: 1.8 -> 1.9 --- Log message: Change to depth-first traversal. --- Diffs of the changes: (+22 -11) IfConversion.cpp | 33 ++--- 1 files changed, 22 insertions(+), 11 deletions(-) Index: llvm/lib/CodeGen/IfConversion.cpp diff -u llvm/lib/CodeGen/IfConversion.cpp:1.8 llvm/lib/CodeGen/IfConversion.cpp:1.9 --- llvm/lib/CodeGen/IfConversion.cpp:1.8 Fri May 18 13:14:37 2007 +++ llvm/lib/CodeGen/IfConversion.cpp Fri May 18 14:26:33 2007 @@ -19,6 +19,7 @@ #include "llvm/Target/TargetLowering.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Support/Debug.h" +#include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/Statistic.h" using namespace llvm; @@ -237,8 +238,11 @@ /// if-conversion candidates. void IfConverter::InitialFunctionAnalysis(MachineFunction &MF, std::vector &Candidates) { - for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) { -MachineBasicBlock *BB = I; + std::set Visited; + MachineBasicBlock *Entry = MF.begin(); + for (df_ext_iterator DFI = df_ext_begin(Entry, Visited), + E = df_ext_end(Entry, Visited); DFI != E; ++DFI) { +MachineBasicBlock *BB = *DFI; StructuralAnalysis(BB); BBInfo &BBI = BBAnalysis[BB->getNumber()]; if (BBI.Kind == ICTriangleEntry || BBI.Kind == ICDiamondEntry) @@ -379,23 +383,30 @@ TII->InsertBranch(*BBI.FalseBB, *BBI.FalseBB->succ_begin(), NULL,NewCond); // Merge the 'true' and 'false' blocks by copying the instructions -// from the 'false' block to the 'true' block. -MergeBlocks(TrueBBI, FalseBBI); +// from the 'false' block to the 'true' block. That is, unless the true +// block would clobber the predicate, in that case, do the opposite. +BBInfo *CvtBBI; +if (!TrueBBI.ClobbersPred) { + MergeBlocks(TrueBBI, FalseBBI); + CvtBBI = &TrueBBI; +} else { + MergeBlocks(FalseBBI, TrueBBI); + CvtBBI = &FalseBBI; +} // Remove the conditional branch from entry to the blocks. BBI.Size -= TII->RemoveBranch(*BBI.BB); // Merge the combined block into the entry of the diamond if the entry -// block is the only predecessor. Otherwise, insert an unconditional -// branch. -BBInfo *CvtBBI = &TrueBBI; -if (BBI.TrueBB->pred_size() == 1) { - BBI.BB->removeSuccessor(BBI.TrueBB); - MergeBlocks(BBI, TrueBBI); +// block is its only predecessor. Otherwise, insert an unconditional +// branch from entry to the if-converted block. +if (CvtBBI->BB->pred_size() == 1) { + BBI.BB->removeSuccessor(CvtBBI->BB); + MergeBlocks(BBI, *CvtBBI); CvtBBI = &BBI; } else { std::vector NoCond; - TII->InsertBranch(*BBI.BB, BBI.TrueBB, NULL, NoCond); + TII->InsertBranch(*BBI.BB, CvtBBI->BB, NULL, NoCond); } // If the if-converted block fallthrough into the tail block, then ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IfConversion.cpp
Changes in directory llvm/lib/CodeGen: IfConversion.cpp updated: 1.9 -> 1.10 --- Log message: Clean up. --- Diffs of the changes: (+5 -5) IfConversion.cpp | 10 +- 1 files changed, 5 insertions(+), 5 deletions(-) Index: llvm/lib/CodeGen/IfConversion.cpp diff -u llvm/lib/CodeGen/IfConversion.cpp:1.9 llvm/lib/CodeGen/IfConversion.cpp:1.10 --- llvm/lib/CodeGen/IfConversion.cpp:1.9 Fri May 18 14:26:33 2007 +++ llvm/lib/CodeGen/IfConversion.cpp Fri May 18 14:32:08 2007 @@ -74,7 +74,7 @@ void StructuralAnalysis(MachineBasicBlock *BB); void FeasibilityAnalysis(BBInfo &BBI); void InitialFunctionAnalysis(MachineFunction &MF, - std::vector &Candidates); + std::vector &Candidates); bool IfConvertTriangle(BBInfo &BBI); bool IfConvertDiamond(BBInfo &BBI); void PredicateBlock(MachineBasicBlock *BB, @@ -96,14 +96,14 @@ unsigned NumBBs = MF.getNumBlockIDs(); BBAnalysis.resize(NumBBs); - std::vector Candidates; + std::vector Candidates; // Do an intial analysis for each basic block and finding all the potential // candidates to perform if-convesion. InitialFunctionAnalysis(MF, Candidates); MadeChange = false; for (unsigned i = 0, e = Candidates.size(); i != e; ++i) { -BBInfo &BBI = BBAnalysis[Candidates[i]]; +BBInfo &BBI = *Candidates[i]; switch (BBI.Kind) { default: assert(false && "Unexpected!"); break; @@ -237,7 +237,7 @@ /// InitialFunctionAnalysis - Analyze all blocks and find entries for all /// if-conversion candidates. void IfConverter::InitialFunctionAnalysis(MachineFunction &MF, - std::vector &Candidates) { + std::vector &Candidates) { std::set Visited; MachineBasicBlock *Entry = MF.begin(); for (df_ext_iterator DFI = df_ext_begin(Entry, Visited), @@ -246,7 +246,7 @@ StructuralAnalysis(BB); BBInfo &BBI = BBAnalysis[BB->getNumber()]; if (BBI.Kind == ICTriangleEntry || BBI.Kind == ICDiamondEntry) - Candidates.push_back(BB->getNumber()); + Candidates.push_back(&BBI); } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Transforms/LoopUnroll/2007-05-09-UnknownTripCount.ll
Changes in directory llvm/test/Transforms/LoopUnroll: 2007-05-09-UnknownTripCount.ll added (r1.1) --- Log message: Add a testcase for unrolling loops with unknown tripcounts. --- Diffs of the changes: (+18 -0) 2007-05-09-UnknownTripCount.ll | 18 ++ 1 files changed, 18 insertions(+) Index: llvm/test/Transforms/LoopUnroll/2007-05-09-UnknownTripCount.ll diff -c /dev/null llvm/test/Transforms/LoopUnroll/2007-05-09-UnknownTripCount.ll:1.1 *** /dev/null Fri May 18 14:59:34 2007 --- llvm/test/Transforms/LoopUnroll/2007-05-09-UnknownTripCount.ll Fri May 18 14:59:23 2007 *** *** 0 --- 1,18 + ; RUN: llvm-as < %s | opt -loop-unroll -unroll-count=3 | llvm-dis | grep bb72.2 + + define void @foo(i32 %trips) { + entry: + br label %cond_true.outer + + cond_true.outer: + %indvar1.ph = phi i32 [ 0, %entry ], [ %indvar.next2, %bb72 ] + br label %bb72 + + bb72: + %indvar.next2 = add i32 %indvar1.ph, 1 + %exitcond3 = icmp eq i32 %indvar.next2, %trips + br i1 %exitcond3, label %cond_true138, label %cond_true.outer + + cond_true138: + ret void + } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] Use of MVT::LAST_VECTOR_VALUETYPE in PowerPC target
On May 18, 2007, at 11:59 AM, Dan Gohman wrote: > Hello all, > > While doing some experiments with vector ValueTypes, I noticed that > the PowerPC target uses MVT::LAST_VECTOR_VALUETYPE inconsistently with > the way it is declared. I don't have the resources to test PowerPC > changes, so I'm just sending this patch to the list in case anyone > who does is interested in it. The patch looks safe to me, but how is it semantically different? -Chris > Dan > > Index: lib/Target/PowerPC/PPCISelLowering.cpp > === > RCS file: /var/cvs/llvm/llvm/lib/Target/PowerPC/PPCISelLowering.cpp,v > retrieving revision 1.270 > diff -u -r1.270 PPCISelLowering.cpp > --- lib/Target/PowerPC/PPCISelLowering.cpp > +++ lib/Target/PowerPC/PPCISelLowering.cpp > @@ -222,7 +222,7 @@ > // First set operation action for all vector types to expand. > Then we > // will selectively turn on ones that can be effectively > codegen'd. > for (unsigned VT = (unsigned)MVT::FIRST_VECTOR_VALUETYPE; > - VT != (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++VT) { > + VT <= (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++VT) { >// add/sub are legal for all supported vector VT's. >setOperationAction(ISD::ADD , (MVT::ValueType)VT, Legal); >setOperationAction(ISD::SUB , (MVT::ValueType)VT, Legal); > ___ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/README.txt
Changes in directory llvm/lib/Target/X86: README.txt updated: 1.168 -> 1.169 --- Log message: add a note --- Diffs of the changes: (+9 -0) README.txt |9 + 1 files changed, 9 insertions(+) Index: llvm/lib/Target/X86/README.txt diff -u llvm/lib/Target/X86/README.txt:1.168 llvm/lib/Target/X86/README.txt:1.169 --- llvm/lib/Target/X86/README.txt:1.168Wed May 9 19:08:04 2007 +++ llvm/lib/Target/X86/README.txt Fri May 18 15:18:14 2007 @@ -26,6 +26,15 @@ ... which should only be one imul instruction. +or: + +unsigned long long int t2(unsigned int a, unsigned int b) { + return (unsigned long long)a * b; +} + +... which should be one mul instruction. + + This can be done with a custom expander, but it would be nice to move this to generic code. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] Use of MVT::LAST_VECTOR_VALUETYPE in PowerPC target
On May 18, 2007, at 3:08 PM, Chris Lattner wrote: > > > Hello all, > > > > While doing some experiments with vector ValueTypes, I noticed that > > the PowerPC target uses MVT::LAST_VECTOR_VALUETYPE inconsistently with > > the way it is declared. I don't have the resources to test PowerPC > > changes, so I'm just sending this patch to the list in case anyone > > who does is interested in it. > > The patch looks safe to me, but how is it semantically different? It would make the for loop cover v2f64, where it didn't before. Dan -- Dan Gohman, Cray Inc. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] Use of MVT::LAST_VECTOR_VALUETYPE in PowerPC target
On May 18, 2007, at 2:51 PM, Dan Gohman wrote: > On May 18, 2007, at 3:08 PM, Chris Lattner wrote: >> >>> Hello all, >>> >>> While doing some experiments with vector ValueTypes, I noticed that >>> the PowerPC target uses MVT::LAST_VECTOR_VALUETYPE inconsistently >>> with >>> the way it is declared. I don't have the resources to test PowerPC >>> changes, so I'm just sending this patch to the list in case anyone >>> who does is interested in it. >> >> The patch looks safe to me, but how is it semantically different? > > It would make the for loop cover v2f64, where it didn't before. Ah, I get it. LAST_VECTOR_VT is inclusive, not exclusive. The patch looks great, plz apply, Thanks, -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelLowering.cpp
Changes in directory llvm/lib/Target/PowerPC: PPCISelLowering.cpp updated: 1.270 -> 1.271 --- Log message: Apply this patch: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070514/049845.html --- Diffs of the changes: (+1 -1) PPCISelLowering.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.270 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.271 --- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.270 Mon May 14 20:31:05 2007 +++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Fri May 18 18:21:46 2007 @@ -222,7 +222,7 @@ // First set operation action for all vector types to expand. Then we // will selectively turn on ones that can be effectively codegen'd. for (unsigned VT = (unsigned)MVT::FIRST_VECTOR_VALUETYPE; - VT != (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++VT) { + VT <= (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++VT) { // add/sub are legal for all supported vector VT's. setOperationAction(ISD::ADD , (MVT::ValueType)VT, Legal); setOperationAction(ISD::SUB , (MVT::ValueType)VT, Legal); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Support/APInt.cpp
Changes in directory llvm/lib/Support: APInt.cpp updated: 1.85 -> 1.86 --- Log message: Fix an assertion introduced by my last change to the toString method. We can't use getZExtValue() to extract the low order bits for each digit. Instead, we need to access the low order word directly. --- Diffs of the changes: (+2 -2) APInt.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Support/APInt.cpp diff -u llvm/lib/Support/APInt.cpp:1.85 llvm/lib/Support/APInt.cpp:1.86 --- llvm/lib/Support/APInt.cpp:1.85 Thu May 17 14:23:02 2007 +++ llvm/lib/Support/APInt.cpp Fri May 18 19:29:55 2007 @@ -1962,9 +1962,9 @@ uint64_t mask = radix - 1; APInt zero(tmp.getBitWidth(), 0); while (tmp.ne(zero)) { -unsigned digit = tmp.getZExtValue() & mask; -tmp = tmp.lshr(shift); +unsigned digit = (tmp.isSingleWord() ? tmp.VAL : tmp.pVal[0]) & mask; result.insert(insert_at, digits[digit]); +tmp = tmp.lshr(shift); } } return result; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/bigint.reference_output
Changes in directory llvm-test/SingleSource/UnitTests/Integer: bigint.reference_output updated: 1.3 -> 1.4 --- Log message: The reference output was previously in error as it wasn't showing 500 bits when an APInt of 500 bits was printed. This corrects the output. --- Diffs of the changes: (+2 -2) bigint.reference_output |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-test/SingleSource/UnitTests/Integer/bigint.reference_output diff -u llvm-test/SingleSource/UnitTests/Integer/bigint.reference_output:1.3 llvm-test/SingleSource/UnitTests/Integer/bigint.reference_output:1.4 --- llvm-test/SingleSource/UnitTests/Integer/bigint.reference_output:1.3 Mon May 14 13:43:28 2007 +++ llvm-test/SingleSource/UnitTests/Integer/bigint.reference_outputFri May 18 19:33:35 2007 @@ -1,9 +1,9 @@ Initially: -int500 x = +int500 x = int169 y = 101010111001100100010 After modification: -int500 x = 0001 +int500 x = 0001 int169 y = 101010111000100110011 result = x * y = 01010100110110110001011101101 ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/bits.h
Changes in directory llvm-test/SingleSource/UnitTests/Integer: bits.h updated: 1.10 -> 1.11 --- Log message: Add uint169 type. --- Diffs of the changes: (+1 -0) bits.h |1 + 1 files changed, 1 insertion(+) Index: llvm-test/SingleSource/UnitTests/Integer/bits.h diff -u llvm-test/SingleSource/UnitTests/Integer/bits.h:1.10 llvm-test/SingleSource/UnitTests/Integer/bits.h:1.11 --- llvm-test/SingleSource/UnitTests/Integer/bits.h:1.10Thu May 17 13:02:42 2007 +++ llvm-test/SingleSource/UnitTests/Integer/bits.h Fri May 18 19:39:45 2007 @@ -41,6 +41,7 @@ typedef unsigned int __attribute__((bitwidth(68))) uint68; typedef unsigned int __attribute__((bitwidth(69))) uint69; typedef unsigned int __attribute__((bitwidth(128))) uint128; +typedef unsigned int __attribute__((bitwidth(169))) uint169; typedef unsigned int __attribute__((bitwidth(250))) uint250; typedef unsigned int __attribute__((bitwidth(256))) uint256; typedef unsigned int __attribute__((bitwidth(500))) uint500; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/CodeGen/PowerPC/compare-duplicate.ll
Changes in directory llvm/test/CodeGen/PowerPC: compare-duplicate.ll added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+11 -0) compare-duplicate.ll | 11 +++ 1 files changed, 11 insertions(+) Index: llvm/test/CodeGen/PowerPC/compare-duplicate.ll diff -c /dev/null llvm/test/CodeGen/PowerPC/compare-duplicate.ll:1.1 *** /dev/null Fri May 18 19:41:50 2007 --- llvm/test/CodeGen/PowerPC/compare-duplicate.ll Fri May 18 19:41:40 2007 *** *** 0 --- 1,11 + ; RUN: llvm-as < %s | llc | not grep slwi + + define i32 @test(i32 %A, i32 %B) { + %C = sub i32 %B, %A + %D = icmp eq i32 %C, %A + br i1 %D, label %T, label %F + T: + ret i32 19123 + F: + ret i32 %C + } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: TargetLowering.cpp updated: 1.116 -> 1.117 --- Log message: Disable the (A == (B-A)) -> 2*A == B xform when the sub has multiple uses (in this case, the xform introduces an extra operation). This compiles PowerPC/compare-duplicate.ll into: _test: subf r2, r3, r4 cmplw cr0, r2, r3 bne cr0, LBB1_2 ;F instead of: _test: slwi r2, r3, 1 subf r3, r3, r4 cmplw cr0, r4, r2 bne cr0, LBB1_2 ;F This is target independent of course. --- Diffs of the changes: (+1 -1) TargetLowering.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp diff -u llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.116 llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.117 --- llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.116 Fri May 18 12:52:13 2007 +++ llvm/lib/CodeGen/SelectionDAG/TargetLowering.cppFri May 18 19:43:44 2007 @@ -1785,7 +1785,7 @@ if (DAG.isCommutativeBinOp(N0.getOpcode())) return DAG.getSetCC(VT, N0.getOperand(0), DAG.getConstant(0, N0.getValueType()), Cond); -else { +else if (N0.Val->hasOneUse()) { assert(N0.getOpcode() == ISD::SUB && "Unexpected operation!"); // (Z-X) == X --> Z == X<<1 SDOperand SH = DAG.getNode(ISD::SHL, N1.getValueType(), ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: TargetLowering.cpp updated: 1.117 -> 1.118 --- Log message: same patch as the previous one, but the symmetric case --- Diffs of the changes: (+1 -1) TargetLowering.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp diff -u llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.117 llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.118 --- llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.117 Fri May 18 19:43:44 2007 +++ llvm/lib/CodeGen/SelectionDAG/TargetLowering.cppFri May 18 19:46:51 2007 @@ -1808,7 +1808,7 @@ if (DAG.isCommutativeBinOp(N1.getOpcode())) { return DAG.getSetCC(VT, N1.getOperand(0), DAG.getConstant(0, N1.getValueType()), Cond); -} else { +} else if (N1.Val->hasOneUse()) { assert(N1.getOpcode() == ISD::SUB && "Unexpected operation!"); // X == (Z-X) --> X<<1 == Z SDOperand SH = DAG.getNode(ISD::SHL, N1.getValueType(), N0, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/part_select2.c
Changes in directory llvm-test/SingleSource/UnitTests/Integer: part_select2.c updated: 1.3 -> 1.4 --- Log message: Make this test case compile again. --- Diffs of the changes: (+0 -4) part_select2.c |4 1 files changed, 4 deletions(-) Index: llvm-test/SingleSource/UnitTests/Integer/part_select2.c diff -u llvm-test/SingleSource/UnitTests/Integer/part_select2.c:1.3 llvm-test/SingleSource/UnitTests/Integer/part_select2.c:1.4 --- llvm-test/SingleSource/UnitTests/Integer/part_select2.c:1.3 Thu May 17 01:25:37 2007 +++ llvm-test/SingleSource/UnitTests/Integer/part_select2.c Fri May 18 19:48:24 2007 @@ -1,10 +1,6 @@ #include "bits.h" -typedef int __attribute__ ((bitwidth(128))) int128; -typedef int __attribute__ ((bitwidth(8))) int8; -// typedef unsigned int __attribute__ ((bitwidth(19))) uint19; - int main() { int128 X = 0xde7ed959bcfdb200ULL; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/CodeGen/X86/lsr-negative-stride.ll
Changes in directory llvm/test/CodeGen/X86: lsr-negative-stride.ll added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+37 -0) lsr-negative-stride.ll | 37 + 1 files changed, 37 insertions(+) Index: llvm/test/CodeGen/X86/lsr-negative-stride.ll diff -c /dev/null llvm/test/CodeGen/X86/lsr-negative-stride.ll:1.1 *** /dev/null Fri May 18 20:21:49 2007 --- llvm/test/CodeGen/X86/lsr-negative-stride.llFri May 18 20:21:39 2007 *** *** 0 --- 1,37 + ; RUN: llvm-as < %s | llc -march=x86 | not grep neg + ; RUN: llvm-as < %s | llc -march=x86 | not grep sub.*esp + ; RUN: llvm-as < %s | llc -march=x86 | not grep esi + + define i32 @t(i32 %a, i32 %b) { + entry: + %tmp1434 = icmp eq i32 %a, %b ; [#uses=1] + br i1 %tmp1434, label %bb17, label %bb.outer + + bb.outer: ; preds = %cond_false, %entry + %b_addr.021.0.ph = phi i32 [ %b, %entry ], [ %tmp10, %cond_false ] ; [#uses=5] + %a_addr.026.0.ph = phi i32 [ %a, %entry ], [ %a_addr.026.0, %cond_false ] ; [#uses=1] + br label %bb + + bb: ; preds = %cond_true, %bb.outer + %indvar = phi i32 [ 0, %bb.outer ], [ %indvar.next, %cond_true ] ; [#uses=2] + %tmp. = sub i32 0, %b_addr.021.0.ph ; [#uses=1] + %tmp.40 = mul i32 %indvar, %tmp.; [#uses=1] + %a_addr.026.0 = add i32 %tmp.40, %a_addr.026.0.ph ; [#uses=6] + %tmp3 = icmp sgt i32 %a_addr.026.0, %b_addr.021.0.ph; [#uses=1] + br i1 %tmp3, label %cond_true, label %cond_false + + cond_true:; preds = %bb + %tmp7 = sub i32 %a_addr.026.0, %b_addr.021.0.ph ; [#uses=2] + %tmp1437 = icmp eq i32 %tmp7, %b_addr.021.0.ph ; [#uses=1] + %indvar.next = add i32 %indvar, 1 ; [#uses=1] + br i1 %tmp1437, label %bb17, label %bb + + cond_false: ; preds = %bb + %tmp10 = sub i32 %b_addr.021.0.ph, %a_addr.026.0; [#uses=2] + %tmp14 = icmp eq i32 %a_addr.026.0, %tmp10 ; [#uses=1] + br i1 %tmp14, label %bb17, label %bb.outer + + bb17: ; preds = %cond_false, %cond_true, %entry + %a_addr.026.1 = phi i32 [ %a, %entry ], [ %tmp7, %cond_true ], [ %a_addr.026.0, %cond_false ] ; [#uses=1] + ret i32 %a_addr.026.1 + } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Changes in directory llvm/lib/Transforms/Scalar: LoopStrengthReduce.cpp updated: 1.137 -> 1.138 --- Log message: Handle negative strides much more optimally. This compiles X86/lsr-negative-stride.ll into: _t: movl 8(%esp), %ecx movl 4(%esp), %eax cmpl %ecx, %eax je LBB1_3 #bb17 LBB1_1: #bb cmpl %ecx, %eax jg LBB1_4 #cond_true LBB1_2: #cond_false subl %eax, %ecx cmpl %ecx, %eax jne LBB1_1 #bb LBB1_3: #bb17 ret LBB1_4: #cond_true subl %ecx, %eax cmpl %ecx, %eax jne LBB1_1 #bb jmp LBB1_3 #bb17 instead of: _t: subl $4, %esp movl %esi, (%esp) movl 12(%esp), %ecx movl 8(%esp), %eax cmpl %ecx, %eax je LBB1_4 #bb17 LBB1_1: #bb.outer movl %ecx, %edx negl %edx LBB1_2: #bb cmpl %ecx, %eax jle LBB1_5 #cond_false LBB1_3: #cond_true addl %edx, %eax cmpl %ecx, %eax jne LBB1_2 #bb LBB1_4: #bb17 movl (%esp), %esi addl $4, %esp ret LBB1_5: #cond_false movl %ecx, %edx subl %eax, %edx movl %eax, %esi addl %esi, %esi cmpl %ecx, %esi je LBB1_4 #bb17 LBB1_6: #cond_false.bb.outer_crit_edge movl %edx, %ecx jmp LBB1_1 #bb.outer --- Diffs of the changes: (+26 -3) LoopStrengthReduce.cpp | 29 ++--- 1 files changed, 26 insertions(+), 3 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.137 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.138 --- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.137 Fri May 11 17:40:34 2007 +++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Fri May 18 20:22:21 2007 @@ -987,6 +987,20 @@ return Val.isUseOfPostIncrementedValue; } +/// isNonConstantNegative - REturn true if the specified scev is negated, but +/// not a constant. +static bool isNonConstantNegative(const SCEVHandle &Expr) { + SCEVMulExpr *Mul = dyn_cast(Expr); + if (!Mul) return false; + + // If there is a constant factor, it will be first. + SCEVConstant *SC = dyn_cast(Mul->getOperand(0)); + if (!SC) return false; + + // Return true if the value is negative, this matches things like (-42 * V). + return SC->getValue()->getValue().isNegative(); +} + /// StrengthReduceStridedIVUsers - Strength reduce all of the users of a single /// stride of IV. All of the users may have different starting values, and this /// may not be the only stride (we know it is if isOnlyStride is true). @@ -1104,15 +1118,24 @@ // Add common base to the new Phi node. NewPHI->addIncoming(CommonBaseV, Preheader); +// If the stride is negative, insert a sub instead of an add for the +// increment. +bool isNegative = isNonConstantNegative(Stride); +SCEVHandle IncAmount = Stride; +if (isNegative) + IncAmount = SCEV::getNegativeSCEV(Stride); + // Insert the stride into the preheader. -Value *StrideV = PreheaderRewriter.expandCodeFor(Stride, PreInsertPt, +Value *StrideV = PreheaderRewriter.expandCodeFor(IncAmount, PreInsertPt, ReplacedTy); if (!isa(StrideV)) ++NumVariable; // Emit the increment of the base value before the terminator of the loop // latch block, and add it to the Phi node. -SCEVHandle IncExp = SCEVAddExpr::get(SCEVUnknown::get(NewPHI), - SCEVUnknown::get(StrideV)); +SCEVHandle IncExp = SCEVUnknown::get(StrideV); +if (isNegative) + IncExp = SCEV::getNegativeSCEV(IncExp); +IncExp = SCEVAddExpr::get(SCEVUnknown::get(NewPHI), IncExp); IncV = Rewriter.expandCodeFor(IncExp, LatchBlock->getTerminator(), ReplacedTy); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/CodeGen/X86/lsr-negative-stride.ll
Changes in directory llvm/test/CodeGen/X86: lsr-negative-stride.ll updated: 1.1 -> 1.2 --- Log message: add source --- Diffs of the changes: (+12 -0) lsr-negative-stride.ll | 12 1 files changed, 12 insertions(+) Index: llvm/test/CodeGen/X86/lsr-negative-stride.ll diff -u llvm/test/CodeGen/X86/lsr-negative-stride.ll:1.1 llvm/test/CodeGen/X86/lsr-negative-stride.ll:1.2 --- llvm/test/CodeGen/X86/lsr-negative-stride.ll:1.1Fri May 18 20:21:39 2007 +++ llvm/test/CodeGen/X86/lsr-negative-stride.llFri May 18 20:22:52 2007 @@ -2,6 +2,18 @@ ; RUN: llvm-as < %s | llc -march=x86 | not grep sub.*esp ; RUN: llvm-as < %s | llc -march=x86 | not grep esi +; This corresponds to: +;int t(int a, int b) { +; while (a != b) { +;if (a > b) +; a -= b; +;else +; b -= a; +; } +; return a; +;} + + define i32 @t(i32 %a, i32 %b) { entry: %tmp1434 = icmp eq i32 %a, %b ; [#uses=1] ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
Changes in directory llvm/lib/ExecutionEngine/Interpreter: ExternalFunctions.cpp updated: 1.98 -> 1.99 --- Log message: On Linux platforms and at optimization levels -O1 and above, llvm-gcc can turn "putchar" calls into _IO_putc calls which is a lower-level interface. This patch allows these calls to be executed by lli in interpreter mode. --- Diffs of the changes: (+14 -3) ExternalFunctions.cpp | 17 ++--- 1 files changed, 14 insertions(+), 3 deletions(-) Index: llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.98 llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.99 --- llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.98 Sat Apr 21 12:11:45 2007 +++ llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp Fri May 18 20:36:17 2007 @@ -72,13 +72,13 @@ ExFunc FnPtr = FuncNames[ExtName]; if (FnPtr == 0) -FnPtr = - (ExFunc)(intptr_t)sys::DynamicLibrary::SearchForAddressOfSymbol(ExtName); - if (FnPtr == 0) FnPtr = FuncNames["lle_X_"+F->getName()]; if (FnPtr == 0) // Try calling a generic function... if it exists... FnPtr = (ExFunc)(intptr_t)sys::DynamicLibrary::SearchForAddressOfSymbol( ("lle_X_"+F->getName()).c_str()); + if (FnPtr == 0) +FnPtr = (ExFunc)(intptr_t) + sys::DynamicLibrary::SearchForAddressOfSymbol(F->getName()); if (FnPtr != 0) Functions.insert(std::make_pair(F, FnPtr)); // Cache for later return FnPtr; @@ -118,6 +118,16 @@ return Args[0]; } +// void _IO_putc(int c, FILE* fp) +GenericValue lle_X__IO_putc(FunctionType *FT, const vector &Args){ +#ifdef __linux__ + _IO_putc((char)Args[0].IntVal.getZExtValue(), (FILE*) Args[1].PointerVal); +#else + assert(0 && "Can't call _IO_putc on this platform"); +#endif + return Args[0]; +} + // void atexit(Function*) GenericValue lle_X_atexit(FunctionType *FT, const vector &Args) { assert(Args.size() == 1); @@ -694,6 +704,7 @@ void Interpreter::initializeExternalFunctions() { FuncNames["lle_X_putchar"] = lle_X_putchar; + FuncNames["lle_X__IO_putc"] = lle_X__IO_putc; FuncNames["lle_X_exit"] = lle_X_exit; FuncNames["lle_X_abort"]= lle_X_abort; FuncNames["lle_X_malloc"] = lle_X_malloc; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll
Changes in directory llvm/test/Transforms/InstCombine: 2007-05-18-CastFoldBug.ll added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+10 -0) 2007-05-18-CastFoldBug.ll | 10 ++ 1 files changed, 10 insertions(+) Index: llvm/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll diff -c /dev/null llvm/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll:1.1 *** /dev/null Sat May 19 01:50:47 2007 --- llvm/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll Sat May 19 01:50:37 2007 *** *** 0 --- 1,10 + ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {call.*sret} + ; Make sure instcombine doesn't drop the sret attribute. + + define void @blah(i16* %tmp10) { + entry: + call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend_stret to void (i16* sret )*)( i16* %tmp10 sret ) + ret void + } + + declare i8* @objc_msgSend_stret(i8*, i8*, ...) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.766 -> 1.767 --- Log message: Fix Transforms/InstCombine/2007-05-18-CastFoldBug.ll, a bug that devastates objc code due to the way the FE lowers objc message sends. --- Diffs of the changes: (+8 -0) InstructionCombining.cpp |8 1 files changed, 8 insertions(+) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.766 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.767 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.766 Mon May 14 19:16:00 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sat May 19 01:51:32 2007 @@ -7773,6 +7773,14 @@ const FunctionType *FT = Callee->getFunctionType(); const Type *OldRetTy = Caller->getType(); + const FunctionType *ActualFT = +cast(cast(CE->getType())->getElementType()); + + // If the parameter attributes don't match up, don't do the xform. We don't + // want to lose an sret attribute or something. + if (FT->getParamAttrs() != ActualFT->getParamAttrs()) +return false; + // Check to see if we are changing the return type... if (OldRetTy != FT->getReturnType()) { if (Callee->isDeclaration() && !Caller->use_empty() && ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits