This is an archive of the discontinued LLVM Phabricator instance.

[X86][SSE] Simplify extract(shuffle(load())) handling (PR43971)
AbandonedPublic

Authored by RKSimon on Nov 14 2019, 12:20 PM.

Details

Summary

PR43971 showed how XFormVExtractWithShuffleIntoLoad was relying on a later call to DAGCombiner::visitEXTRACT_VECTOR_ELT to succeed before the regenerated VECTOR_SHUFFLE was re-lowered to a target shuffle again.

This patch removes XFormVExtractWithShuffleIntoLoad entirely, avoiding the creation of the VECTOR_SHUFFLE, instead it uses combineExtractWithShuffle to extract directly from the load (stripping any bitcasts).

Diff Detail

Event Timeline

RKSimon created this revision.Nov 14 2019, 12:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 14 2019, 12:20 PM
wolfgangp added a subscriber: test.EditedNov 14 2019, 5:58 PM

I applied your patch to ToT, but now I'm seeing a loop with the following IR (on linux). Seems still stuck in DAGCombine.

define void @test() local_unnamed_addr {
entry:
  %id34847 = alloca <2 x double>, align 16
  %id34846 = alloca double, align 8
  %id34847.0.id34847.0. = load volatile <2 x double>, <2 x double>* %id34847, align 16
  %vecext = extractelement <2 x double> %id34847.0.id34847.0., i32 1
  store volatile double %vecext, double* %id34846, align 8
  ret void
}
RKSimon updated this revision to Diff 229499.Nov 15 2019, 3:45 AM

Ensure the load is simple

I'm unfortunately still getting a loop in DAGcombiner with this one (llc -mattr=+avx on linux). If you make the 1.000 in the select instr into 0.000 it finishes.

define float @test(<8 x float> *%a0) {
entry:
  %0 = load <8 x float>, <8 x float>* %a0, align 32
  %vecext = extractelement <8 x float> %0, i32 1
  %cmp = fcmp oeq float %vecext, 0.000000e+00
  %cond = select i1 %cmp, float 1.000000e+00, float %vecext
  ret float %cond
}
RKSimon planned changes to this revision.Nov 22 2019, 8:37 AM
RKSimon abandoned this revision.Jan 6 2020, 5:45 AM