[llvm] [IR] llvm.reloc.none intrinsic for no-op symbol references (PR #147427)

Daniel Thornburgh via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 17 14:25:28 PDT 2025


================
@@ -1913,6 +1913,9 @@ def int_threadlocal_address : DefaultAttrsIntrinsic<[llvm_anyptr_ty], [LLVMMatch
 def int_stepvector : DefaultAttrsIntrinsic<[llvm_anyvector_ty],
                                             [], [IntrNoMem]>;
 
+def int_reloc_none : DefaultAttrsIntrinsic<[], [llvm_ptr_ty],
+  [IntrHasSideEffects, IntrInaccessibleMemOnly, IntrWillReturn]>;
----------------
mysterymath wrote:

> Why define IntrHasSideEffects?

Actually, it appears that the correct params were `InstrNoMem` and `InstrHasSideEffects` to prevent DCE. I discovered in the follow up patch that `opt` will DCE the intrinsic otherwise; accordingly, the fact that it isn't DCEd is tested there.

https://github.com/llvm/llvm-project/pull/147427


More information about the llvm-commits mailing list