title: Not able to erase LLVM instruction
body: <p>I have following LLVM snippet.</p>
  
  <pre><code>invoke.cont22:                                    ; preds = %invoke.cont14
    %coerce.dive34 = getelementptr %"class.thrust::iterator_adaptor.33"* %coerce.dive33, i32 0, i32 0
    %8 = load i32** %coerce.dive34
    %coerce.dive39 = getelementptr %"class.thrust::iterator_adaptor.33"* %coerce.dive38, i32 0, i32 0
    %9 = load i32** %coerce.dive39
    %coerce.dive44 = getelementptr %"class.thrust::iterator_adaptor.33"* %coerce.dive43, i32 0, i32 0
    %10 = load i32** %coerce.dive44
    %coerce.dive45 = getelementptr %struct.my_functor* %agg.tmp29, i32 0, i32 0
    %11 = load i32* %coerce.dive45
    %call47 = invoke i32* @_ZN6thrust9transformINS_6detail15normal_iteratorINS_10device_ptrIiEEEES5_10my_functorEET0_T_S8_S7_T1_(i32* %8, i32* %9, i32* %10, i32 %11)
            to label %invoke.cont46 unwind label %lpad
  </code></pre>
  
  <p>From this I want to erase</p>
  
  <pre><code>%call47 = invoke i32* @_ZN6thrust9transformINS_6detail15normal_iteratorINS_10device_ptrIiEEEES5_10my_functorEET0_T_S8_S7_T1_(i32* %8, i32* %9, i32* %10, i32 %11)
  </code></pre>
  
  <p>But when I call eraseFromParent() on this instruction it is throwing following error: </p>
  
  <blockquote>
    <p>Basic Block in function 'main' does not have terminator!</p>
  </blockquote>
  
  <p>How do I remove it properly?</p>