Make RequiresTypeConversion canonicalize the types before calling the
authorDan Gohman <gohman@apple.com>
Fri, 1 May 2009 17:07:43 +0000 (17:07 +0000)
committerDan Gohman <gohman@apple.com>
Fri, 1 May 2009 17:07:43 +0000 (17:07 +0000)
target hooks canLosslesslyBitCastTo and isTruncateFree. This allows
targets to avoid worrying about handling all combinations of integer
and pointer types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70555 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopStrengthReduce.cpp

index 7ba7ce8d0eb46125bb11583d901f41e615d301c6..29acfe8506e8730a4afbc2ac230263497d326d0c 100644 (file)
@@ -1170,7 +1170,9 @@ bool LoopStrengthReduce::RequiresTypeConversion(const Type *Ty1,
                                                 const Type *Ty2) {
   if (Ty1 == Ty2)
     return false;
-  if (SE->getEffectiveSCEVType(Ty1) == SE->getEffectiveSCEVType(Ty2))
+  Ty1 = SE->getEffectiveSCEVType(Ty1);
+  Ty2 = SE->getEffectiveSCEVType(Ty2);
+  if (Ty1 == Ty2)
     return false;
   if (Ty1->canLosslesslyBitCastTo(Ty2))
     return false;