diff options
| author | Eric Christopher <echristo@apple.com> | 2011-08-23 20:11:10 +0000 | 
|---|---|---|
| committer | Eric Christopher <echristo@apple.com> | 2011-08-23 20:11:10 +0000 | 
| commit | 7bc78f692c15916727e3ef2b74af1d38306c9d7e (patch) | |
| tree | bd5ab9755d322142c7c1f9e6eb0c62ad092fb8ac /llvm/lib/Analysis | |
| parent | 6763e387364eb3fb9376bc54348b924ec85a17b6 (diff) | |
| download | bcm5719-llvm-7bc78f692c15916727e3ef2b74af1d38306c9d7e.tar.gz bcm5719-llvm-7bc78f692c15916727e3ef2b74af1d38306c9d7e.zip  | |
Revert "Address Duncan's CR request:"
This reverts commit 20a05be15ea5271ab6185b83200fa88263362400. (svn rev 138340)
Conflicts:
	test/Transforms/InstCombine/bitcast.ll
llvm-svn: 138366
Diffstat (limited to 'llvm/lib/Analysis')
| -rw-r--r-- | llvm/lib/Analysis/ConstantFolding.cpp | 13 | 
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index 0eacaf80378..7a8c703040c 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -45,9 +45,15 @@ using namespace llvm;  /// ConstantExpr if unfoldable.  static Constant *FoldBitCast(Constant *C, Type *DestTy,                               const TargetData &TD) { -  // Catch the obvious splat cases. -  if (C->isNullValue()) return Constant::getNullValue(DestTy); -  if (C->isAllOnesValue()) return Constant::getAllOnesValue(DestTy); +   +  ConstantVector *CV = dyn_cast<ConstantVector>(C); +  IntegerType *IntVTy = dyn_cast<IntegerType>(DestTy); +  // When casting vectors to scalar integers, catch the +  // obvious splat cases. +  if (IntVTy && CV) { +    if (CV->isNullValue()) return ConstantInt::getNullValue(IntVTy); +    if (CV->isAllOnesValue()) return ConstantInt::getAllOnesValue(IntVTy); +  }    // The code below only handles casts to vectors currently.    VectorType *DestVTy = dyn_cast<VectorType>(DestTy); @@ -62,7 +68,6 @@ static Constant *FoldBitCast(Constant *C, Type *DestTy,    }    // If this is a bitcast from constant vector -> vector, fold it. -  ConstantVector *CV = dyn_cast<ConstantVector>(C);    if (CV == 0)      return ConstantExpr::getBitCast(C, DestTy);  | 

