[PATCH] D48305: [IR] Introduce helpers to skip meta-instructions

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 19 10:12:02 PDT 2018


vsk added a comment.

In https://reviews.llvm.org/D48305#1136018, @efriedma wrote:

> I don't think donothing counts as a meta-instruction, by your definition; yes, it has no effects and no operands, but it isn't ignored by the optimizer (it generally just gets erased, but that's not the same as ignoring it).


Ah, you're right. The langref explains that calls to llvm.donothing may be removed, but aren't generally ignored.

> llvm.annotation and llvm.ptr.annotation have return values, so they can't be ignored by optimizations, in general.  llvm.var.annotation has a pointer operand, so it also can't be ignored by optimizations, in general.  This is intentional, so they can be used to experiment with new optimizations.
> 
> Given that, a "meta-instruction" is precisely debug info.  And I don't think that will change in the future.

Thanks for providing some background on what llvm.*.annotation is meant to do. My previous understanding of these instructions was that they shouldn't affect whether or not an optimization triggers (the langref states: "they are ignored by code generation and optimization"). I think I was reading too much into this. The language isn't the same as what's used for debug intrinsics ("debug information does not prevent optimizations from happening"). Some optimizations do fail to "kick-in" when annotations are present (jump threading, a few combines), but I suppose that's expected.

Based on this feedback, I think it'd make sense to go with @fhahn's original approach (i.e just introduce a skipDebugInstructions helper).


https://reviews.llvm.org/D48305





More information about the llvm-commits mailing list