<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/66461>66461</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Is there a way to prevent non-constant values from being optimized?
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
codetronik
</td>
</tr>
</table>
<pre>
I'm currently making llvm pass.
When compiling, the cpp application is optimized by the various passes(Simple Register Coalescing pass and etc) behind my pass, resulting in a crash.
The cause is the code below.
replaceUsesOfWith(Constant, Non-constant);
Non-constant has an address Value* assigned as malloc().
To prevent optimization, the following attempts failed.
1. Add metadata per inst
2. Add volatile (true) per inst
3. 3. addFnAttr(llvm::Attribute::OptimizeNone);
Is there any other way I can try?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxkU01vozwQ_jXmMioiJoRw4JC2itRLK73v7vY84Enw1tjIMyTK_vqVSfqxuxfAzMPM88Egsz16olZV96p6zHCWIcS2D4YkBm_fsi6YS_ukdD1CP8dIXtwFRnyz_gjOnUaYkDlXxaMqdq8DeejDOFln_VHpB5CBoJ8mwGlytkexwYNlCJPY0f4iA91lwZww2jDz0oxY6e3_dpwcwX90tCwU4SGgI-7T1IQB9AZIeqUb6Giw3sB4WSppaiSenSSs9YDQR-ThRvF6_ZZo4cyUyCwcgyHoyIXzDRdpctjTdyZ-ObxaGZTePgTPgl7SiOfg7_qPc6PK-6_9v1ZhwEQX0JhIzPAD3UxK7-DmvQFkGNG50Cu9Vbr5k2mAKdKJvLybtpj47u0hOBfOSSmK0DgJwwGtI3NrssphZwyMJGhQECaKYD3Ltaqv1VNwKNYRKL2VmMg1fwHLHMo8Kdj7nUhUepuiV-VOlbv0wnaz0PX4cov2OXj615inxe5IgP4CIT3CGS_wBD16kHhR5T4zbWmassGM2tWmWddVXeg6G1rCQ7Fa1QddVohN3XTYdaUp6sN60-mqKDPb6kKXRbOqiqoqdJ1vq6ar6nVlVrrZmLJS64JGtC5P7PMQj5llnqndbNabVeawI8fLJmjt6QxLUWmdFiO26Zu7bj6yWhfOsvBnF7HiqP3UtmiSz-T819_hlPJnOMQwQkcpuo9tSOrn6NpBZOJkp94rvT9aGeYu78Oo9H7x_Xq7m2L4Sb0ovV-YstL7RcnvAAAA___eGkG3">