Index: lib/Analysis/ScalarEvolution.cpp =================================================================== --- lib/Analysis/ScalarEvolution.cpp +++ lib/Analysis/ScalarEvolution.cpp @@ -114,6 +114,12 @@ VerifySCEV("verify-scev", cl::desc("Verify ScalarEvolution's backedge taken counts (slow)")); +static cl::opt +PrintConstantRanges("scalar-evolution-print-constant-ranges", cl::Hidden, + cl::desc("Print constant range information when printing " + "SCEVs via -analysis"), + cl::init(false)); + INITIALIZE_PASS_BEGIN(ScalarEvolution, "scalar-evolution", "Scalar Evolution Analysis", false, true) INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker) @@ -8150,6 +8156,12 @@ OS << " --> "; const SCEV *SV = SE.getSCEV(&*I); SV->print(OS); + if (PrintConstantRanges && !isa(SV)) { + OS << " U: "; + SE.getUnsignedRange(SV).print(OS); + OS << " S: "; + SE.getSignedRange(SV).print(OS); + } const Loop *L = LI->getLoopFor((*I).getParent()); @@ -8157,6 +8169,12 @@ if (AtUse != SV) { OS << " --> "; AtUse->print(OS); + if (PrintConstantRanges && !isa(AtUse)) { + OS << " U: "; + SE.getUnsignedRange(AtUse).print(OS); + OS << " S: "; + SE.getSignedRange(AtUse).print(OS); + } } if (L) {