<div dir="ltr">While improving ADCE, i notice that for <div><br></div><div><br></div><div><div>declare i32 @strlen(i8*) readnone</div><div><br></div><div>define i32 @test() {</div><div><span class="" style="white-space:pre">   </span>; invoke of pure function should not be deleted!</div><div><span class="" style="white-space:pre">   </span>invoke i32 @strlen( i8* null ) readnone</div><div><span class="" style="white-space:pre">                    </span>to label %Cont unwind label %Other<span class="" style="white-space:pre">                </span>; <i32>:1 [#uses=0]</div><div><br></div><div>Cont:<span class="" style="white-space:pre">            </span>; preds = %0</div><div><span class="" style="white-space:pre">       </span>ret i32 0</div><div><br></div><div>Other:<span class="" style="white-space:pre">           </span>; preds = %0</div><div>         %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0</div><div>                  cleanup</div><div><span class="" style="white-space:pre">        </span>ret i32 1</div><div>}</div><div><br></div><div>declare i32 @__gxx_personality_v0(...)</div></div><div><br></div><div>Instruction:: mayThrow returns false for the invoke. </div><div><br></div><div>This is because ...</div><div><br></div><div><div><br></div><div> bool Instruction::mayThrow() const {</div><div>   if (const CallInst *CI = dyn_cast<CallInst>(this))</div><div>     return !CI->doesNotThrow();</div><div>   return isa<ResumeInst>(this);</div><div> }</div></div><div><br></div><div>CallInst != InvokeInst, and invokeinst is not derived from callinst.</div><div><br></div><div>Am I missing something, or should this function also have:<br><br></div><div> if (const InvokeInst *II = dyn_cast<InvokeInst>(this))</div><div> return !II->doesNotThrow();<br></div><div><br></div><div>?<br><br></div><div><br></div></div>