[llvm-dev] SCEV cannot compute the trip count of Simple loop
Rai, Deepali via llvm-dev
llvm-dev at lists.llvm.org
Mon Sep 19 05:37:29 PDT 2016
Thanks Sanjoy for the clarification. Can you please share the link to blog for systemic issues in SCEV that you were mentioning.
From: Sanjoy Das [mailto:sanjoy at playingwithpointers.com]
Sent: Saturday, September 17, 2016 1:58 AM
To: Philip Pfaffe
Cc: Rai, Deepali; llvm-dev at lists.llvm.org
Subject: Re: [llvm-dev] SCEV cannot compute the trip count of Simple loop
SCEV reports the backedge taken count as "((-1 * (sext i32 (3 + %x) to i64))<nsw> + ((sext i32 (3 + %x) to i64) smax (sext i32 (6 + %x) to i64)))", so symbolically it does have an answer.
Ideally SCEV should be able to exploit <nsw> on (3 + %x) and (6 + %x) to fold the expression above to "3", but due to some systemic issues SCEV can't exploit <nsw> as aggressively as we should.
Without exploiting <nsw> the trip count is 2^32, which does not fit in an 32 bit unsigned integer. This is why getSmallConstantTripCount returns 0.
Does this answer your question?
More information about the llvm-dev