Hi,<br><br>I'm reading the code in CBackend.cpp and found some wired chunk in <br>void CWriter::printConstant(Constant *CPV)<br><br> 938 if (ConstantInt *CI = dyn_cast<ConstantInt>(CPV)) {<br> 939 const Type* Ty = CI->getType(); <br>
940 if (Ty == Type::Int1Ty)<br> 941 Out << (CI->getZExtValue() ? '1' : '0');<br> 942 else if (Ty == Type::Int32Ty) <br> 943 Out << CI->getZExtValue() << 'u';<br>
944 else if (Ty->getPrimitiveSizeInBits() > 32)<br> 945 Out << CI->getZExtValue() << "ull";<br> 946 else {<br> 947 Out << "((";<br> 948 printSimpleType(Out, Ty, false) << ')';<br>
949 if (CI->isMinValue(true))<br> 950 Out << CI->getZExtValue() << 'u';<br> 951 else<br> 952 Out << CI->getSExtValue();<br> 953 Out << ')';<br>
954 } <br> 955 return;<br> 956 }<br><br><br>In line 946 to line 954, the "else" branch is for bitwidth from 2 to 31,<br>the question is why only for CI is MinValue(true), it is zexted, otherwise sexted.<br>
I'm confused by that logic. Is there some special reason?<br> <br><br><br>Thanks,<br>Sheng.<br><br><br>