[PATCH] D72475: [WIP] Build assume from call

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 13 09:28:45 PST 2020


jdoerfert added a comment.

In D72475#1816055 <https://reviews.llvm.org/D72475#1816055>, @Tyker wrote:

>




> But i think that we also need to build an API to query those new assumes before using them. First to have "good names" instead of indexes in the operand bundle and also because we don't want users to directly depend on the representation. If at some point we want to group knowledge by attributes.
>  example: for
> 
>   call void @func(i32* nonnull %P1, i32* nonnull %P)
> 
> 
> build
> 
>   call void @llvm.assume(i1 true) [ "nonnull"(i32* %P1, i32* %P)]
> 
> 
> instead of
> 
>   call void @llvm.assume(i1 true) [ "nonnull"(i32* %P1), "nonnull"(i32* %P)]
> 
> 
> this change will be harder if passes access the operand bundle element directly.

I agree that an API is useful, Since this is attribute-based it should be as well. Maybe something like

  `bool getAttributeFromAssume(Value &Base, CallInst &AssumeCI, Attribute::Kind Kind, int &Value)`

and similar for string attributes. Alternatively we could return a map from `WhatOn` values to attributes.

I don't understand. What do you mean by "good names"? We have the operand bundle strings, right?
Agreed that an API should hide the actual encoding, thus the above grouping is something we should be able to do easily.


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

https://reviews.llvm.org/D72475





More information about the llvm-commits mailing list