diff options
| author | Hal Finkel <hfinkel@anl.gov> | 2014-02-25 20:51:50 +0000 |
|---|---|---|
| committer | Hal Finkel <hfinkel@anl.gov> | 2014-02-25 20:51:50 +0000 |
| commit | 22304046c78a2509a21ddf992d22108871822856 (patch) | |
| tree | d922a98d14009c750069b39a2daa2631c86d7e42 /llvm/lib/Target/PowerPC/PPCCTRLoops.cpp | |
| parent | 449d3b74931b44619594eb4d819076168c671632 (diff) | |
| download | bcm5719-llvm-22304046c78a2509a21ddf992d22108871822856.tar.gz bcm5719-llvm-22304046c78a2509a21ddf992d22108871822856.zip | |
Account for 128-bit integer operations in PPCCTRLoops
We need to abort the formation of counter-register-based loops where there are
128-bit integer operations that might become function calls.
llvm-svn: 202192
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCCTRLoops.cpp')
| -rw-r--r-- | llvm/lib/Target/PowerPC/PPCCTRLoops.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp b/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp index 770afbecbd3..fad48c54339 100644 --- a/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp +++ b/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp @@ -187,6 +187,13 @@ bool PPCCTRLoops::runOnFunction(Function &F) { return MadeChange; } +static bool isLargeIntegerTy(bool Is32Bit, Type *Ty) { + if (IntegerType *ITy = dyn_cast<IntegerType>(Ty)) + return ITy->getBitWidth() > (Is32Bit ? 32 : 64); + + return false; +} + bool PPCCTRLoops::mightUseCTR(const Triple &TT, BasicBlock *BB) { for (BasicBlock::iterator J = BB->begin(), JE = BB->end(); J != JE; ++J) { @@ -353,13 +360,11 @@ bool PPCCTRLoops::mightUseCTR(const Triple &TT, BasicBlock *BB) { CastInst *CI = cast<CastInst>(J); if (CI->getSrcTy()->getScalarType()->isPPC_FP128Ty() || CI->getDestTy()->getScalarType()->isPPC_FP128Ty() || - (TT.isArch32Bit() && - (CI->getSrcTy()->getScalarType()->isIntegerTy(64) || - CI->getDestTy()->getScalarType()->isIntegerTy(64)) - )) + isLargeIntegerTy(TT.isArch32Bit(), CI->getSrcTy()->getScalarType()) || + isLargeIntegerTy(TT.isArch32Bit(), CI->getDestTy()->getScalarType())) return true; - } else if (TT.isArch32Bit() && - J->getType()->getScalarType()->isIntegerTy(64) && + } else if (isLargeIntegerTy(TT.isArch32Bit(), + J->getType()->getScalarType()) && (J->getOpcode() == Instruction::UDiv || J->getOpcode() == Instruction::SDiv || J->getOpcode() == Instruction::URem || |

