[llvm-commits] CVS: llvm/lib/Analysis/BasicAliasAnalysis.cpp ScalarEvolution.cpp ScalarEvolutionExpander.cpp ValueNumbering.cpp
Changes in directory llvm/lib/Analysis: BasicAliasAnalysis.cpp updated: 1.90 -> 1.91 ScalarEvolution.cpp updated: 1.58 -> 1.59 ScalarEvolutionExpander.cpp updated: 1.4 -> 1.5 ValueNumbering.cpp updated: 1.22 -> 1.23 --- Log message: For PR950: http://llvm.org/PR950 : The long awaited CAST patch. This introduces 12 new instructions into LLVM to replace the cast instruction. Corresponding changes throughout LLVM are provided. This passes llvm-test, llvm/test, and SPEC CPUINT2000 with the exception of 175.vpr which fails only on a slight floating point output difference. --- Diffs of the changes: (+71 -75) BasicAliasAnalysis.cpp | 76 ++-- ScalarEvolution.cpp | 55 ++- ScalarEvolutionExpander.cpp |9 ++--- ValueNumbering.cpp |6 ++- 4 files changed, 71 insertions(+), 75 deletions(-) Index: llvm/lib/Analysis/BasicAliasAnalysis.cpp diff -u llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.90 llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.91 --- llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.90 Sun Nov 12 19:10:12 2006 +++ llvm/lib/Analysis/BasicAliasAnalysis.cppSun Nov 26 19:05:09 2006 @@ -129,27 +129,23 @@ return new BasicAliasAnalysis(); } -// hasUniqueAddress - Return true if the specified value points to something -// with a unique, discernable, address. -static inline bool hasUniqueAddress(const Value *V) { - return isa(V) || isa(V); -} - // getUnderlyingObject - This traverses the use chain to figure out what object // the specified value points to. If the value points to, or is derived from, a // unique object or an argument, return it. static const Value *getUnderlyingObject(const Value *V) { if (!isa(V->getType())) return 0; - // If we are at some type of object... return it. - if (hasUniqueAddress(V) || isa(V)) return V; + // If we are at some type of object, return it. GlobalValues and Allocations + // have unique addresses. + if (isa(V) || isa(V) || isa(V)) +return V; // Traverse through different addressing mechanisms... if (const Instruction *I = dyn_cast(V)) { -if (isa(I) || isa(I)) +if (isa(I) || isa(I)) return getUnderlyingObject(I->getOperand(0)); } else if (const ConstantExpr *CE = dyn_cast(V)) { -if (CE->getOpcode() == Instruction::Cast || +if (CE->getOpcode() == Instruction::BitCast || CE->getOpcode() == Instruction::GetElementPtr) return getUnderlyingObject(CE->getOperand(0)); } @@ -192,28 +188,34 @@ return false; } +// Determine if an AllocationInst instruction escapes from the function it is +// contained in. If it does not escape, there is no way for another function to +// mod/ref it. We do this by looking at its uses and determining if the uses +// can escape (recursively). static bool AddressMightEscape(const Value *V) { for (Value::use_const_iterator UI = V->use_begin(), E = V->use_end(); UI != E; ++UI) { const Instruction *I = cast(*UI); switch (I->getOpcode()) { -case Instruction::Load: break; +case Instruction::Load: + break; //next use. case Instruction::Store: if (I->getOperand(0) == V) return true; // Escapes if the pointer is stored. - break; + break; // next use. case Instruction::GetElementPtr: - if (AddressMightEscape(I)) return true; - break; -case Instruction::Cast: + if (AddressMightEscape(I)) +return true; +case Instruction::BitCast: if (!isa(I->getType())) return true; - if (AddressMightEscape(I)) return true; - break; + if (AddressMightEscape(I)) +return true; + break; // next use case Instruction::Ret: // If returned, the address will escape to calling functions, but no // callees could modify it. - break; + break; // next use default: return true; } @@ -257,12 +259,10 @@ const Value *V2, unsigned V2Size) { // Strip off any constant expression casts if they exist if (const ConstantExpr *CE = dyn_cast(V1)) -if (CE->getOpcode() == Instruction::Cast && -isa(CE->getOperand(0)->getType())) +if (CE->isCast() && isa(CE->getOperand(0)->getType())) V1 = CE->getOperand(0); if (const ConstantExpr *CE = dyn_cast(V2)) -if (CE->getOpcode() == Instruction::Cast && -isa(CE->getOperand(0)->getType())) +if (CE->isCast() && isa(CE->getOperand(0)->getType())) V2 = CE->getOperand(0); // Are we checking for alias of the same value? @@ -273,10 +273,10 @@ return NoAlias; // Scalars cannot alias each other // Strip off cast instructions... - if (const Instruction *I = dyn_cast(V1)) + if (const BitCastInst *I = dyn_cast(V1)) if (isa(I->getOperand(0)->getType())) return alias(I->getOperand(0), V1Size, V2, V2Size); - if (const Instruction *I = dyn_cast(V2)) + if (const BitCastInst *I = dyn_cast(V2)
[llvm-commits] CVS: llvm/lib/Analysis/BasicAliasAnalysis.cpp ScalarEvolution.cpp
Changes in directory llvm/lib/Analysis: BasicAliasAnalysis.cpp updated: 1.82 -> 1.83 ScalarEvolution.cpp updated: 1.49 -> 1.50 --- Log message: s|llvm/Support/Visibility.h|llvm/Support/Compiler.h| --- Diffs of the changes: (+2 -2) BasicAliasAnalysis.cpp |2 +- ScalarEvolution.cpp|2 +- 2 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Analysis/BasicAliasAnalysis.cpp diff -u llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.82 llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.83 --- llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.82 Wed Jun 28 18:17:23 2006 +++ llvm/lib/Analysis/BasicAliasAnalysis.cppSun Aug 27 07:54:01 2006 @@ -23,7 +23,7 @@ #include "llvm/Pass.h" #include "llvm/Target/TargetData.h" #include "llvm/Support/GetElementPtrTypeIterator.h" -#include "llvm/Support/Visibility.h" +#include "llvm/Support/Compiler.h" #include using namespace llvm; Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.49 llvm/lib/Analysis/ScalarEvolution.cpp:1.50 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.49 Wed Jun 28 18:17:23 2006 +++ llvm/lib/Analysis/ScalarEvolution.cpp Sun Aug 27 07:54:01 2006 @@ -72,7 +72,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/ConstantRange.h" #include "llvm/Support/InstIterator.h" -#include "llvm/Support/Visibility.h" +#include "llvm/Support/Compiler.h" #include "llvm/ADT/Statistic.h" #include #include ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Analysis/BasicAliasAnalysis.cpp ScalarEvolution.cpp
Changes in directory llvm/lib/Analysis: BasicAliasAnalysis.cpp updated: 1.81 -> 1.82 ScalarEvolution.cpp updated: 1.48 -> 1.49 --- Log message: Use hidden visibility to make symbols in an anonymous namespace get dropped. This shrinks libllvmgcc.dylib another 67K --- Diffs of the changes: (+7 -5) BasicAliasAnalysis.cpp |5 +++-- ScalarEvolution.cpp|7 --- 2 files changed, 7 insertions(+), 5 deletions(-) Index: llvm/lib/Analysis/BasicAliasAnalysis.cpp diff -u llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.81 llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.82 --- llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.81 Wed Jun 7 17:00:26 2006 +++ llvm/lib/Analysis/BasicAliasAnalysis.cppWed Jun 28 18:17:23 2006 @@ -23,6 +23,7 @@ #include "llvm/Pass.h" #include "llvm/Target/TargetData.h" #include "llvm/Support/GetElementPtrTypeIterator.h" +#include "llvm/Support/Visibility.h" #include using namespace llvm; @@ -32,7 +33,7 @@ /// implementations, in that it does not chain to a previous analysis. As /// such it doesn't follow many of the rules that other alias analyses must. /// - struct NoAA : public ImmutablePass, public AliasAnalysis { + struct VISIBILITY_HIDDEN NoAA : public ImmutablePass, public AliasAnalysis { virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); } @@ -84,7 +85,7 @@ /// BasicAliasAnalysis - This is the default alias analysis implementation. /// Because it doesn't chain to a previous alias analysis (like -no-aa), it /// derives from the NoAA class. - struct BasicAliasAnalysis : public NoAA { + struct VISIBILITY_HIDDEN BasicAliasAnalysis : public NoAA { AliasResult alias(const Value *V1, unsigned V1Size, const Value *V2, unsigned V2Size); Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.48 llvm/lib/Analysis/ScalarEvolution.cpp:1.49 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.48 Wed Apr 26 13:34:07 2006 +++ llvm/lib/Analysis/ScalarEvolution.cpp Wed Jun 28 18:17:23 2006 @@ -69,9 +69,10 @@ #include "llvm/Assembly/Writer.h" #include "llvm/Transforms/Scalar.h" #include "llvm/Support/CFG.h" +#include "llvm/Support/CommandLine.h" #include "llvm/Support/ConstantRange.h" #include "llvm/Support/InstIterator.h" -#include "llvm/Support/CommandLine.h" +#include "llvm/Support/Visibility.h" #include "llvm/ADT/Statistic.h" #include #include @@ -393,7 +394,7 @@ /// SCEVComplexityCompare - Return true if the complexity of the LHS is less /// than the complexity of the RHS. This comparator is used to canonicalize /// expressions. - struct SCEVComplexityCompare { + struct VISIBILITY_HIDDEN SCEVComplexityCompare { bool operator()(SCEV *LHS, SCEV *RHS) { return LHS->getSCEVType() < RHS->getSCEVType(); } @@ -1062,7 +1063,7 @@ /// evolution code. /// namespace { - struct ScalarEvolutionsImpl { + struct VISIBILITY_HIDDEN ScalarEvolutionsImpl { /// F - The function we are analyzing. /// Function &F; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits