[llvm-dev] Reassociation is blocking a vectorization

kamlesh kumar via llvm-dev
Sun, 10 Nov 2019 14:33:24 -0000

Hi Devs,
I am looking at the bug
https://bugs.llvm.org/show_bug.cgi?id=43953

and found that following piece of ir

 %arrayidx = getelementptr inbounds float, float* %Vec0, i64 %idxprom
  %0 = load float, float* %arrayidx, align 4, !tbaa !2
  %arrayidx2 = getelementptr inbounds float, float* %Vec1, i64 %idxprom
  %1 = load float, float* %arrayidx2, align 4, !tbaa !2
  %sub = fsub fast float %0, %1
  %add = fadd fast float %sum.0, %sub

is transformed into

%arrayidx = getelementptr inbounds float, float* %Vec0, i64 %idxprom
  %0 = load float, float* %arrayidx, align 4, !tbaa !2
  %arrayidx2 = getelementptr inbounds float, float* %Vec1, i64 %idxprom
  %1 = load float, float* %arrayidx2, align 4, !tbaa !2
  %.neg = fsub fast float -0.000000e+00, %1
  %sub = fadd fast float %0, %sum.0
  %add = fadd fast float %sub, %.neg

which again by instcombiner transformed into
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20191110/fa8a491a/attachment.html>