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

Ahmed Bougacha via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 11 12:44:59 PDT 2022


ab added a comment.
Herald added a subscriber: StephenFan.
Herald added a project: All.

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!


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