<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jan 16, 2009, at 9:55 AM, Evan Cheng wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Devang,<div><br></div><div>Is this the right fix or just a work around? Should llvm-gcc be generating these invalid declare intrinsics in the first place? It seems like this will increase compile time. It could be noticeable when it's in fastisel mode, no?</div><div><br></div><div><span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 11px; ">+ DIDescriptor DI(GV);<br>+ // Check current version. Allow Version6 for now.<br>+ unsigned Version = DI.getVersion();<br>+ if (Version != DIDescriptor::Version7 && Version != DIDescriptor::Version6)<br>+ return false;</span></div><div><font class="Apple-style-span" face="-webkit-monospace" size="3"><span class="Apple-style-span" style="font-size: 11px;"><br></span></font></div><div><font class="Apple-style-span" face="-webkit-monospace" size="3"><span class="Apple-style-span" style="font-size: 11px;">I know DIDescriptor is light weight. But is it necessary to create the descriptor just to check the version number? Can you add a helper function to DebugInfo that examines GV and returns its corresponding version?</span></font></div></div></blockquote><div><br></div><div>This should be cheap. DIDescriptor just holds the pointer to the global. This should inline into:</div><div><br></div><div><div> unsigned getVersion() const {</div><div> return getUnsignedField(0) & VersionMask /*VersionMask=0xffff0000*/;</div><div> }</div><div><br></div><div>-></div><div><br></div><div><div> unsigned getUnsignedField(unsigned Elt) const {</div><div> return (unsigned)getUInt64Field(Elt);</div><div> }</div><div><br></div><div>-></div><div><br></div><div><div> uint64_t getUInt64Field(unsigned Elt) const;</div><div><br></div><div>-></div><div><br></div><div><div>uint64_t DIDescriptor::getUInt64Field(unsigned Elt) const {</div><div> if (GV == 0) return 0;</div><div> Constant *C = GV->getInitializer();</div><div> if (C == 0 || Elt >= C->getNumOperands())</div><div> return 0;</div><div> if (ConstantInt *CI = dyn_cast<ConstantInt>(C->getOperand(Elt)))</div><div> return CI->getZExtValue();</div><div> return 0;</div><div>}</div><div><br></div><div>Which is pretty much what you have to do in any case. DIDescriptor shouldn't add over head here as long as it isn't "new"d.</div><div><br></div><div>-Chris</div></div></div></div></div></div></body></html>