[PATCH] D119432: [FastISel] Reuse register for bitcast that does not change MVT

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 12 03:53:32 PDT 2022


nikic added a comment.

In D119432#3507087 <https://reviews.llvm.org/D119432#3507087>, @ab wrote:

> Hi @nikic, I may have hit an issue with this change: when the noop-bitcast result is already used in other (potentially already selected) blocks, we already assigned a vreg for the value, and it may be too late to change it when selecting this bitcast.  Concretely, this repro fails for x86_64 with -verify-machineinstrs, because the second use of %tmp1 uses a never-defined vreg:
>
>   define void @repro(i8** %a0, i1 %a1) {
>     %tmp0 = load i8*, i8** %a0
>     %tmp1 = bitcast i8* %tmp0 to void ()*
>     call void %tmp1()
>     br i1 %a1, label %bb1, label %bb2
>   
>   bb1:
>     call void %tmp1()
>     ret void
>   
>   bb2:
>     ret void
>   }
>
> My fast-isel is way too rusty to suggest an obvious fix, so can you please take a look? ;)  Thanks!

Thanks for the report! I've put up https://reviews.llvm.org/D125459 to fix this issue.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119432



More information about the llvm-commits mailing list