[PATCH] D18367: Introduce llvm.load.relative intrinsic.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 19 11:58:01 PDT 2016


pcc added inline comments.

================
Comment at: docs/LangRef.rst:12194-12198
@@ +12193,7 @@
+
+LLVM provides that the calculation of such a constant initializer will
+not overflow at link time under the medium code model if ``x`` is an
+``unnamed_addr`` function, however it does not provide the same for a constant
+initializer folded into a function body; this intrinsic can be used to avoid
+the possibility of overflows when loading from such a constant.
+
----------------
rnk wrote:
> Can the wording be improved here? This is a long sentence.
Okay, what about this?

================
Comment at: lib/CodeGen/PreISelIntrinsicLowering.cpp:1
@@ +1,2 @@
+//===-- PreISelIntrinsicLowering.cpp - Pre-ISel intrinsic lowering pass ---===//
+//
----------------
rnk wrote:
> Should this lowering be done as part of CodeGenPrepare instead? We currently lower llvm.objectsize there.
> 
> 
I looked for an existing place to add this lowering, but I couldn't find anywhere suitable. CodeGenPrepare is apparently an optional optimization pass [1], but the backend is required to handle this intrinsic (objectsize can be implemented trivially by returning 0 or -1, which is what the backend currently does [2,3], but there's no trivial implementation of this intrinsic).

[1] http://llvm-cs.pcc.me.uk/lib/CodeGen/Passes.cpp#470
[2] http://llvm-cs.pcc.me.uk/lib/CodeGen/SelectionDAG/FastISel.cpp#1218
[3] http://llvm-cs.pcc.me.uk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp#5348


http://reviews.llvm.org/D18367





More information about the llvm-commits mailing list