From 7abe1944aedf53318ea65e6e1c31d4a5dd82603e Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Wed, 27 Aug 2008 20:55:23 +0000 Subject: [PATCH] Do not apply the transformation if the target does not support DestTy natively. llvm-svn: 55433 --- lib/Transforms/Scalar/LoopStrengthReduce.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 19095a6acff..9c1a95331e3 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(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(ShadowUse->getOperand(0)); if (!PH) continue; if (PH->getNumIncomingValues() != 2) continue;