Re: [llvm-commits] [LLVMdev] Simplifing the handling of pre-legalize vector nodes
On May 23, 2007, at 8:56 AM, Dan Gohman wrote: Ok, I now have a patch that implements this. It's a work in progress, and still rough in some areas (some details below), but it works well enough to allow the LLVM regression tests to pass on x86. I'm posting it now so that people can see what I'm up to. Cool! On Wed, May 23, 2007 at 12:03:30AM -0700, Chris Lattner wrote: On Mon, 21 May 2007, Dan Gohman wrote: It seems that a number of things would be considerably simpler if the pre-legalize nodes could use the same node kinds as post- legalize; the only thing preventing that is that the MVT::ValueType enum isn't able to describe vector types with arbitrarily long vector lengths. Yep, I'm sure you know this, but this is to support generic vectors. For example, if you had an input .ll that operated on 128-wide vectors, we want to be able to split that up to use 4-wide vectors if your target supports them. Last time I tried this it caused an impressive amount of register pressure; long-vector loads/stores require special ScheduleDAG dependencies, but LLVM was forcing long-vector dependencies on all the operators so that operations on the individual sub-vectors couldn't be scheduled around to reduce register pressure. But that's a different topic :-). In theory -combiner-alias-analysis should fix this, or at least help it, by making the stores independent of each other so they can be reordered. It isn't on by default because of its compile time hit. At some point, we should finish it up. Going forward, we will also likely have to do something similar to this for integer types, in order to handle stuff like i47 that gets legalized into 2 x i32 or something. I am not looking forward to duplicating all of the arithmetic nodes for IADD variants etc (urk, imagine vectors of strange-sized-integers! VIADD??) urk indeed... My current patch is specific to vectors, as the table elements for extended types are std::pairs of vector lengths and element types. Perhaps the thing to do then is to make it a table of Type*. Then it would be usable for any machine-illegal type. Sure, it makes sense to get a start, and extend it from there. I'm currently considering ways to make this possible. One idea is to rename the MVT::ValueType enum to something else and make MVT::ValueType a plain integer type. Values beyond the range of the original enum are interpreted as indices into a UniqueVector which holds pairs of vector lengths and element types. That is a very interesting idea. It handles the generality of arbitrary value types, but is nice and fast for the common code that doesn't use the craziness :). I like it! One downside is that debuggers no longer print MVT::ValueTypes with enum names. Slightly annoying, but not a big deal. Before I do much more experimentation with this, I wanted to run the idea by the list to see what feedback it might get. Has anyone thought about doing this before? Are there other approaches that might be better? This approach sounds very sensible. Make sure the SelectionDAG owns the table though. I wasn't sure if it should go in the SelectionDAG or the TargetLowering. It should be in SelectionDAG. The protocol is that the interfaces in include/llvm/Target/* are immutable once created (though the interfaces can hack on data structures passed in, like SelectionDAGs). The classes instantiated from include/llvm/CodeGen represent code as it is being hacked on. As such, CodeGen/ SelectionDAG is the right place to go. My current patch just uses a global table because it was easier and allowed me to get to the LegalizeDAG.cpp changes. But I'll definately clean this up. Sounds good. Some quick thoughts about the patch: diff -u -r1.34 ValueTypes.h --- include/llvm/CodeGen/ValueTypes.h +++ include/llvm/CodeGen/ValueTypes.h Meta-comment about this file: when the table is moved to not be global, the 'simple' functions should stay, the complex ones should move to be methods on SelectionDAG. Note that tools like tblgen use ValueTypes.h (for simple VTs), but don't link the llvm libraries in. // iPTR - An int value the size of the pointer of the current // target. This should only be used internal to tblgen! -iPTR = 255 +iPTR = 255, Can there be more than 255 elts in the table? If so, I'd suggest turning this into ~0U or something. - /// MVT::isInteger - Return true if this is a simple integer, or a packed + typedef int ValueType; Can these be negative? If not, plz use unsigned instead of int. + /// MVT::isExtendedIntegerVector - Test if the given ValueType is a + /// vector (simple or extended) with a floating-point element type. + bool isExtendedFloatingPointVector(ValueType VT); comment pasto. + /// MVT::isVector - Return true if this is a simple vector value +
[llvm-commits] CVS: llvm/lib/VMCore/ValueTypes.cpp
Changes in directory llvm/lib/VMCore: ValueTypes.cpp updated: 1.17 - 1.18 --- Log message: Add cases for v2f32. --- Diffs of the changes: (+2 -0) ValueTypes.cpp |2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/VMCore/ValueTypes.cpp diff -u llvm/lib/VMCore/ValueTypes.cpp:1.17 llvm/lib/VMCore/ValueTypes.cpp:1.18 --- llvm/lib/VMCore/ValueTypes.cpp:1.17 Sat Apr 28 00:38:52 2007 +++ llvm/lib/VMCore/ValueTypes.cpp Thu May 24 09:29:12 2007 @@ -43,6 +43,7 @@ case MVT::v8i16: return v8i16; case MVT::v4i32: return v4i32; case MVT::v2i64: return v2i64; + case MVT::v2f32: return v2f32; case MVT::v4f32: return v4f32; case MVT::v2f64: return v2f64; } @@ -106,6 +107,7 @@ case MVT::v8i16: return VectorType::get(Type::Int16Ty, 8); case MVT::v4i32: return VectorType::get(Type::Int32Ty, 4); case MVT::v2i64: return VectorType::get(Type::Int64Ty, 2); + case MVT::v2f32: return VectorType::get(Type::FloatTy, 2); case MVT::v4f32: return VectorType::get(Type::FloatTy, 4); case MVT::v2f64: return VectorType::get(Type::DoubleTy, 2); } ___ 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.405 - 1.406 --- Log message: Add explicit qualification for namespace MVT members. --- Diffs of the changes: (+1 -1) X86ISelLowering.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.405 llvm/lib/Target/X86/X86ISelLowering.cpp:1.406 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.405 Fri May 18 13:44:07 2007 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Thu May 24 09:33:05 2007 @@ -2255,7 +2255,7 @@ /// static SDOperand getZeroVector(MVT::ValueType VT, SelectionDAG DAG) { assert(MVT::isVector(VT) Expected a vector type); - unsigned NumElems = getVectorNumElements(VT); + unsigned NumElems = MVT::getVectorNumElements(VT); MVT::ValueType EVT = MVT::getVectorBaseType(VT); bool isFP = MVT::isFloatingPoint(EVT); SDOperand Zero = isFP ? DAG.getConstantFP(0.0, EVT) : DAG.getConstant(0, EVT); ___ 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/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.403 - 1.404 --- Log message: Add explicit qualification for namespace MVT members. --- Diffs of the changes: (+1 -1) SelectionDAG.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.403 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.404 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.403Tue Apr 24 19:00:45 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu May 24 09:33:05 2007 @@ -3048,7 +3048,7 @@ else cerr null: M-getOffset() ; } else if (const VTSDNode *N = dyn_castVTSDNode(this)) { -cerr : getValueTypeString(N-getVT()); +cerr : MVT::getValueTypeString(N-getVT()); } else if (const LoadSDNode *LD = dyn_castLoadSDNode(this)) { bool doExt = true; switch (LD-getExtensionType()) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp Type.cpp
Changes in directory llvm/lib/VMCore: Constants.cpp updated: 1.228 - 1.229 Type.cpp updated: 1.187 - 1.188 --- Log message: Minor comment cleanups. --- Diffs of the changes: (+6 -6) Constants.cpp | 10 +- Type.cpp |2 +- 2 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.228 llvm/lib/VMCore/Constants.cpp:1.229 --- llvm/lib/VMCore/Constants.cpp:1.228 Mon Mar 19 15:39:08 2007 +++ llvm/lib/VMCore/Constants.cpp Thu May 24 09:36:04 2007 @@ -130,14 +130,14 @@ return 0; } -/// @returns the value for an packed integer constant of the given type that +/// @returns the value for a vector integer constant of the given type that /// has all its bits set to true. /// @brief Get the all ones value ConstantVector *ConstantVector::getAllOnesValue(const VectorType *Ty) { std::vectorConstant* Elts; Elts.resize(Ty-getNumElements(), ConstantInt::getAllOnesValue(Ty-getElementType())); - assert(Elts[0] Not a packed integer type!); + assert(Elts[0] Not a vector integer type!); return castConstantVector(ConstantVector::get(Elts)); } @@ -353,7 +353,7 @@ assert((C-getType() == T-getElementType() || (T-isAbstract() C-getType()-getTypeID() == T-getElementType()-getTypeID())) - Initializer for packed element doesn't match packed element type!); + Initializer for vector element doesn't match vector element type!); OL-init(C, this); } } @@ -1185,7 +1185,7 @@ Constant *ConstantVector::get(const VectorType *Ty, const std::vectorConstant* V) { - // If this is an all-zero packed, return a ConstantAggregateZero object + // If this is an all-zero vector, return a ConstantAggregateZero object if (!V.empty()) { Constant *C = V[0]; if (!C-isNullValue()) @@ -1209,7 +1209,7 @@ destroyConstantImpl(); } -/// This function will return true iff every element in this packed constant +/// This function will return true iff every element in this vector constant /// is set to all ones. /// @returns true iff this constant's emements are all set to all ones. /// @brief Determine if the value is all ones. Index: llvm/lib/VMCore/Type.cpp diff -u llvm/lib/VMCore/Type.cpp:1.187 llvm/lib/VMCore/Type.cpp:1.188 --- llvm/lib/VMCore/Type.cpp:1.187 Thu May 3 22:39:28 2007 +++ llvm/lib/VMCore/Type.cppThu May 24 09:36:04 2007 @@ -1181,7 +1181,7 @@ VectorType *VectorType::get(const Type *ElementType, unsigned NumElements) { - assert(ElementType Can't get packed of null types!); + assert(ElementType Can't get vector of null types!); assert(isPowerOf2_32(NumElements) Vector length should be a power of 2!); VectorValType PVT(ElementType, NumElements); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
Changes in directory llvm/lib/Transforms/Utils: SimplifyCFG.cpp updated: 1.121 - 1.122 --- Log message: Minor comment cleanups. --- Diffs of the changes: (+1 -1) SimplifyCFG.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.121 llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.122 --- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.121 Tue Apr 17 12:47:54 2007 +++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp Thu May 24 09:36:04 2007 @@ -532,7 +532,7 @@ } -// EliminateBlockCases - Given an vector of bb/value pairs, remove any entries +// EliminateBlockCases - Given a vector of bb/value pairs, remove any entries // in the list that match the specified block. static void EliminateBlockCases(BasicBlock *BB, std::vectorstd::pairConstantInt*, BasicBlock* Cases) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
Changes in directory llvm/include/llvm/CodeGen: SelectionDAGNodes.h updated: 1.190 - 1.191 --- Log message: Minor comment cleanups. --- Diffs of the changes: (+1 -1) SelectionDAGNodes.h |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.190 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.191 --- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.190 Mon May 14 19:20:13 2007 +++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Thu May 24 09:36:03 2007 @@ -249,7 +249,7 @@ /// VINSERT_VECTOR_ELT(VECTOR, VAL, IDX, COUNT,TYPE) - Given a vector /// VECTOR, an element ELEMENT, and a (potentially variable) index IDX, -/// return an vector with the specified element of VECTOR replaced with VAL. +/// return a vector with the specified element of VECTOR replaced with VAL. /// COUNT and TYPE specify the type of vector, as is standard for V* nodes. VINSERT_VECTOR_ELT, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Constants.h
Changes in directory llvm/include/llvm: Constants.h updated: 1.146 - 1.147 --- Log message: Minor comment cleanups. --- Diffs of the changes: (+4 -4) Constants.h |8 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/include/llvm/Constants.h diff -u llvm/include/llvm/Constants.h:1.146 llvm/include/llvm/Constants.h:1.147 --- llvm/include/llvm/Constants.h:1.146 Fri Apr 13 13:12:09 2007 +++ llvm/include/llvm/Constants.h Thu May 24 09:36:03 2007 @@ -399,14 +399,14 @@ return get(std::vectorConstant*(Vals, Vals+NumVals)); } - /// getType - Specialize the getType() method to always return an VectorType, + /// getType - Specialize the getType() method to always return a VectorType, /// which reduces the amount of casting needed in parts of the compiler. /// inline const VectorType *getType() const { return reinterpret_castconst VectorType*(Value::getType()); } - /// @returns the value for an packed integer constant of the given type that + /// @returns the value for a vector integer constant of the given type that /// has all its bits set to true. /// @brief Get the all ones value static ConstantVector *getAllOnesValue(const VectorType *Ty); @@ -416,7 +416,7 @@ /// created as ConstantAggregateZero objects. virtual bool isNullValue() const { return false; } - /// This function will return true iff every element in this packed constant + /// This function will return true iff every element in this vector constant /// is set to all ones. /// @returns true iff this constant's emements are all set to all ones. /// @brief Determine if the value is all ones. @@ -631,7 +631,7 @@ static Constant *getShuffleVector(Constant *V1, Constant *V2, Constant *Mask); /// Floating point negation must be implemented with f(x) = -0.0 - x. This - /// method returns the negative zero constant for floating point or packed + /// method returns the negative zero constant for floating point or vector /// floating point types; for all other types, it returns the null value. static Constant *getZeroValueForNegationExpr(const Type *Ty); ___ 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.453 - 1.454 --- Log message: Minor comment cleanups. --- Diffs of the changes: (+1 -1) SelectionDAGISel.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.453 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.454 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.453Wed May 23 06:08:31 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu May 24 09:36:04 2007 @@ -770,7 +770,7 @@ Ops.push_back(DAG.getCopyFromReg(DAG.getEntryNode(), InReg++, PTyElementVT)); } else if (PTyElementVT PTyLegalElementVT) { - // If the register was promoted, use TRUNCATE of FP_ROUND as appropriate. + // If the register was promoted, use TRUNCATE or FP_ROUND as appropriate. for (unsigned i = 0; i != NE; ++i) { SDOperand Op = DAG.getCopyFromReg(DAG.getEntryNode(), InReg++, PTyElementVT); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.114 - 1.115 --- Log message: Compute the correct word number. --- Diffs of the changes: (+1 -1) ExecutionEngine.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.114 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.115 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.114 Mon Mar 12 12:57:00 2007 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppThu May 24 10:03:18 2007 @@ -573,7 +573,7 @@ } else if (BitWidth = 64) { Result.IntVal = APInt(BitWidth, *((uint64_t*)Ptr)); } else - Result.IntVal = APInt(BitWidth, BitWidth/64, (uint64_t*)Ptr); + Result.IntVal = APInt(BitWidth, (BitWidth+63)/64, (uint64_t*)Ptr); break; } case Type::FloatTyID: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp
Changes in directory llvm/lib/CodeGen: BranchFolding.cpp updated: 1.56 - 1.57 --- Log message: Fix for PR1444: http://llvm.org/PR1444 : do not create two successors to the same block. Temporarily, this breaks CodeGen/Generic/2006-02-12-InsertLibraryCall.ll by exposing an unrelated latent problem; working on that. --- Diffs of the changes: (+10 -2) BranchFolding.cpp | 12 ++-- 1 files changed, 10 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/BranchFolding.cpp diff -u llvm/lib/CodeGen/BranchFolding.cpp:1.56 llvm/lib/CodeGen/BranchFolding.cpp:1.57 --- llvm/lib/CodeGen/BranchFolding.cpp:1.56 Wed May 23 16:07:20 2007 +++ llvm/lib/CodeGen/BranchFolding.cpp Thu May 24 12:39:32 2007 @@ -717,12 +717,20 @@ I-getOperand(i).setMachineBasicBlock(New); } - // Update the successor information. + // Update the successor information. If New was already a successor, just + // remove the link to Old instead of creating another one. PR 1444. + bool HadSuccessorNew = false; std::vectorMachineBasicBlock* Succs(BB-succ_begin(), BB-succ_end()); for (int i = Succs.size()-1; i = 0; --i) +if (Succs[i] == New) { + HadSuccessorNew = true; + break; +} + for (int i = Succs.size()-1; i = 0; --i) if (Succs[i] == Old) { BB-removeSuccessor(Old); - BB-addSuccessor(New); + if (!HadSuccessorNew) +BB-addSuccessor(New); } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-www/DevMtgMay2007.html
Changes in directory llvm-www: DevMtgMay2007.html updated: 1.146 - 1.147 --- Log message: Add Victor Hernandez. --- Diffs of the changes: (+3 -2) DevMtgMay2007.html |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.146 llvm-www/DevMtgMay2007.html:1.147 --- llvm-www/DevMtgMay2007.html:1.146 Mon May 21 00:08:04 2007 +++ llvm-www/DevMtgMay2007.html Thu May 24 12:51:00 2007 @@ -292,6 +292,7 @@ trtdDan Gohman/tdtdCray Inc./td/tr trtdLang Hames/tdtdUniversity of Sydney/td/tr trtdStuart Hastings/tdtdApple Inc./td/tr +trtdVictor Hernandez/tdtdApple Inc./td/tr trtdRobert Hundt/tdtdGoogle/td/tr trtdDale Johannesen/tdtdApple Inc./td/tr trtdTed Kremenek/tdtdIndependent/td/tr @@ -334,7 +335,7 @@ /td /tr /table - pbTotal confirmed: 46/b/p + pbTotal confirmed: 47/b/p table class=www trth colspan=2Unconfirmed Attendees/th/tr trthName/ththOrganization/th/tr @@ -352,6 +353,6 @@ src=http://jigsaw.w3.org/css-validator/images/vcss; alt=Valid CSS!/a a href=http://validator.w3.org/check/referer;img src=http://www.w3.org/Icons/valid-html401; alt=Valid HTML 4.01!/a -br/Last modified: $Date: 2007/05/21 05:08:04 $ +br/Last modified: $Date: 2007/05/24 17:51:00 $ /address !--#include virtual=footer.incl -- ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-www/InTheNews.html
Changes in directory llvm-www: InTheNews.html updated: 1.19 - 1.20 --- Log message: add two links --- Diffs of the changes: (+3 -1) InTheNews.html |4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm-www/InTheNews.html diff -u llvm-www/InTheNews.html:1.19 llvm-www/InTheNews.html:1.20 --- llvm-www/InTheNews.html:1.19Sun May 13 13:37:48 2007 +++ llvm-www/InTheNews.html Thu May 24 12:54:42 2007 @@ -15,6 +15,8 @@ div class=www_subsubsectionNews Articles/div pb2007/b/p ul +lia href=http://zrusin.blogspot.com/2007/05/mesa-and-llvm.html;2007-05-24/a, zrusin, bMesa and LLVM/b, Zack Rusin./li +lia href=http://lucille.atso-net.jp/blog/?p=294;2007-05-24/a, lucille, bLLVM 2.0 and GCC 4.2/b. Finds the LLVM JIT 20% faster than GCC 4.2 at some benchmark./li lia href=http://cliffhacks.blogspot.com/2007/03/experimenting-with-llvm.html;2007-03-31/a, Cliff Hacks, bExperimenting with LLVM/b, Cliff Biffle./li lia href=http://arstechnica.com/journals/apple.ars/2007/03/19/apple-putting-llvm-to-good-use;2007-03-20/a, ars technica, bApple putting LLVM to good use/b (Bossa Conference), @@ -104,6 +106,6 @@ a href=http://validator.w3.org/check/referer;img src=http://www.w3.org/Icons/valid-html401; alt=Valid HTML 4.01!/a br/ - Last modified: $Date: 2007/05/13 18:37:48 $ + Last modified: $Date: 2007/05/24 17:54:42 $ /address !--#include virtual=footer.incl -- ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp
Changes in directory llvm/lib/CodeGen: BranchFolding.cpp updated: 1.57 - 1.58 --- Log message: Blocks that cond-br and uncond-br/fallthrough to same block should have only one successor. --- Diffs of the changes: (+4 -1) BranchFolding.cpp |5 - 1 files changed, 4 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/BranchFolding.cpp diff -u llvm/lib/CodeGen/BranchFolding.cpp:1.57 llvm/lib/CodeGen/BranchFolding.cpp:1.58 --- llvm/lib/CodeGen/BranchFolding.cpp:1.57 Thu May 24 12:39:32 2007 +++ llvm/lib/CodeGen/BranchFolding.cpp Thu May 24 13:31:55 2007 @@ -672,7 +672,10 @@ MachineBasicBlock::pred_iterator SI = MBB.succ_begin(); while (SI != MBB.succ_end()) { -if (*SI == DestA) { +if (*SI == DestA DestA == DestB) { + DestA = DestB = 0; + ++SI; +} else if (*SI == DestA) { DestA = 0; ++SI; } else if (*SI == DestB) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-www/DevMtgMay2007.html
Changes in directory llvm-www: DevMtgMay2007.html updated: 1.147 - 1.148 --- Log message: Added Kat Danielson --- Diffs of the changes: (+4 -3) DevMtgMay2007.html |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.147 llvm-www/DevMtgMay2007.html:1.148 --- llvm-www/DevMtgMay2007.html:1.147 Thu May 24 12:51:00 2007 +++ llvm-www/DevMtgMay2007.html Thu May 24 13:35:06 2007 @@ -285,6 +285,7 @@ trtdEvan Cheng/tdtdApple Inc./td/tr trtdJosh Conner/tdtdApple Inc./td/tr trtdJohn Criswell/tdtdUIUC/td/tr +trtdKat Danielson/tdtdApple Inc./td/tr trtdMike Engler/tdtdAdobe Systems Incorporated./td/tr trtdRafael Espiacute;ndola/tdtdGoogle/td/tr trtdTomas Evensen/tdtdWind River/td/tr @@ -301,13 +302,13 @@ trtdTanya Lattner/tdtdIndependent/td/tr trtdAndrew Lenharth/tdtdUIUC/td/tr trtdJulien Lerouge/tdtdApple Inc./td -trtdNick Lewycky/tdtdIndependent/td/tr /table /td td table class=www trth colspan=2Confirmed Attendees/th/tr trthName/ththOrganization/th/tr +trtdNick Lewycky/tdtdIndependent/td/tr trtdEfrem Lipkin/tdtdCoDesign/td/tr trtdGabe McArthur/tdtdIndependent/td/tr trtdPaul McJones/tdtdAdobe Systems Incorporated./td/tr @@ -335,7 +336,7 @@ /td /tr /table - pbTotal confirmed: 47/b/p + pbTotal confirmed: 48/b/p table class=www trth colspan=2Unconfirmed Attendees/th/tr trthName/ththOrganization/th/tr @@ -353,6 +354,6 @@ src=http://jigsaw.w3.org/css-validator/images/vcss; alt=Valid CSS!/a a href=http://validator.w3.org/check/referer;img src=http://www.w3.org/Icons/valid-html401; alt=Valid HTML 4.01!/a -br/Last modified: $Date: 2007/05/24 17:51:00 $ +br/Last modified: $Date: 2007/05/24 18:35:06 $ /address !--#include virtual=footer.incl -- ___ 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/ScalarReplAggregates.cpp
Changes in directory llvm/lib/Transforms/Scalar: ScalarReplAggregates.cpp updated: 1.94 - 1.95 --- Log message: Fix PR1446: http://llvm.org/PR1446 by not scalarrepl'ing giant structures. --- Diffs of the changes: (+5 -1) ScalarReplAggregates.cpp |6 +- 1 files changed, 5 insertions(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.94 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.95 --- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.94Sun May 6 08:37:16 2007 +++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Thu May 24 13:43:04 2007 @@ -148,6 +148,8 @@ if (AllocationInst *A = dyn_castAllocationInst(I)) WorkList.push_back(A); + const TargetData TD = getAnalysisTargetData(); + // Process the worklist bool Changed = false; while (!WorkList.empty()) { @@ -177,7 +179,9 @@ // value cannot be decomposed at all. if (!AI-isArrayAllocation() (isaStructType(AI-getAllocatedType()) || - isaArrayType(AI-getAllocatedType( { + isaArrayType(AI-getAllocatedType())) +AI-getAllocatedType()-isSized() +TD.getTypeSize(AI-getAllocatedType()) 128) { // Check that all of the users of the allocation are capable of being // transformed. switch (isSafeAllocaToScalarRepl(AI)) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Transforms/ScalarRepl/2007-05-24-LargeAggregate.ll
Changes in directory llvm/test/Transforms/ScalarRepl: 2007-05-24-LargeAggregate.ll added (r1.1) --- Log message: testcase for PR1446: http://llvm.org/PR1446 --- Diffs of the changes: (+27 -0) 2007-05-24-LargeAggregate.ll | 27 +++ 1 files changed, 27 insertions(+) Index: llvm/test/Transforms/ScalarRepl/2007-05-24-LargeAggregate.ll diff -c /dev/null llvm/test/Transforms/ScalarRepl/2007-05-24-LargeAggregate.ll:1.1 *** /dev/null Thu May 24 13:42:57 2007 --- llvm/test/Transforms/ScalarRepl/2007-05-24-LargeAggregate.llThu May 24 13:42:47 2007 *** *** 0 --- 1,27 + ; RUN: llvm-as %s | opt -scalarrepl | llvm-dis | grep {alloca.*client_t} + ; PR1446 + target datalayout = e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64 + target triple = i686-pc-linux-gnu + + %struct.clientSnapshot_t = type { i32, [32 x i8], %struct.playerState_t, i32, i32, i32, i32, i32 } + %struct.client_t = type { i32, [1024 x i8], [64 x [1024 x i8]], i32, i32, i32, i32, i32, i32, %struct.usercmd_t, i32, i32, [1024 x i8], %struct.sharedEntity_t*, [32 x i8], [64 x i8], i32, i32, i32, i32, i32, i32, [8 x i8*], [8 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, [32 x %struct.clientSnapshot_t], i32, i32, i32, i32, i32, %struct.netchan_t, %struct.netchan_buffer_t*, %struct.netchan_buffer_t**, i32, [1025 x i32] } + %struct.entityShared_t = type { %struct.entityState_t, i32, i32, i32, i32, i32, [3 x float], [3 x float], i32, [3 x float], [3 x float], [3 x float], [3 x float], i32 } + %struct.entityState_t = type { i32, i32, i32, %struct.trajectory_t, %struct.trajectory_t, i32, i32, [3 x float], [3 x float], [3 x float], [3 x float], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 } + %struct.msg_t = type { i32, i32, i32, i8*, i32, i32, i32, i32 } + %struct.netadr_t = type { i32, [4 x i8], [10 x i8], i16 } + %struct.netchan_buffer_t = type { %struct.msg_t, [16384 x i8], %struct.netchan_buffer_t* } + %struct.netchan_t = type { i32, i32, %struct.netadr_t, i32, i32, i32, i32, i32, [16384 x i8], i32, i32, i32, [16384 x i8] } + %struct.playerState_t = type { i32, i32, i32, i32, i32, [3 x float], [3 x float], i32, i32, i32, [3 x i32], i32, i32, i32, i32, i32, i32, [3 x float], i32, i32, [2 x i32], [2 x i32], i32, i32, i32, i32, i32, i32, [3 x float], i32, i32, i32, i32, i32, [16 x i32], [16 x i32], [16 x i32], [16 x i32], i32, i32, i32, i32, i32, i32, i32 } + %struct.sharedEntity_t = type { %struct.entityState_t, %struct.entityShared_t } + %struct.trajectory_t = type { i32, i32, i32, [3 x float], [3 x float] } + %struct.usercmd_t = type { i32, [3 x i32], i32, i8, i8, i8, i8 } + + declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) + + define void @SV_DirectConnect(i64 %from.0.0, i64 %from.0.1, i32 %from.1) { + entry: + %temp = alloca %struct.client_t, align 16 ; %struct.client_t* [#uses=1] + %temp586 = bitcast %struct.client_t* %temp to i8* ; i8* [#uses=1] + call void @llvm.memcpy.i32( i8* null, i8* %temp586, i32 121596, i32 0 ) + unreachable + } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/docs/LangRef.html
Changes in directory llvm/docs: LangRef.html updated: 1.245 - 1.246 --- Log message: remove contradiction owen noticed --- Diffs of the changes: (+3 -8) LangRef.html | 11 +++ 1 files changed, 3 insertions(+), 8 deletions(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.245 llvm/docs/LangRef.html:1.246 --- llvm/docs/LangRef.html:1.245Wed May 16 13:44:01 2007 +++ llvm/docs/LangRef.html Thu May 24 14:13:27 2007 @@ -2909,10 +2909,7 @@ h5Semantics:/h5 pThe ttzext/tt fills the high order bits of the ttvalue/tt with zero -bits until it reaches the size of the destination type, ttty2/tt. When the -the operand and the type are the same size, no bit filling is done and the -cast is considered a ino-op cast/i because no bits change (only the type -changes)./p +bits until it reaches the size of the destination type, ttty2/tt./p pWhen zero extending from i1, the result will always be either 0 or 1./p @@ -2949,9 +2946,7 @@ p The 'ttsext/tt' instruction performs a sign extension by copying the sign bit (highest order bit) of the ttvalue/tt until it reaches the bit size of -the type ttty2/tt. When the the operand and the type are the same size, -no bit filling is done and the cast is considered a ino-op cast/i because -no bits change (only the type changes)./p +the type ttty2/tt./p pWhen sign extending from i1, the extension always results in -1 or 0./p @@ -4791,7 +4786,7 @@ a href=mailto:[EMAIL PROTECTED]Chris Lattner/abr a href=http://llvm.org;The LLVM Compiler Infrastructure/abr - Last modified: $Date: 2007/05/16 18:44:01 $ + Last modified: $Date: 2007/05/24 19:13:27 $ /address /body /html ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/include/llvm/Target/TargetInstrInfo.h
Add a couple of target hooks for predication. + /// isPredicable - Returns true if the instruction is already predicated. + /// + virtual bool isPredicated(MachineInstr *MI) const { Should take const MachineInstr* +return false; + } + /// PredicateInstruction - Convert the instruction into a predicated /// instruction. It returns true if the operation was successful. virtual bool PredicateInstruction(MachineInstr *MI, +std::vectorMachineOperand Pred) const; Pred should be const. + + /// SubsumesPredicate - Returns true if the first specified predicated + /// subsumes the second, e.g. GE subsumes GT. + virtual bool SubsumesPredicate(std::vectorMachineOperand Pred1, + std::vectorMachineOperand Pred2) const { +return false; + } Pred1/Pred2 should be const. -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] Regalloc Refactoring
That's fine. Please check in what you have now after you've merged in the recent changes. Thanks, Evan On May 23, 2007, at 11:52 AM, David Greene wrote: Chris Lattner wrote: What did Evan ask for? Are you referring to the addrequired bit? Not sure what you mean by addrequired bit. If I understand correctly, Evan wants me to create an infrastructure to allow pluggable coalescers. I'd rather not do that right now as I've got a ton of other things on my plate. It turns out that I'll be writing another colaescer sometime in the future so this functionality will be needed but I'd rather keep this particular patch as small as possible (it's already big) and do the pluggable coalescer infrastructure separately. If I've got to write this other infrastructure now, it'll probably be a few weeks at least before I'd have anything, and possibly longer. I think it's best to get coalescing separated from liveness analysis ASAP so Evan and others can make tweaks to both without disrupting future patches. Ok? -Dave ___ 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
Re: [llvm-commits] initial mips support!
Woot! That's quite a big chunk of code. I'll try to go through it as soon as I can. Thanks, Evan On May 21, 2007, at 7:14 PM, bruno cardoso wrote: Hello, With the files on attachment LLVM has now initial support for MIPS. =) The support is still simple and experimental. The status is: x - Mips I instructions, without (coprocessor) float point support. x - Mips o32 ABI calling convention implemented. x - .s files generated by LLC can be compiled with Mips GCC/GAS. x - Simple test programs are working on Linux in a Mips emulated QEMU machine. x - AsmPrinter does not yet generate all Mips GAS pseudo-instructions (such as .cpload, .fmask, .mask) I hope you enjoy! =) Cheers, -- Bruno Cardoso Lopes http://www.brunocardoso.org The Man in Black fled across the desert and the gunslinger followed - Childe Roland to the Dark Tower Came Makefile Mips.h Mips.td MipsCallingConv.td MipsISelDAGToDAG.cpp MipsISelLowering.cpp MipsInstrFormats.td MipsInstrInfo.cpp MipsInstrInfo.h MipsInstrInfo.td MipsRegisterInfo.cpp MipsRegisterInfo.h MipsRegisterInfo.td MipsSubtarget.cpp MipsSubtarget.h MipsTargetAsmInfo.cpp MipsTargetAsmInfo.h MipsTargetMachine.cpp MipsAsmPrinter.cpp MipsISelLowering.h MipsTargetMachine.h ___ 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-www/DevMtgMay2007.html
Changes in directory llvm-www: DevMtgMay2007.html updated: 1.148 - 1.149 --- Log message: Add Scott Williams --- Diffs of the changes: (+4 -3) DevMtgMay2007.html |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.148 llvm-www/DevMtgMay2007.html:1.149 --- llvm-www/DevMtgMay2007.html:1.148 Thu May 24 13:35:06 2007 +++ llvm-www/DevMtgMay2007.html Thu May 24 18:55:36 2007 @@ -302,13 +302,13 @@ trtdTanya Lattner/tdtdIndependent/td/tr trtdAndrew Lenharth/tdtdUIUC/td/tr trtdJulien Lerouge/tdtdApple Inc./td +trtdNick Lewycky/tdtdIndependent/td/tr /table /td td table class=www trth colspan=2Confirmed Attendees/th/tr trthName/ththOrganization/th/tr -trtdNick Lewycky/tdtdIndependent/td/tr trtdEfrem Lipkin/tdtdCoDesign/td/tr trtdGabe McArthur/tdtdIndependent/td/tr trtdPaul McJones/tdtdAdobe Systems Incorporated./td/tr @@ -332,11 +332,12 @@ trtdMarcel Weiher/tdtdMetaObject/td/tr trtdJames Weisner/tdtdAscenium Corp./td/tr trtdCalum Wilkie/tdtdMicrochip Technology/td/tr +trtdScott Williams/tdtdGoogle/td/tr /table /td /tr /table - pbTotal confirmed: 48/b/p + pbTotal confirmed: 49/b/p table class=www trth colspan=2Unconfirmed Attendees/th/tr trthName/ththOrganization/th/tr @@ -354,6 +355,6 @@ src=http://jigsaw.w3.org/css-validator/images/vcss; alt=Valid CSS!/a a href=http://validator.w3.org/check/referer;img src=http://www.w3.org/Icons/valid-html401; alt=Valid HTML 4.01!/a -br/Last modified: $Date: 2007/05/24 18:35:06 $ +br/Last modified: $Date: 2007/05/24 23:55:36 $ /address !--#include virtual=footer.incl -- ___ 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.12 - 1.13 --- Log message: Silly boog. --- Diffs of the changes: (+9 -9) IfConversion.cpp | 18 +- 1 files changed, 9 insertions(+), 9 deletions(-) Index: llvm/lib/CodeGen/IfConversion.cpp diff -u llvm/lib/CodeGen/IfConversion.cpp:1.12 llvm/lib/CodeGen/IfConversion.cpp:1.13 --- llvm/lib/CodeGen/IfConversion.cpp:1.12 Wed May 23 02:23:16 2007 +++ llvm/lib/CodeGen/IfConversion.cpp Thu May 24 19:59:01 2007 @@ -173,17 +173,17 @@ return; // Already analyzed. BBI.BB = BB; BBI.NonPredSize = std::distance(BB-begin(), BB-end()); - -// Look for 'root' of a simple (non-nested) triangle or diamond. -BBI.Kind = ICNotClassfied; -bool CanAnalyze = !TII-AnalyzeBranch(*BB, BBI.TrueBB, BBI.FalseBB, - BBI.BrCond); -// Does it end with a return, indirect jump, or jumptable branch? -BBI.hasEarlyExit = TII-BlockHasNoFallThrough(*BB) !BBI.TrueBB; -if (!CanAnalyze || !BBI.TrueBB || BBI.BrCond.size() == 0) - return; } + // Look for 'root' of a simple (non-nested) triangle or diamond. + BBI.Kind = ICNotClassfied; + bool CanAnalyze = !TII-AnalyzeBranch(*BB, BBI.TrueBB, BBI.FalseBB, +BBI.BrCond); + // Does it end with a return, indirect jump, or jumptable branch? + BBI.hasEarlyExit = TII-BlockHasNoFallThrough(*BB) !BBI.TrueBB; + if (!CanAnalyze || !BBI.TrueBB || BBI.BrCond.size() == 0) +return; + // Not a candidate if 'true' block is going to be if-converted. StructuralAnalysis(BBI.TrueBB); BBInfo TrueBBI = BBAnalysis[BBI.TrueBB-getNumber()]; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetMachine.h
Changes in directory llvm/include/llvm/Target: TargetMachine.h updated: 1.78 - 1.79 --- Log message: Disable Tail Merging for now. --- Diffs of the changes: (+2 -2) TargetMachine.h |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Target/TargetMachine.h diff -u llvm/include/llvm/Target/TargetMachine.h:1.78 llvm/include/llvm/Target/TargetMachine.h:1.79 --- llvm/include/llvm/Target/TargetMachine.h:1.78 Tue May 22 13:31:04 2007 +++ llvm/include/llvm/Target/TargetMachine.hThu May 24 20:00:24 2007 @@ -187,7 +187,7 @@ /// getEnableTailMergeDefault - the default setting for -enable-tail-merge /// on this target. User flag overrides. - virtual const bool getEnableTailMergeDefault() const { return true; } + virtual const bool getEnableTailMergeDefault() const { return false; } /// addPassesToEmitFile - Add passes to the specified pass manager to get the /// specified file emitted. Typically this will involve several steps of code @@ -322,7 +322,7 @@ /// getEnableTailMergeDefault - the default setting for -enable-tail-merge /// on this target. User flag overrides. - virtual const bool getEnableTailMergeDefault() const { return true; } + virtual const bool getEnableTailMergeDefault() const { return false; } }; } // End llvm namespace ___ 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
Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.310 - 1.311 --- Log message: tighten up recursion depth again --- Diffs of the changes: (+13 -11) DAGCombiner.cpp | 24 +--- 1 files changed, 13 insertions(+), 11 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.310 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.311 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.310 Wed May 23 21:35:39 2007 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu May 24 21:19:06 2007 @@ -353,15 +353,15 @@ /// specified expression for the same cost as the expression itself, or 2 if we /// can compute the negated form more cheaply than the expression itself. static char isNegatibleForFree(SDOperand Op, unsigned Depth = 0) { - // Don't recurse exponentially. - if (Depth 6) return false; - // fneg is removable even if it has multiple uses. if (Op.getOpcode() == ISD::FNEG) return 2; // Don't allow anything with multiple uses. if (!Op.hasOneUse()) return 0; + // Don't recurse exponentially. + if (Depth 6) return 0; + switch (Op.getOpcode()) { default: return false; case ISD::ConstantFP: @@ -401,13 +401,15 @@ /// GetNegatedExpression - If isNegatibleForFree returns true, this function /// returns the newly negated expression. -static SDOperand GetNegatedExpression(SDOperand Op, SelectionDAG DAG) { +static SDOperand GetNegatedExpression(SDOperand Op, SelectionDAG DAG, + unsigned Depth = 0) { // fneg is removable even if it has multiple uses. if (Op.getOpcode() == ISD::FNEG) return Op.getOperand(0); // Don't allow anything with multiple uses. assert(Op.hasOneUse() Unknown reuse!); + assert(Depth = 6 GetNegatedExpression doesn't match isNegatibleForFree); switch (Op.getOpcode()) { default: assert(0 Unknown code); case ISD::ConstantFP: @@ -418,13 +420,13 @@ assert(UnsafeFPMath); // -(A+B) - -A - B -if (isNegatibleForFree(Op.getOperand(0))) +if (isNegatibleForFree(Op.getOperand(0), Depth+1)) return DAG.getNode(ISD::FSUB, Op.getValueType(), - GetNegatedExpression(Op.getOperand(0), DAG), + GetNegatedExpression(Op.getOperand(0), DAG, Depth+1), Op.getOperand(1)); // -(A+B) - -B - A return DAG.getNode(ISD::FSUB, Op.getValueType(), - GetNegatedExpression(Op.getOperand(1), DAG), + GetNegatedExpression(Op.getOperand(1), DAG, Depth+1), Op.getOperand(0)); case ISD::FSUB: // We can't turn -(A-B) into B-A when we honor signed zeros. @@ -439,21 +441,21 @@ assert(!HonorSignDependentRoundingFPMath()); // -(X*Y) - -X * Y -if (isNegatibleForFree(Op.getOperand(0))) +if (isNegatibleForFree(Op.getOperand(0), Depth+1)) return DAG.getNode(Op.getOpcode(), Op.getValueType(), - GetNegatedExpression(Op.getOperand(0), DAG), + GetNegatedExpression(Op.getOperand(0), DAG, Depth+1), Op.getOperand(1)); // -(X*Y) - X * -Y return DAG.getNode(Op.getOpcode(), Op.getValueType(), Op.getOperand(0), - GetNegatedExpression(Op.getOperand(1), DAG)); + GetNegatedExpression(Op.getOperand(1), DAG, Depth+1)); case ISD::FP_EXTEND: case ISD::FP_ROUND: case ISD::FSIN: return DAG.getNode(Op.getOpcode(), Op.getValueType(), - GetNegatedExpression(Op.getOperand(0), DAG)); + GetNegatedExpression(Op.getOperand(0), DAG, Depth+1)); } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits