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

Daniel Thornburgh via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 16 11:16:33 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?

Sorry, cargo cult copying from `fake_use`. After skimming the doc comments, I removed everything and made it `IntrNoMem`. This doesn't appear to cause the intrinsic to be DCEd, which was what I was worried about. I've added a test for DCE avoidance, too.

> New uses of llvm_ptr_ty should not be introduced. Only llvm_anyptr_ty

Ack; it's metadata now, so this no longer applies.

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


More information about the llvm-commits mailing list