From 6144085c29b31e8e43122920a5bfba3d7b77e7ae Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Sun, 11 Jul 2021 17:00:14 -0700 Subject: [PATCH] [IndVars] Don't widen pointers in WidenIV::getWideRecurrence It's not a reasonable transform, and calling getSignExtendExpr() on a pointer hits an assertion. --- llvm/lib/Transforms/Utils/SimplifyIndVar.cpp | 2 +- llvm/test/Transforms/IndVarSimplify/signed-trip-count.ll | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp index ff60667..bd30be0 100644 --- a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp @@ -1359,7 +1359,7 @@ WidenIV::getExtendedOperandRecurrence(WidenIV::NarrowIVDefUse DU) { /// so, return the extended recurrence and the kind of extension used. Otherwise /// return {nullptr, Unknown}. WidenIV::WidenedRecTy WidenIV::getWideRecurrence(WidenIV::NarrowIVDefUse DU) { - if (!SE->isSCEVable(DU.NarrowUse->getType())) + if (!DU.NarrowUse->getType()->isIntegerTy()) return {nullptr, Unknown}; const SCEV *NarrowExpr = SE->getSCEV(DU.NarrowUse); diff --git a/llvm/test/Transforms/IndVarSimplify/signed-trip-count.ll b/llvm/test/Transforms/IndVarSimplify/signed-trip-count.ll index 41968ac..f660ea5 100644 --- a/llvm/test/Transforms/IndVarSimplify/signed-trip-count.ll +++ b/llvm/test/Transforms/IndVarSimplify/signed-trip-count.ll @@ -1,7 +1,7 @@ ; RUN: opt < %s -indvars -S | FileCheck %s ; Provide legal integer types. -target datalayout = "n8:16:32:64" +target datalayout = "e-p:32:32:32-n8:16:32:64" define void @foo(i64* nocapture %x, i32 %n) nounwind { -- 2.7.4