diff options
author | Devang Patel <dpatel@apple.com> | 2008-08-27 20:55:23 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2008-08-27 20:55:23 +0000 |
commit | 18bb2788a0edc0ec1c373465429743892c8d5fbe (patch) | |
tree | 01fe0cb933937759d7679a748cf58eb72baf0d42 /lib/Transforms/Scalar/LoopStrengthReduce.cpp | |
parent | ff5d06d797f2423877aea61304e0089353964131 (diff) |
Do not apply the transformation if the target does not support DestTy natively.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55433 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 19095a6acf..9c1a95331e 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -1735,8 +1735,15 @@ void LoopStrengthReduce::OptimizeShadowIV(Loop *L) { DestTy = UCast->getDestTy(); else if (SIToFPInst *SCast = dyn_cast<SIToFPInst>(CandidateUI->User)) DestTy = SCast->getDestTy(); - if (!DestTy) continue; - + if (!DestTy) continue; + + if (TLI) { + /* If target does not support DestTy natively then do not apply + this transformation. */ + MVT DVT = TLI->getValueType(DestTy); + if (!TLI->isTypeLegal(DVT)) continue; + } + PHINode *PH = dyn_cast<PHINode>(ShadowUse->getOperand(0)); if (!PH) continue; if (PH->getNumIncomingValues() != 2) continue; |