[LLVMdev] ConstantRange::sub

Xi Wang xi.wang at gmail.com
Mon Jun 20 23:09:15 PDT 2011


Hi,

I have a question about ConstantRange::sub(const ConstantRange &Other) at lib/Support/ConstantRange.cpp:524.  The code computes the new bounds as follows.

 APInt NewLower = getLower() - Other.getLower();
 APInt NewUpper = getUpper() - Other.getUpper() + 1;

Could someone explain this to me?  I was expecting something like

 APInt NewLower = getLower() - Other.getUpper() + 1;
 APInt NewUpper = getUpper() - Other.getLower();

Thanks.

- xi




More information about the llvm-dev mailing list