[llvm-dev] [VSXFMAMutate] OldFMAReg may be wrongly rewritten

Tim Shen via llvm-dev llvm-dev at lists.llvm.org
Fri Feb 19 17:10:45 PST 2016


Example:

target triple = "powerpc64le-unknown-linux-gnu"

define void @TestFoo() {
entry_bb:
  br label %loop_bb

loop_bb:
  %tmp = load float, float* undef
  %tmp1 = fmul float %tmp, 0x401F25E360000000
  %tmp2 = fadd float %tmp1, 0x3FC1A7B960000000
  %tmp3 = select i1 undef, float 0x401F25E360000000, float %tmp2
  store float %tmp3, float* undef
  br label %loop_bb
}

The code above is triggering a assertion failure when adjusting the live
intervals, since OldFMAReg (%vreg12 in debug info) is actually defined in
two blocks.

I wonder if we can fix this by making the transformation simpler, that is,
instead of doing:
    %vreg12<def> = COPY %vreg7; VSSRC:%vreg12,%vreg7
    %vreg12<def,tied1> = XSMADDASP %vreg12<tied0>, %vreg0, %vreg4;
VSSRC:%vreg12,%vreg0 F4RC:%vreg4
->
    %vreg0<def,tied1> = XSMADDMSP %vreg0<tied0>, %vreg4, %vreg7;
VSSRC:%vreg0,%vreg7 F4RC:%vreg4
, we do:
    %vreg12<def> = COPY %vreg7; VSSRC:%vreg12,%vreg7
    %vreg12<def,tied1> = XSMADDASP %vreg12<tied0>, %vreg0, %vreg4;
VSSRC:%vreg12,%vreg0 F4RC:%vreg4
->
    %vreg0<def,tied1> = XSMADDMSP %vreg0<tied0>, %vreg4, %vreg7;
VSSRC:%vreg0,%vreg7 F4RC:%vreg4
    %vreg12<def> = COPY %vreg0; VSSRC:%vreg12,%vreg0

and count on copy elimination to eliminate the introduced copy (which
should be easy?).

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160220/feb65fc3/attachment.html>


More information about the llvm-dev mailing list