BBVectorize: isa/cast cleanup in getInstructionTypes

Profiling suggests that getInstructionTypes is performance-sensitive,
this cleans up some double-casting in that function in favor of
using dyn_cast.

No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174857 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Hal Finkel 2013-02-11 05:29:48 +00:00
parent da20ea696d
commit 3fc1e4aa15

View File

@ -466,18 +466,18 @@ namespace {
static inline void getInstructionTypes(Instruction *I, static inline void getInstructionTypes(Instruction *I,
Type *&T1, Type *&T2) { Type *&T1, Type *&T2) {
if (isa<StoreInst>(I)) { if (StoreInst *SI = dyn_cast<StoreInst>(I)) {
// For stores, it is the value type, not the pointer type that matters // For stores, it is the value type, not the pointer type that matters
// because the value is what will come from a vector register. // because the value is what will come from a vector register.
Value *IVal = cast<StoreInst>(I)->getValueOperand(); Value *IVal = SI->getValueOperand();
T1 = IVal->getType(); T1 = IVal->getType();
} else { } else {
T1 = I->getType(); T1 = I->getType();
} }
if (I->isCast()) if (CastInst *CI = dyn_cast<CastInst>(I))
T2 = cast<CastInst>(I)->getSrcTy(); T2 = CI->getSrcTy();
else else
T2 = T1; T2 = T1;