[llvm] [GVN] Turn off ScalarPRE for TokenLike Types (PR #156513)
Justin Bogner via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 2 12:19:45 PDT 2025
https://github.com/bogner commented:
I really wish there was an easier way to make it clear that an `update_test_checks` test is just checking that the output exactly matches the output. Might be worth commenting as such in the note that explains what this is doing.
The test can also be simplified quite a bit - I commented on some of the particular things to do that, but since I modified it myself to come up with those comments anyway I think it more or less boils down to this:
```llvm
define i32 @f(i32 %x) {
entry:
%cmp = icmp eq i32 %x, 0
br i1 %cmp, label %exit, label %for.body.lr.ph
for.body.lr.ph:
%buf = call target("dx.RawBuffer", i32, 1, 0) @llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 4, i32 %x, ptr nonnull @Out.str)
br label %for.body
for.body:
%i = phi i32 [ 0, %for.body.lr.ph ], [ %inc.i, %for.body ]
%v1 = call i32 @llvm.dx.resource.updatecounter(target("dx.RawBuffer", i32, 1, 0) %buf, i8 1)
%inc.i = add nuw nsw i32 %i, 1
%exitcond = icmp ne i32 %inc.i, %x
br i1 %exitcond, label %for.body, label %exit
exit:
%buf2 = call target("dx.RawBuffer", i32, 1, 0) @llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 4, i32 %x, ptr nonnull @Out.str)
%v2 = call i32 @llvm.dx.resource.updatecounter(target("dx.RawBuffer", i32, 1, 0) %buf2, i8 1)
ret i32 %v2
}
```
https://github.com/llvm/llvm-project/pull/156513
More information about the llvm-commits
mailing list