From caadc93f7b3e950c16ff6cd497baffe7cadc1477 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 28 Feb 2003 19:21:40 +0000 Subject: [PATCH] Fix bug: LICM/2003-02-28-PromoteDifferentType.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5675 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/LICM.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp index 534a073abe1..334ede39d98 100644 --- a/lib/Transforms/Scalar/LICM.cpp +++ b/lib/Transforms/Scalar/LICM.cpp @@ -487,9 +487,15 @@ void LICM::findPromotableValuesInLoop( bool PointerOk = true; for (std::set::const_iterator I =CurLBI->LoadedPointers.begin(), - E = CurLBI->LoadedPointers.end(); I != E; ++I) - if (AA->alias(V, ~0, *I, ~0) == AliasAnalysis::MayAlias) { + E = CurLBI->LoadedPointers.end(); PointerOk && I != E; ++I) + switch (AA->alias(V, ~0, *I, ~0)) { + case AliasAnalysis::MustAlias: + if (V->getType() != (*I)->getType()) + PointerOk = false; + break; + case AliasAnalysis::MayAlias: PointerOk = false; + case AliasAnalysis::NoAlias: break; }