[PATCH] D112016: [IR] Introduce load assume operand bundle

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 18 13:32:16 PDT 2021


aeubanks added a comment.

In D112016#3071101 <https://reviews.llvm.org/D112016#3071101>, @jdoerfert wrote:

> In D112016#3071082 <https://reviews.llvm.org/D112016#3071082>, @aeubanks wrote:
>
>> In D112016#3071078 <https://reviews.llvm.org/D112016#3071078>, @jdoerfert wrote:
>>
>>>> This is useful for exposing the vtable value of a C++ object after its constructor without having to insert a load into the instruction stream.
>>>
>>> Why is an assume better than a load?
>>
>> Adding an extra load will affect cost modelling, e.g. inliner thresholds, and other various ad-hoc cost heuristics. assumes are free.
>
> I really want to get to the outlined assumes function model but I guess this is an OK first step.
>
> - outlined model ---
>
>   call @llvm.assume(i1 true) ["assume_fn"(void (i32*, i32) @__assume_equal, i32* %P, i32 %V]
>   
>   define void @__assume_equal(i32* %P, i32 %V) {
>     %L = load i32* %P
>     %cmp = icmp eq i32 %L, %V
>     call @llvm.assume(i1 %cmp)
>   }
>
> because it is way more flexible. We can use it to encode
> `__builtin_assume(foobar() == barfoo());`
> without risking side-effects to leak or cause regressions,
> as another example.

Makes sense, and I'm happy to modify this to use that if we ever get there.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112016



More information about the llvm-commits mailing list