<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hi</p>
<p>I am trying to write a llvm pass to set a call instruction target
function to a different target. The call instruction looks like
following:</p>
<div style="color: #000000;background-color: #ffffff;font-family: 'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback';font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;"><div><span style="color: #000000;">notail </span><span style="color: #0000ff;">call</span><span style="color: #000000;"> </span><span style="color: #0000ff;">void</span><span style="color: #000000;"> </span><span style="color: #0000ff;">bitcast</span><span style="color: #000000;"> (</span><span style="color: #0000ff;">void</span><span style="color: #000000;"> (</span><span style="color: #0000ff;">i64</span><span style="color: #000000;">, </span><span style="color: #0000ff;">i64</span><span style="color: #000000;">, </span><span style="color: #0000ff;">i64</span><span style="color: #000000;">)* </span><span style="color: #0000ff;">@monitor</span><span style="color: #000000;"> </span><span style="color: #0000ff;">to</span><span style="color: #000000;"> </span><span style="color: #0000ff;">void</span><span style="color: #000000;"> (</span><span style="color: #0000ff;">i64</span><span style="color: #000000;">, </span><span style="color: #0000ff;">i8*</span><span style="color: #000000;">, </span><span style="color: #0000ff;">i64</span><span style="color: #000000;">)*)(</span><span style="color: #0000ff;">i64</span><span style="color: #000000;"> </span><span style="color: #09885a;">2193551</span><span style="color: #000000;">, </span><span style="color: #0000ff;">i8*</span><span style="color: #000000;"> </span><span style="color: #0000ff;">bitcast</span><span style="color: #000000;"> (</span><span style="color: #0000ff;">i32</span><span style="color: #000000;"> (...)** </span><span style="color: #0000ff;">@qcmp</span><span style="color: #000000;"> </span><span style="color: #0000ff;">to</span><span style="color: #000000;"> </span><span style="color: #0000ff;">i8*</span><span style="color: #000000;">), </span><span style="color: #0000ff;">i64</span><span style="color: #000000;"> </span><span style="color: #0000ff;">%18</span><span style="color: #000000;">), !dbg </span><span style="color: #001080;">!25563</span></div></div>
<p>I want to replace target **monitor** to a different target
**monitorA**. The callInst->setCalledFunction entirely remove
the bitcast operator. The bitcast->setOperand(0, F) throws
assert error. What should be the solution?</p>
<p>Note: I am working on clang version 7.0.0<br>
</p>
<div class="moz-signature">-- <br>
Email Signature
<title>Email Signature</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<table style="width: 410px; font-size: 10pt; font-family: Arial,
sans-serif;" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="font-size: 10pt; font-family: Courier New,
monospace; border-right: 1px solid; border-right-color:
#0079ac; width: 105px; padding-right: 10px;
vertical-align: top; text-align: center;" rowspan="6"
valign="top" align="center"> <img alt="photograph"
style="border:0; height:auto; width:132px"
src="http://ww2.cs.fsu.edu/~khandake/FSU_seal.png"
width="132" border="0"> </td>
<td>
<table cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="font-size: 10pt; color:#0079ac;
font-family: Courier New, monospace; width: 305px;
padding-bottom: 5px; padding-left: 10px;
vertical-align: top; line-height:25px;"
valign="top"> <strong><span style="font-size:
14pt; font-family: Courier New, monospace;
color:#0079ac;">Mustakimur R. Khandaker<br>
</span></strong> <span style="font-family:
Courier New, monospace; font-size:10pt;
color:#444444;">Graduate Research Assistant</span>
</td>
</tr>
<tr>
<td style="font-size: 10pt; color:#444444;
font-family: Courier New, monospace;
padding-bottom: 5px; padding-top: 5px;
padding-left: 10px; vertical-align: top;"
valign="top"> <span><span style="color: #0079ac;"><strong>p:</strong></span><span
style="font-size: 10pt; font-family: Courier
New, monospace; color:#444444;"> +1
850-999-3635<br>
</span></span> <span><span style="color:
#0079ac;"><strong>e:</strong></span><span
style="font-size: 10pt; font-family: Courier
New, monospace; color:#444444;">
<a class="moz-txt-link-abbreviated" href="mailto:mrk15e@my.fsu.edu">mrk15e@my.fsu.edu</a></span></span> </td>
</tr>
<tr>
<td style="font-size: 10pt; font-family: Courier
New, monospace; padding-bottom: 5px; padding-top:
5px; padding-left: 10px; vertical-align: top;
color: #0079ac;" valign="top"> <span
style="font-size: 10pt; font-family: Courier
New, monospace; color: #0079ac;">LOV-170,
Department of Computer Science<span><br>
</span></span> <span style="font-size: 10pt;
font-family: Courier New, monospace; color:
#0079ac;">Florida State University</span> </td>
</tr>
<tr>
<td style="font-size: 10pt; font-family: Courier
New, monospace; padding-bottom: 5px; padding-top:
5px; padding-left: 10px; vertical-align: top;
color: #0079ac;" valign="top"> <a
href="http://ww2.cs.fsu.edu/~khandake/"
target="_blank" rel="noopener"
style="text-decoration:none;"><span
style="font-size: 10pt; font-family: Courier
New, monospace; color: #4353a7;">ww2.cs.fsu.edu/~khandake/</span></a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>