This is an archive of the discontinued LLVM Phabricator instance.

[Codegen][X86] EltsFromConsecutiveLoads(): if only have AVX1, ensure that the "load" is actually foldable (PR51615)
ClosedPublic

Authored by lebedev.ri on Aug 27 2021, 7:48 AM.

Details

Summary

This fixes another reproducer from https://bugs.llvm.org/show_bug.cgi?id=51615
And again, the fix lies not in the code added in D105390

In this case, we completely don't check that the "broadcast-from-mem" we create
can actually fold the load. In this case, it's operand was not a load at all:

Combining: t16: v8i32 = vector_shuffle<0,u,u,u,0,u,u,u> t14, undef:v8i32
Creating new node: t29: i32 = undef
RepeatLoad:
t8: i32 = truncate t7
  t7: i64 = extract_vector_elt t5, Constant:i64<0>
    t5: v2i64,ch = load<(load (s128) from %ir.arg)> t0, t2, undef:i64
      t2: i64,ch = CopyFromReg t0, Register:i64 %0
        t1: i64 = Register %0
      t4: i64 = undef
    t3: i64 = Constant<0>
Combining: t15: v8i32 = undef

Diff Detail

Event Timeline

lebedev.ri created this revision.Aug 27 2021, 7:48 AM
lebedev.ri requested review of this revision.Aug 27 2021, 7:48 AM
lebedev.ri edited the summary of this revision. (Show Details)Aug 27 2021, 8:23 AM

Err, wrong snippet. now this actually shows the problem:

Combining: t16: v8i32 = vector_shuffle<0,u,u,u,0,u,u,u> t14, undef:v8i32
Creating new node: t29: i32 = undef
RepeatLoad:
t8: i32 = truncate t7
  t7: i64 = extract_vector_elt t5, Constant:i64<0>
    t5: v2i64,ch = load<(load (s128) from %ir.arg)> t0, t2, undef:i64
      t2: i64,ch = CopyFromReg t0, Register:i64 %0
        t1: i64 = Register %0
      t4: i64 = undef
    t3: i64 = Constant<0>
Combining: t15: v8i32 = undef
RKSimon accepted this revision.Aug 27 2021, 8:46 AM

LGTM

This revision is now accepted and ready to land.Aug 27 2021, 8:46 AM
alexfh added a subscriber: alexfh.Aug 27 2021, 10:09 AM

Thanks for the prompt fix! One nit.

llvm/lib/Target/X86/X86ISelLowering.cpp
5035–5036

nit: "Function names should be verb phrases (as they represent actions), and command-like function should be imperative. The name should be camel case, and start with a lower case letter (e.g. openFile() or isFoo())."

https://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly

Same below.

This revision was landed with ongoing or failed builds.Aug 27 2021, 10:27 AM
This revision was automatically updated to reflect the committed changes.