<span>Hi,</span><br><br><span>Pondering the code for StrongSIV and trying to write my own, I find I have many questions.</span><div>In this code, for example,<br><br><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:40px;border-top-style:none;border-right-style:none;border-bottom-style:none;border-left-style:none;border-width:initial;border-color:initial;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">

<font face="'courier new', monospace"><b> if (isa<SCEVConstant>(delta) && isa<SCEVConstant>(srcCoeff)) {<br>   const SCEVConstant *constDelta = cast<SCEVConstant>(delta);<br>   const SCEVConstant *constCoeff = cast<SCEVConstant>(srcCoeff);<br>

   APInt distance, remainder;<br>   APInt::sdivrem(constDelta->getValue()->getValue(),<br>                  constCoeff->getValue()->getValue(),<br>                  distance, remainder);<br><br></b></font></blockquote>

<div>Generally, this makes sense. But reading the documentation for <font face="'courier new', monospace">APInt</font>, it sounds like I must somehow ensure that the representations of<font face="'courier new', monospace">constDelta</font> and <font face="'courier new', monospace">constCoeff</font> are the same length. Are they going to be automatically, or do I need to do something to check?</div>

<div><br></div><div>How do we set the lengths of distance and remainder? Or are they set by the <font face="'courier new', monospace">sdivrem</font> operations?</div><div><br></div></div><div>If I want to divide distance by 2, how do I create an <font face="'courier new', monospace">APInt</font> with the value of 2 and the correct length?</div>

<div>I've seen you create an SCEV with value 2. Should I do that each time?</div><div><br></div><div>I'm working on writing out Banerjee and Wolfe's exact SIV test and the hardest part seems to be specifying the type of all the various numbers. I'm manipulating many constants (0, 1, and various SCEVConstants) and doing arithmetic with them. I assume it's better (quicker, smaller) to use APInts for everything.</div>

<div><br></div><div>Any general advice?</div><div><br></div><div>Thanks,</div><div>Preston</div><div><br></div>