Re: [llvm-commits] CVS: llvm/autoconf/configure.ac
On Wed, 2006-02-15 at 18:42 +1100, [EMAIL PROTECTED] wrote: > > On Tue, 14 Feb 2006, Reid Spencer wrote: > >> Rather than just kill this checking, I would prefer it if the aCC > >> compiler was added to the check for supported compilers. This > >> configuration check (that you've deleted) can prevent really bad things > >> happening downstream. > > Not trying to be picky, but what kind of really bad things are we talking > about? The worst thing I can imagine is that a build fails because there's > some issue between the source/makefiles and the user's toolchain. configure by default depends on gcc options in order to test the capabilities of the system being configured. So, what will happen is that you'll most likely get a misconfiguration of the HPUX system (lots of missing capabilities) which could make it impossible to get LLVM working on that platform. Its possible to use another compiler for the configuration checks but not without a lot of setup that we don't have in the configure.ac script right now. > > > FWIW, I agree with reid. > > I did ask..! :) For now, I'll just revert it and add aCC-specific stuff > later Okay, but its going to require that you ensure the aCC compiler can be used for all the configuration tests. Please test this thoroughly before committing it again. In particular you need to make sure that the include/llvm/Config/config.h.in file is generated correctly for your HPUX system. > (the get-rid-of-hash-tables patch is still to come) do you mean the configure test for them? or, are you planning to rid LLVM of hashtables altogether? If the latter, I suggest we talk a bit about this because hashtables are the right choice in a few places. > but the > intention was that with a little bit of work LLVM could be made and kept > standard-compliant and so "any good compiler" should work, in theory. Theory is one thing, practice is another. While its *possible* to configure for a non-GCC compliant compiler, its not easy. You need to understand how autoconf works to do that. > Should we insist on known-good compilers, yes. > abort on known-bad compilers, yes, but lets just say "non-known-good-compilers" > spit out scary warning messages, warnings should only be done if there's a hope of the configuration and compilation being done correctly. If not, the correct thing to do is stop with a hard error. Its better the user understand the problem early rather than later. > or something else again? I'm open to ideas. > Anyway, for now I'll just revert this. Sorry guys! :) Thanks. Reid signature.asc Description: This is a digitally signed message part ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-poolalloc/Regressions/
Changes in directory llvm-poolalloc/Regressions: --- Log message: Directory /home/vadve/shared/PublicCVS/llvm-poolalloc/Regressions added to the repository --- Diffs of the changes: (+0 -0) 0 files changed ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-poolalloc/Regressions/2006-02-13.ArrayOfObjects.ll
Changes in directory llvm-poolalloc/Regressions: 2006-02-13.ArrayOfObjects.ll added (r1.1) --- Log message: An error reduced from Shootout/lists. Patch exists. --- Diffs of the changes: (+0 -0) 0 files changed ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/DebugStuff.ll
Changes in directory llvm/test/Regression/CodeGen/Generic: DebugStuff.ll updated: 1.3 -> 1.4 --- Log message: Code sufficiently protected against this test. --- Diffs of the changes: (+0 -1) DebugStuff.ll |1 - 1 files changed, 1 deletion(-) Index: llvm/test/Regression/CodeGen/Generic/DebugStuff.ll diff -u llvm/test/Regression/CodeGen/Generic/DebugStuff.ll:1.3 llvm/test/Regression/CodeGen/Generic/DebugStuff.ll:1.4 --- llvm/test/Regression/CodeGen/Generic/DebugStuff.ll:1.3 Thu Feb 9 01:12:13 2006 +++ llvm/test/Regression/CodeGen/Generic/DebugStuff.ll Wed Feb 15 11:20:59 2006 @@ -1,6 +1,5 @@ ; Verify debugger intrinsics are ignored or accepted. ; RUN: llvm-as < %s | llc -; XFAIL: powerpc ;; Debugger type declarations %lldb.compile_unit = type { uint, ushort, ushort, sbyte*, sbyte*, sbyte*, {}* } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-poolalloc/Regressions/2006-02-13.ArrayOfObjects.ll
Changes in directory llvm-poolalloc/Regressions: 2006-02-13.ArrayOfObjects.ll updated: 1.1 -> 1.2 --- Log message: note this is pointer compression --- Diffs of the changes: (+0 -0) 0 files changed ___ 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/LoopUnswitch.cpp
Changes in directory llvm/lib/Transforms/Scalar: LoopUnswitch.cpp updated: 1.20 -> 1.21 --- Log message: Checking the wrong value. This caused us to emit silly code like Y = seteq bool X, true instead of just using X :) --- Diffs of the changes: (+1 -1) LoopUnswitch.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.20 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.21 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.20Tue Feb 14 19:44:42 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Wed Feb 15 13:05:52 2006 @@ -442,7 +442,7 @@ // Insert a conditional branch on LIC to the two preheaders. The original // code is the true version and the new code is the false version. Value *BranchVal = LIC; - if (!isa(BranchVal)) { + if (!isa(Val)) { BranchVal = BinaryOperator::createSetEQ(LIC, Val, "tmp", InsertPt); } else if (Val != ConstantBool::True) { // We want to enter the new loop when the condition is true. ___ 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/DAGCombiner.cpp LegalizeDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.100 -> 1.101 LegalizeDAG.cpp updated: 1.303 -> 1.304 --- Log message: Should not combine ISD::LOCATIONs until we have scheme to remove from MachineDebugInfo tables. --- Diffs of the changes: (+2 -36) DAGCombiner.cpp | 34 -- LegalizeDAG.cpp |4 ++-- 2 files changed, 2 insertions(+), 36 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.100 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.101 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.100 Tue Feb 7 20:13:15 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Feb 15 13:34:44 2006 @@ -175,9 +175,6 @@ SDOperand visitLOAD(SDNode *N); SDOperand visitSTORE(SDNode *N); -SDOperand visitLOCATION(SDNode *N); -SDOperand visitDEBUGLOC(SDNode *N); - SDOperand ReassociateOps(unsigned Opc, SDOperand LHS, SDOperand RHS); bool SimplifySelectOps(SDNode *SELECT, SDOperand LHS, SDOperand RHS); @@ -568,8 +565,6 @@ case ISD::BRTWOWAY_CC:return visitBRTWOWAY_CC(N); case ISD::LOAD: return visitLOAD(N); case ISD::STORE: return visitSTORE(N); - case ISD::LOCATION: return visitLOCATION(N); - case ISD::DEBUG_LOC: return visitDEBUGLOC(N); } return SDOperand(); } @@ -2162,35 +2157,6 @@ return SDOperand(); } -SDOperand DAGCombiner::visitLOCATION(SDNode *N) { - SDOperand Chain= N->getOperand(0); - - // Remove redundant locations (last one holds) - if (Chain.getOpcode() == ISD::LOCATION && Chain.hasOneUse()) { -return DAG.getNode(ISD::LOCATION, MVT::Other, Chain.getOperand(0), - N->getOperand(1), - N->getOperand(2), - N->getOperand(3), - N->getOperand(4)); - } - - return SDOperand(); -} - -SDOperand DAGCombiner::visitDEBUGLOC(SDNode *N) { - SDOperand Chain= N->getOperand(0); - - // Remove redundant debug locations (last one holds) - if (Chain.getOpcode() == ISD::DEBUG_LOC && Chain.hasOneUse()) { -return DAG.getNode(ISD::DEBUG_LOC, MVT::Other, Chain.getOperand(0), - N->getOperand(1), - N->getOperand(2), - N->getOperand(3)); - } - - return SDOperand(); -} - SDOperand DAGCombiner::SimplifySelect(SDOperand N0, SDOperand N1, SDOperand N2){ assert(N0.getOpcode() ==ISD::SETCC && "First argument must be a SetCC node!"); Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.303 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.304 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.303 Mon Feb 13 18:55:02 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Feb 15 13:34:44 2006 @@ -519,8 +519,8 @@ Ops.push_back(DAG.getConstant(SrcFile, MVT::i32)); // source file id Result = DAG.getNode(ISD::DEBUG_LOC, MVT::Other, Ops); } else { - unsigned Line = dyn_cast(LineOp)->getValue(); - unsigned Col = dyn_cast(ColOp)->getValue(); + unsigned Line = cast(LineOp)->getValue(); + unsigned Col = cast(ColOp)->getValue(); unsigned ID = DebugInfo->RecordLabel(Line, Col, SrcFile); Ops.push_back(DAG.getConstant(ID, MVT::i32)); Result = DAG.getNode(ISD::DEBUG_LABEL, MVT::Other, Ops); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/README.txt
Changes in directory llvm/lib/Target: README.txt updated: 1.5 -> 1.6 --- Log message: new test --- Diffs of the changes: (+12 -0) README.txt | 12 1 files changed, 12 insertions(+) Index: llvm/lib/Target/README.txt diff -u llvm/lib/Target/README.txt:1.5 llvm/lib/Target/README.txt:1.6 --- llvm/lib/Target/README.txt:1.5 Sun Feb 5 02:26:16 2006 +++ llvm/lib/Target/README.txt Wed Feb 15 13:52:06 2006 @@ -64,3 +64,15 @@ //===-===// +DAG combine this into mul A, 8: + +int %test(int %A) { + %B = mul int %A, 8 ;; shift + %C = add int %B, 7 ;; dead, no demanded bits. + %D = and int %C, -8 ;; dead once add is gone. + ret int %D +} + +This sort of thing occurs in the alloca lowering code and other places that +are generating alignment of an already aligned value. + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
Changes in directory llvm/lib/Transforms/IPO: SimplifyLibCalls.cpp updated: 1.61 -> 1.62 --- Log message: fix a bunch of alpha regressions. see bug 709: http://llvm.cs.uiuc.edu/PR709 --- Diffs of the changes: (+6 -6) SimplifyLibCalls.cpp | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.61 llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.62 --- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.61 Mon Jan 23 00:24:46 2006 +++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cppWed Feb 15 15:13:37 2006 @@ -284,7 +284,7 @@ if (!memcpy_func) { const Type *SBP = PointerType::get(Type::SByteTy); memcpy_func = M->getOrInsertFunction("llvm.memcpy", Type::VoidTy,SBP, SBP, - Type::UIntTy, Type::UIntTy, NULL); + TD->getIntPtrType(), Type::UIntTy, NULL); } return memcpy_func; } @@ -483,7 +483,7 @@ std::vector vals; vals.push_back(gep); // destination vals.push_back(ci->getOperand(2)); // source -vals.push_back(ConstantUInt::get(Type::UIntTy,len)); // length +vals.push_back(ConstantUInt::get(SLC.getIntPtrType(),len)); // length vals.push_back(ConstantUInt::get(Type::UIntTy,1)); // alignment new CallInst(SLC.get_memcpy(), vals, "", ci); @@ -812,7 +812,7 @@ std::vector vals; vals.push_back(dest); // destination vals.push_back(src); // source -vals.push_back(ConstantUInt::get(Type::UIntTy,len)); // length +vals.push_back(ConstantUInt::get(SLC.getIntPtrType(),len)); // length vals.push_back(ConstantUInt::get(Type::UIntTy,1)); // alignment new CallInst(SLC.get_memcpy(), vals, "", ci); @@ -1444,7 +1444,7 @@ std::vector args; args.push_back(ci->getOperand(1)); args.push_back(ci->getOperand(2)); - args.push_back(ConstantUInt::get(Type::UIntTy,len)); + args.push_back(ConstantUInt::get(SLC.getIntPtrType(),len)); args.push_back(ConstantUInt::get(Type::UIntTy,1)); new CallInst(memcpy_func,args,"",ci); ci->replaceAllUsesWith(ConstantSInt::get(Type::IntTy,len)); @@ -1477,8 +1477,8 @@ Value *Len1 = BinaryOperator::createAdd(Len, ConstantInt::get(Len->getType(), 1), Len->getName()+"1", ci); - if (Len1->getType() != Type::UIntTy) -Len1 = new CastInst(Len1, Type::UIntTy, Len1->getName(), ci); + if (Len1->getType() != SLC.getIntPtrType()) +Len1 = new CastInst(Len1, SLC.getIntPtrType(), Len1->getName(), ci); std::vector args; args.push_back(CastToCStr(ci->getOperand(1), *ci)); args.push_back(CastToCStr(ci->getOperand(3), *ci)); ___ 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/SelectionDAGISel.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.160 -> 1.161 --- Log message: Turn a memcpy from string constant into a series of stores of constant values. --- Diffs of the changes: (+69 -47) SelectionDAGISel.cpp | 116 ++- 1 files changed, 69 insertions(+), 47 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.160 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.161 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.160Tue Feb 14 19:54:51 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Feb 15 15:59:04 2006 @@ -807,36 +807,15 @@ /// getStringValue - Turn an LLVM constant pointer that eventually points to a /// global into a string value. Return an empty string if we can't do it. /// -static std::string getStringValue(Value *V, unsigned Offset = 0) { - if (GlobalVariable *GV = dyn_cast(V)) { -if (GV->hasInitializer() && isa(GV->getInitializer())) { - ConstantArray *Init = cast(GV->getInitializer()); - if (Init->isString()) { -std::string Result = Init->getAsString(); -if (Offset < Result.size()) { - // If we are pointing INTO The string, erase the beginning... - Result.erase(Result.begin(), Result.begin()+Offset); - - // Take off the null terminator, and any string fragments after it. - std::string::size_type NullPos = Result.find_first_of((char)0); - if (NullPos != std::string::npos) -Result.erase(Result.begin()+NullPos, Result.end()); - return Result; -} - } -} - } else if (Constant *C = dyn_cast(V)) { -if (GlobalValue *GV = dyn_cast(C)) - return getStringValue(GV, Offset); -else if (ConstantExpr *CE = dyn_cast(C)) { - if (CE->getOpcode() == Instruction::GetElementPtr) { -// Turn a gep into the specified offset. -if (CE->getNumOperands() == 3 && -cast(CE->getOperand(1))->isNullValue() && -isa(CE->getOperand(2))) { - return getStringValue(CE->getOperand(0), - Offset+cast(CE->getOperand(2))->getRawValue()); -} +static std::string getStringValue(GlobalVariable *GV, unsigned Offset = 0) { + if (GV->hasInitializer() && isa(GV->getInitializer())) { +ConstantArray *Init = cast(GV->getInitializer()); +if (Init->isString()) { + std::string Result = Init->getAsString(); + if (Offset < Result.size()) { +// If we are pointing INTO The string, erase the beginning... +Result.erase(Result.begin(), Result.begin()+Offset); +return Result; } } } @@ -1523,13 +1502,10 @@ DAG.setRoot(Result.second); } -/// getMemSetValue - Vectorized representation of the memset value +/// getMemsetValue - Vectorized representation of the memset value /// operand. static SDOperand getMemsetValue(SDOperand Value, MVT::ValueType VT, -SelectionDAG &DAG) { - if (VT == MVT::i8) -return Value; - +SelectionDAG &DAG, TargetLowering &TLI) { MVT::ValueType CurVT = VT; if (ConstantSDNode *C = dyn_cast(Value)) { uint64_t Val = C->getValue() & 255; @@ -1556,6 +1532,24 @@ } } +/// getMemsetStringVal - Similar to getMemsetValue. Except this is only +/// used when a memcpy is turned into a memset when the source is a constant +/// string ptr. +static SDOperand getMemsetStringVal(MVT::ValueType VT, +SelectionDAG &DAG, TargetLowering &TLI, +std::string &Str, unsigned Offset) { + MVT::ValueType CurVT = VT; + uint64_t Val = 0; + unsigned MSB = getSizeInBits(VT) / 8; + if (TLI.isLittleEndian()) +Offset = Offset + MSB - 1; + for (unsigned i = 0; i != MSB; ++i) { +Val = (Val << 8) | Str[Offset]; +Offset += TLI.isLittleEndian() ? -1 : 1; + } + return DAG.getConstant(Val, VT); +} + /// getMemBasePlusOffset - Returns base and offset node for the static SDOperand getMemBasePlusOffset(SDOperand Base, unsigned Offset, SelectionDAG &DAG, TargetLowering &TLI) { @@ -1640,7 +1634,7 @@ for (unsigned i = 0; i < NumMemOps; i++) { MVT::ValueType VT = MemOps[i]; unsigned VTSize = getSizeInBits(VT) / 8; - SDOperand Value = getMemsetValue(Op2, VT, DAG); + SDOperand Value = getMemsetValue(Op2, VT, DAG, TLI); SDOperand Store = DAG.getNode(ISD::STORE, MVT::Other, getRoot(), Value, getMemBasePlusOffset(Op1, Offset, DAG, TLI), @@ -1655,21 +1649,49 @@ if (MeetsMaxMemopRequirement(MemOps, TLI.getMaxStoresPerMemcpy(), Size->getValue(), Align, TLI)) { unsigned NumMemOps = MemOps.size(); -unsigne
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
Changes in directory llvm/lib/Transforms/Scalar: LoopUnswitch.cpp updated: 1.21 -> 1.22 --- Log message: make "trivial" unswitching significantly more general. It can now handle this for example: for (j = 0; j < N; ++j) { // trivial unswitch if (C) P[i+j] = 0; } turning it into the obvious code without bothering to duplicate an empty loop. --- Diffs of the changes: (+79 -47) LoopUnswitch.cpp | 126 ++- 1 files changed, 79 insertions(+), 47 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.21 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.22 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.21Wed Feb 15 13:05:52 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Wed Feb 15 16:03:36 2006 @@ -75,6 +75,7 @@ void VersionLoop(Value *LIC, Constant *OnVal, Loop *L, Loop *&Out1, Loop *&Out2); BasicBlock *SplitEdge(BasicBlock *From, BasicBlock *To); +BasicBlock *SplitBlock(BasicBlock *Old, Instruction *SplitPt); void RewriteLoopBodyWithConditionConstant(Loop *L, Value *LIC,Constant *Val, bool isEqual); void UnswitchTrivialCondition(Loop *L, Value *Cond, Constant *Val, @@ -123,26 +124,50 @@ return false; } -/// FindTrivialLoopExitBlock - We know that we have a branch from the loop -/// header to the specified latch block. See if one of the successors of the -/// latch block is an exit, and if so what block it is. -static BasicBlock *FindTrivialLoopExitBlock(Loop *L, BasicBlock *Latch) { +/// isTrivialLoopExitBlock - Check to see if all paths from BB either: +/// 1. Exit the loop with no side effects. +/// 2. Branch to the latch block with no side-effects. +/// +/// If these conditions are true, we return true and set ExitBB to the block we +/// exit through. +/// +static bool isTrivialLoopExitBlockHelper(Loop *L, BasicBlock *BB, + BasicBlock *&ExitBB, + std::set &Visited) { BasicBlock *Header = L->getHeader(); - BranchInst *LatchBranch = dyn_cast(Latch->getTerminator()); - if (!LatchBranch || !LatchBranch->isConditional()) return 0; - - // Simple case, the latch block is a conditional branch. The target that - // doesn't go to the loop header is our block if it is not in the loop. - if (LatchBranch->getSuccessor(0) == Header) { -if (L->contains(LatchBranch->getSuccessor(1))) return false; -return LatchBranch->getSuccessor(1); - } else { -assert(LatchBranch->getSuccessor(1) == Header); -if (L->contains(LatchBranch->getSuccessor(0))) return false; -return LatchBranch->getSuccessor(0); + for (succ_iterator SI = succ_begin(BB), E = succ_end(BB); SI != E; ++SI) { +if (!Visited.insert(*SI).second) { + // Already visited and Ok, end of recursion. +} else if (L->contains(*SI)) { + // Check to see if the successor is a trivial loop exit. + if (!isTrivialLoopExitBlockHelper(L, *SI, ExitBB, Visited)) +return false; +} else { + // Otherwise, this is a loop exit, this is fine so long as this is the + // first exit. + if (ExitBB != 0) return false; + ExitBB = *SI; +} } + + // Okay, everything after this looks good, check to make sure that this block + // doesn't include any side effects. + for (BasicBlock::iterator I = Header->begin(), E = Header->end(); I != E; ++I) +if (I->mayWriteToMemory()) + return false; + + return true; } +static BasicBlock *isTrivialLoopExitBlock(Loop *L, BasicBlock *BB) { + std::set Visited; + Visited.insert(L->getHeader()); // Branches to header are ok. + Visited.insert(BB); // Don't revisit BB after we do. + BasicBlock *ExitBB = 0; + if (isTrivialLoopExitBlockHelper(L, BB, ExitBB, Visited)) +return ExitBB; + return 0; +} /// IsTrivialUnswitchCondition - Check to see if this unswitch condition is /// trivial: that is, that the condition controls whether or not the loop does @@ -165,33 +190,30 @@ HeaderTerm->getCondition() != Cond) return false; - // Check to see if the conditional branch goes to the latch block. If not, - // it's not trivial. This also determines the value of Cond that will execute - // the loop. - BasicBlock *Latch = L->getLoopLatch(); - if (HeaderTerm->getSuccessor(1) == Latch) { + // Check to see if a successor of the branch is guaranteed to go to the latch + // block or exit through a one exit block without having any side-effects. If + // so, determine the value of Cond that causes it to do this. + BasicBlock *LoopExitBlock = 0; + if ((LoopExitBlock = isTrivialLoopExitBlock(L, HeaderTerm->getSuccessor(0{ if (Val) *Val = ConstantBool::True; - } else if (HeaderTerm->getSuccessor(0) == Latch) + } else if ((LoopExitBlock = + isTrivialLoopExitBlock(
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.161 -> 1.162 --- Log message: Remove an unused function parameter. --- Diffs of the changes: (+2 -2) SelectionDAGISel.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.161 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.162 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.161Wed Feb 15 15:59:04 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Feb 15 16:12:35 2006 @@ -1505,7 +1505,7 @@ /// getMemsetValue - Vectorized representation of the memset value /// operand. static SDOperand getMemsetValue(SDOperand Value, MVT::ValueType VT, -SelectionDAG &DAG, TargetLowering &TLI) { +SelectionDAG &DAG) { MVT::ValueType CurVT = VT; if (ConstantSDNode *C = dyn_cast(Value)) { uint64_t Val = C->getValue() & 255; @@ -1634,7 +1634,7 @@ for (unsigned i = 0; i < NumMemOps; i++) { MVT::ValueType VT = MemOps[i]; unsigned VTSize = getSizeInBits(VT) / 8; - SDOperand Value = getMemsetValue(Op2, VT, DAG, TLI); + SDOperand Value = getMemsetValue(Op2, VT, DAG); SDOperand Store = DAG.getNode(ISD::STORE, MVT::Other, getRoot(), Value, getMemBasePlusOffset(Op1, Offset, DAG, TLI), ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/README.txt
Changes in directory llvm/lib/Target: README.txt updated: 1.6 -> 1.7 --- Log message: Remove an entry. --- Diffs of the changes: (+0 -8) README.txt |8 1 files changed, 8 deletions(-) Index: llvm/lib/Target/README.txt diff -u llvm/lib/Target/README.txt:1.6 llvm/lib/Target/README.txt:1.7 --- llvm/lib/Target/README.txt:1.6 Wed Feb 15 13:52:06 2006 +++ llvm/lib/Target/README.txt Wed Feb 15 16:14:34 2006 @@ -22,14 +22,6 @@ Get the C front-end to expand hypot(x,y) -> llvm.sqrt(x*x+y*y) when errno and precision don't matter (ffastmath). Misc/mandel will like this. :) -===-=== - -For all targets, not just X86: -When llvm.memcpy, llvm.memset, or llvm.memmove are lowered, they should be -optimized to a few store instructions if the source is constant and the length -is smallish (< 8). This will greatly help some tests like Shootout/strcat.c -and fldry. - //===-===// Solve this DAG isel folding deficiency: ___ 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/LoopUnswitch.cpp
Changes in directory llvm/lib/Transforms/Scalar: LoopUnswitch.cpp updated: 1.22 -> 1.23 --- Log message: Implement trivial unswitching for switch stmts. This allows us to trivial unswitch this loop on 2 before sweating to unswitch on 1/3. void test4(int N, int i, int C, int*P, int*Q) { int j; for (j = 0; j < N; ++j) { switch (C) {// general unswitching. default: P[i+j] = 0; break; case 1: Q[i+j] = 0; break; case 3: P[i+j] = Q[i+j]; break; case 2: break; // TRIVIAL UNSWITCH on C==2 } } } --- Diffs of the changes: (+51 -27) LoopUnswitch.cpp | 78 +++ 1 files changed, 51 insertions(+), 27 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.22 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.23 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.22Wed Feb 15 16:03:36 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Wed Feb 15 16:52:05 2006 @@ -79,7 +79,7 @@ void RewriteLoopBodyWithConditionConstant(Loop *L, Value *LIC,Constant *Val, bool isEqual); void UnswitchTrivialCondition(Loop *L, Value *Cond, Constant *Val, - BasicBlock *ExitBlock); + bool EntersWhenTrue, BasicBlock *ExitBlock); }; RegisterOpt X("loop-unswitch", "Unswitch loops"); } @@ -152,7 +152,7 @@ // Okay, everything after this looks good, check to make sure that this block // doesn't include any side effects. - for (BasicBlock::iterator I = Header->begin(), E = Header->end(); I != E; ++I) + for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) if (I->mayWriteToMemory()) return false; @@ -180,31 +180,48 @@ /// condition is false. Otherwise, return null to indicate a complex condition. static bool IsTrivialUnswitchCondition(Loop *L, Value *Cond, Constant **Val = 0, + bool *EntersWhenTrue = 0, BasicBlock **LoopExit = 0) { BasicBlock *Header = L->getHeader(); - BranchInst *HeaderTerm = dyn_cast(Header->getTerminator()); - - // If the header block doesn't end with a conditional branch on Cond, we can't - // handle it. - if (!HeaderTerm || !HeaderTerm->isConditional() || - HeaderTerm->getCondition() != Cond) -return false; + TerminatorInst *HeaderTerm = Header->getTerminator(); + + BasicBlock *LoopExitBB = 0; + if (BranchInst *BI = dyn_cast(HeaderTerm)) { +// If the header block doesn't end with a conditional branch on Cond, we +// can't handle it. +if (!BI->isConditional() || BI->getCondition() != Cond) + return false; - // Check to see if a successor of the branch is guaranteed to go to the latch - // block or exit through a one exit block without having any side-effects. If - // so, determine the value of Cond that causes it to do this. - BasicBlock *LoopExitBlock = 0; - if ((LoopExitBlock = isTrivialLoopExitBlock(L, HeaderTerm->getSuccessor(0{ -if (Val) *Val = ConstantBool::True; - } else if ((LoopExitBlock = - isTrivialLoopExitBlock(L, HeaderTerm->getSuccessor(1 { -if (Val) *Val = ConstantBool::False; +// Check to see if a successor of the branch is guaranteed to go to the +// latch block or exit through a one exit block without having any +// side-effects. If so, determine the value of Cond that causes it to do +// this. +if ((LoopExitBB = isTrivialLoopExitBlock(L, BI->getSuccessor(0 { + if (Val) *Val = ConstantBool::True; +} else if ((LoopExitBB = isTrivialLoopExitBlock(L, BI->getSuccessor(1 { + if (Val) *Val = ConstantBool::False; +} + } else if (SwitchInst *SI = dyn_cast(HeaderTerm)) { +// If this isn't a switch on Cond, we can't handle it. +if (SI->getCondition() != Cond) return false; + +// Check to see if a successor of the switch is guaranteed to go to the +// latch block or exit through a one exit block without having any +// side-effects. If so, determine the value of Cond that causes it to do +// this. Note that we can't trivially unswitch on the default case. +for (unsigned i = 1, e = SI->getNumSuccessors(); i != e; ++i) + if ((LoopExitBB = isTrivialLoopExitBlock(L, SI->getSuccessor(i { +// Okay, we found a trivial case, remember the value that is trivial. +if (Val) *Val = SI->getCaseValue(i); +if (EntersWhenTrue) *EntersWhenTrue = false; +break; + } } - if (!LoopExitBlock) + if (!LoopExitBB) return false; // Can't handle this. - if (LoopExit) *LoopExit = LoopExitBlock; + if (LoopExit) *LoopExit = LoopExitBB; // We already know that nothing uses any scalar values defined inside of this // loop. As such, we jus
[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp X86Subtarget.cpp X86Subtarget.h
Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.82 -> 1.83 X86Subtarget.cpp updated: 1.24 -> 1.25 X86Subtarget.h updated: 1.10 -> 1.11 --- Log message: A bit more memset / memcpy optimization. Turns them into calls to memset / memcpy if 1) buffer(s) are not DWORD aligned, 2) size is not known to be greater or equal to some minimum value (currently 128). --- Diffs of the changes: (+53 -7) X86ISelLowering.cpp | 49 ++--- X86Subtarget.cpp|2 ++ X86Subtarget.h |9 + 3 files changed, 53 insertions(+), 7 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.82 llvm/lib/Target/X86/X86ISelLowering.cpp:1.83 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.82Tue Feb 14 02:38:30 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Wed Feb 15 18:21:07 2006 @@ -1772,6 +1772,25 @@ (unsigned)cast(Op.getOperand(4))->getValue(); if (Align == 0) Align = 1; +ConstantSDNode *I = dyn_cast(Op.getOperand(3)); +// If not DWORD aligned, call memset if size is less than the threshold. +// It knows how to align to the right boundary first. +if ((Align & 3) != 0 && +!(I && I->getValue() >= Subtarget->getMinRepStrSizeThreshold())) { + MVT::ValueType IntPtr = getPointerTy(); + const Type *IntPtrTy = getTargetData().getIntPtrType(); + std::vector > Args; + Args.push_back(std::make_pair(Op.getOperand(1), IntPtrTy)); + // Extend the ubyte argument to be an int value for the call. + SDOperand Val = DAG.getNode(ISD::ZERO_EXTEND, MVT::i32, Op.getOperand(2)); + Args.push_back(std::make_pair(Val, IntPtrTy)); + Args.push_back(std::make_pair(Op.getOperand(3), IntPtrTy)); + std::pair CallResult = +LowerCallTo(Chain, Type::VoidTy, false, CallingConv::C, false, +DAG.getExternalSymbol("memset", IntPtr), Args, DAG); + return CallResult.second; +} + MVT::ValueType AVT; SDOperand Count; if (ConstantSDNode *ValC = dyn_cast(Op.getOperand(2))) { @@ -1782,7 +1801,7 @@ switch (Align & 3) { case 2: // WORD aligned AVT = MVT::i16; -if (ConstantSDNode *I = dyn_cast(Op.getOperand(3))) +if (I) Count = DAG.getConstant(I->getValue() / 2, MVT::i32); else Count = DAG.getNode(ISD::SRL, MVT::i32, Op.getOperand(3), @@ -1792,7 +1811,7 @@ break; case 0: // DWORD aligned AVT = MVT::i32; -if (ConstantSDNode *I = dyn_cast(Op.getOperand(3))) +if (I) Count = DAG.getConstant(I->getValue() / 4, MVT::i32); else Count = DAG.getNode(ISD::SRL, MVT::i32, Op.getOperand(3), @@ -1812,7 +1831,7 @@ InFlag); InFlag = Chain.getValue(1); } else { - AVT= MVT::i8; + AVT = MVT::i8; Count = Op.getOperand(3); Chain = DAG.getCopyToReg(Chain, X86::AL, Op.getOperand(2), InFlag); InFlag = Chain.getValue(1); @@ -1832,20 +1851,36 @@ (unsigned)cast(Op.getOperand(4))->getValue(); if (Align == 0) Align = 1; +ConstantSDNode *I = dyn_cast(Op.getOperand(3)); +// If not DWORD aligned, call memcpy if size is less than the threshold. +// It knows how to align to the right boundary first. +if ((Align & 3) != 0 && +!(I && I->getValue() >= Subtarget->getMinRepStrSizeThreshold())) { + MVT::ValueType IntPtr = getPointerTy(); + const Type *IntPtrTy = getTargetData().getIntPtrType(); + std::vector > Args; + Args.push_back(std::make_pair(Op.getOperand(1), IntPtrTy)); + Args.push_back(std::make_pair(Op.getOperand(2), IntPtrTy)); + Args.push_back(std::make_pair(Op.getOperand(3), IntPtrTy)); + std::pair CallResult = +LowerCallTo(Chain, Type::VoidTy, false, CallingConv::C, false, +DAG.getExternalSymbol("memcpy", IntPtr), Args, DAG); + return CallResult.second; +} + MVT::ValueType AVT; SDOperand Count; switch (Align & 3) { case 2: // WORD aligned AVT = MVT::i16; - if (ConstantSDNode *I = dyn_cast(Op.getOperand(3))) + if (I) Count = DAG.getConstant(I->getValue() / 2, MVT::i32); else -Count = DAG.getNode(ISD::SRL, MVT::i32, Op.getOperand(3), -DAG.getConstant(1, MVT::i8)); +Count = DAG.getConstant(I->getValue() / 2, MVT::i32); break; case 0: // DWORD aligned AVT = MVT::i32; - if (ConstantSDNode *I = dyn_cast(Op.getOperand(3))) + if (I) Count = DAG.getConstant(I->getValue() / 4, MVT::i32); else Count = DAG.getNode(ISD::SRL, MVT::i32, Op.getOperand(3), Index: llvm/lib/Target/X86/X86Subtarget.cpp diff -u llvm/lib/Target/X86/X86Subtarget.cpp:1.24 llvm/lib/Target/X86/X86Subtarget.cpp:1.25 --- llvm/lib/Target/X86/X86Subtarget.cpp:1.24 Tue Feb
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
Changes in directory llvm/lib/Transforms/Scalar: LoopUnswitch.cpp updated: 1.23 -> 1.24 --- Log message: fix a bug where we unswitched the wrong way --- Diffs of the changes: (+2 -2) LoopUnswitch.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.23 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.24 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.23Wed Feb 15 16:52:05 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Wed Feb 15 19:24:41 2006 @@ -197,9 +197,9 @@ // side-effects. If so, determine the value of Cond that causes it to do // this. if ((LoopExitBB = isTrivialLoopExitBlock(L, BI->getSuccessor(0 { - if (Val) *Val = ConstantBool::True; -} else if ((LoopExitBB = isTrivialLoopExitBlock(L, BI->getSuccessor(1 { if (Val) *Val = ConstantBool::False; +} else if ((LoopExitBB = isTrivialLoopExitBlock(L, BI->getSuccessor(1 { + if (Val) *Val = ConstantBool::True; } } else if (SwitchInst *SI = dyn_cast(HeaderTerm)) { // If this isn't a switch on Cond, we can't handle it. ___ 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/X86RegisterInfo.cpp
Changes in directory llvm/lib/Target/X86: X86RegisterInfo.cpp updated: 1.121 -> 1.122 --- Log message: Use movaps / movapd (instead of movss / movsd) to do FR32 / FR64 reg to reg transfer. According to the Intel P4 Optimization Manual: Moves that write a portion of a register can introduce unwanted dependences. The movsd reg, reg instruction writes only the bottom 64 bits of a register, not to all 128 bits. This introduces a dependence on the preceding instruction that produces the upper 64 bits (even if those bits are not longer wanted). The dependence inhibits register renaming, and thereby reduces parallelism. Not to mention movaps is shorter than movss. --- Diffs of the changes: (+2 -2) X86RegisterInfo.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Target/X86/X86RegisterInfo.cpp diff -u llvm/lib/Target/X86/X86RegisterInfo.cpp:1.121 llvm/lib/Target/X86/X86RegisterInfo.cpp:1.122 --- llvm/lib/Target/X86/X86RegisterInfo.cpp:1.121 Fri Feb 3 12:20:04 2006 +++ llvm/lib/Target/X86/X86RegisterInfo.cpp Wed Feb 15 19:50:02 2006 @@ -106,9 +106,9 @@ } else if (RC == &X86::RFPRegClass || RC == &X86::RSTRegClass) { Opc = X86::FpMOV; } else if (RC == &X86::FR32RegClass || RC == &X86::V4F4RegClass) { -Opc = X86::MOVSSrr; +Opc = X86::MOVAPSrr; } else if (RC == &X86::FR64RegClass || RC == &X86::V2F8RegClass) { -Opc = X86::MOVSDrr; +Opc = X86::MOVAPDrr; } else { assert(0 && "Unknown regclass"); abort(); ___ 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/LoopUnswitch.cpp
Changes in directory llvm/lib/Transforms/Scalar: LoopUnswitch.cpp updated: 1.24 -> 1.25 --- Log message: Fix VC++ warning. --- Diffs of the changes: (+0 -1) LoopUnswitch.cpp |1 - 1 files changed, 1 deletion(-) Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.24 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.25 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.24Wed Feb 15 19:24:41 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Wed Feb 15 22:07:37 2006 @@ -426,7 +426,6 @@ // If the edge isn't critical, then BB has a single successor or Succ has a // single pred. Split the block. - BasicBlock *BlockToSplit; BasicBlock::iterator SplitPoint; if (BasicBlock *SP = Succ->getSinglePredecessor()) { // If the successor only has a single pred, split the top of the successor ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/win32/dobison.cmd
Changes in directory llvm/win32: dobison.cmd updated: 1.2 -> 1.3 --- Log message: Visual Studio enters the future of bisoning. --- Diffs of the changes: (+2 -2) dobison.cmd |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/win32/dobison.cmd diff -u llvm/win32/dobison.cmd:1.2 llvm/win32/dobison.cmd:1.3 --- llvm/win32/dobison.cmd:1.2 Wed Oct 26 20:10:37 2005 +++ llvm/win32/dobison.cmd Wed Feb 15 22:07:03 2006 @@ -17,6 +17,6 @@ :nobison echo Bison not found. Using pre-generated files. -copy %~pn4.cpp %3.cpp -copy %~pn4.h %3.h +copy %~pn4.cpp.cvs %3.cpp +copy %~pn4.h.cvs %3.h exit ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/Makefile.rules
Changes in directory llvm: Makefile.rules updated: 1.346 -> 1.347 --- Log message: Fix a minor makefile bug with lex/yacc handling that nate noticed. We don't want to copy the files when the .cpp file changes, we want to copy them to the .cvs versions when the .l/.y file change (like the comments even say). This avoids having bogus changes show up in diffs. --- Diffs of the changes: (+2 -2) Makefile.rules |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.346 llvm/Makefile.rules:1.347 --- llvm/Makefile.rules:1.346 Wed Feb 15 01:23:05 2006 +++ llvm/Makefile.rules Wed Feb 15 23:10:48 2006 @@ -1231,7 +1231,7 @@ # source location and building them. $(LexFiles:%.l=$(PROJ_SRC_DIR)/%.cpp.cvs): \ $(PROJ_SRC_DIR)/%.cpp.cvs: $(PROJ_SRC_DIR)/%.cpp - $(Verb) $(CMP) -s $@ $< || \ + $(Verb) $(CMP) -s $(PROJ_SRC_DIR)/$*.l $(PROJ_SRC_DIR)/$*.l.cvs || \ ($(CP) $< $@; $(CP) $(PROJ_SRC_DIR)/$*.l $(PROJ_SRC_DIR)/$*.l.cvs) $(LexFiles:%.l=$(ObjDir)/%.o) : \ @@ -1272,7 +1272,7 @@ # to the source location and building them. $(YaccFiles:%.y=$(PROJ_SRC_DIR)/%.cpp.cvs): \ $(PROJ_SRC_DIR)/%.cpp.cvs: $(PROJ_SRC_DIR)/%.cpp - $(Verb) $(CMP) -s $@ $< || \ + $(Verb) $(CMP) -s $(PROJ_SRC_DIR)/$*.y $(PROJ_SRC_DIR)/$*.y.cvs || \ ($(CP) $< $@; \ $(CP) $(PROJ_SRC_DIR)/$*.y $(PROJ_SRC_DIR)/$*.y.cvs; \ $(CP) $(PROJ_SRC_DIR)/$*.h $(PROJ_SRC_DIR)/$*.h.cvs) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits