[llvm-dev] Allowed operations for passes that report "no change"

Florian Hahn via llvm-dev llvm-dev at lists.llvm.org
Tue Jul 21 04:57:21 PDT 2020



> On Jul 21, 2020, at 12:12, Jay Foad via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> On Mon, 20 Jul 2020 at 08:21, Serge Guelton via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
>>> I agree. If a pass modifies the IR in any way, even temporarily, it was changed (at some point).
>> I'd like to +1, but when doing the migration of the code base to enable the associated expensive check, I found situations where (B) was used.
> 
> For example CodeGenPrepare has a TypePromotionTransaction class which
> is specifically designed to let you modify the IR, then roll back
> those modifications and return false.


Agreed, sometimes it is very convenient to create temporary IR, so various utilities that expect a piece of IR can be used.

Another example of a pass that creates temporary instructions is NewGVN. Or some users of SCEVExpander, where the result of the expansion might be thrown away, because it is not profitable.

With (A), such passes would make changes. 

I think with (B), the only potential effect would be slightly different use list orders, but there should be no other observable effects, if the pass removes the instructions again and also removes them from any analysis that it might have add them. I don’t think we gain much in terms of extra checking from choosing (A) over (B), but it would have a negative impact on some passes in terms of unnecessary invalidation. But I might be missing something.

Cheers,
Florian




More information about the llvm-dev mailing list