[llvm-commits] [llvm] r55433 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Devang Patel dpatel at apple.com
Wed Aug 27 13:55:23 PDT 2008


Author: dpatel
Date: Wed Aug 27 15:55:23 2008
New Revision: 55433

URL: http://llvm.org/viewvc/llvm-project?rev=55433&view=rev
Log:
Do not apply the transformation if the target does not support DestTy natively.

Modified:
    llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=55433&r1=55432&r2=55433&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Wed Aug 27 15:55:23 2008
@@ -1735,8 +1735,15 @@
         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;





More information about the llvm-commits mailing list