# @llvm.assume blocks optimization

**URL:** <https://discourse.llvm.org/t/llvm-assume-blocks-optimization/71609>\
**Category:** IR & Optimizations\
**Tags:** llvm\
**Created:** [June 27, 2023, 5:54am UTC](https://discourse.llvm.org/t/llvm-assume-blocks-optimization/71609 "2023-06-27T05:54:29Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![ChuanqiXu](https://sea1.discourse-cdn.com/flex021/user_avatar/discourse.llvm.org/chuanqixu/32/1976_2.png) [@ChuanqiXu](https://discourse.llvm.org/u/ChuanqiXu)\
**Post date:** [June 28, 2023, 1:58am UTC](https://discourse.llvm.org/t/llvm-assume-blocks-optimization/71609/8 "2023-06-28T01:58:09Z")

</div>

I am not sure if I understand the method well. In my imagination, it still can’t solve the case that the value `%cond` are only used by the assumption like the reproducer did.

I mean something like:

```auto
%0 = ptr
...
%4 = tail call i1 @whatever(ptr %3, ptr %2, ptr %1, ptr %0)
tail call void @llvm.assume(i1 %4) 

```

Given `%0`~`%4` are only used by `@llvm.assume`, can we eliminate all of them now?  
Or only if `%4` is only used by `@llvm.assume` but `%4` provides some information, so that eliminating `%4` may affect the optimizer too. Then how should we make a decision here?

IIUC, is it possible to solve the question by an `@llvm.assume()` without `i1 %cond`? I feel the edge cases will be much less in this way.

---

_[View the full topic](https://discourse.llvm.org/t/llvm-assume-blocks-optimization/71609)._
