[PATCH] D158598: [RFC][GlobalISel] Remove const from most MatchTableExecutor methods

Pierre van Houtryve via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 24 00:08:20 PDT 2023


Pierre-vh planned changes to this revision.
Pierre-vh added a comment.

In D158598#4611871 <https://reviews.llvm.org/D158598#4611871>, @arsenm wrote:

> In D158598#4609625 <https://reviews.llvm.org/D158598#4609625>, @Pierre-vh wrote:
>
>> Additional context: While refactoring this area for some upcoming diffs (removing the deprecated GICombiner backend), I changed some data members from `T&` to `T` and got a lot of errors due to this.
>> While I usually favor const-correctness as much as possible, it's really never respected here. We always use references or pointers, which means we can always call non-const functions on those even in a const function.
>>
>> Example:
>>
>>   struct Foo {
>>       int foo() {
>>           return 0;
>>       }
>>   };
>
> The foo here would just have to be const? don't see the issue

It's a trivial example, in most cases we'd be calling CombinerHelper functions or GlobalISelObserver functions.
I'll double check if I can make the offending function consts, and keep mutable around for now. I'll come back to this if I still think it makes sense afterwards


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158598/new/

https://reviews.llvm.org/D158598



More information about the llvm-commits mailing list