OSDN Git Service

Do not apply the transformation if the target does not support DestTy natively.
authorDevang Patel <dpatel@apple.com>
Wed, 27 Aug 2008 20:55:23 +0000 (20:55 +0000)
committerDevang Patel <dpatel@apple.com>
Wed, 27 Aug 2008 20:55:23 +0000 (20:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55433 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopStrengthReduce.cpp

index 19095a6..9c1a953 100644 (file)
@@ -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;