[PATCH] D43306: [X86] Add pass to infer required-vector-width attribute based on size of function arguments and use of intrinsics

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 29 16:43:30 PDT 2018


craig.topper updated this revision to Diff 140358.
craig.topper added a comment.

Remove the required-vector-width attribute related code. Change legalization to be based on prefer-vector-width.

Add a pre-codegen IR pass to force the preferred vector width for any constructs that we know would fail isel if the prefer vector width is set to something smaller than required. The goal here is to protect correctness while I work on adding the attribute to clang's frontend. It will also protect from bad IR. I've also used it to experiment with running all x86 lit tests with prefer-vector-width forced to 256 to make sure nothing crashes or causes an isel failure.

I do wonder if we should have a some kind of disable flag for the legalization change independent of the preference. Is it useful to be able to test constraining TTI to a prefer vector width without constraining the legalizer? It could be useful if the IR pass added here doesn't catch everything that affects correctness.

Next steps:
-Make sure the TTI cost model understands whether 512 bits are legal based on the preference at the time the vectorizer runs. In particular it looks like X86TTIImpl::getCastInstrCost might not understand this correctly as most of its lookups aren't done with the result of getTypeLegalizationCost.
-Teach the inliner to merge the attribute.


https://reviews.llvm.org/D43306

Files:
  lib/Target/X86/CMakeLists.txt
  lib/Target/X86/X86.h
  lib/Target/X86/X86ISelLowering.cpp
  lib/Target/X86/X86Subtarget.cpp
  lib/Target/X86/X86Subtarget.h
  lib/Target/X86/X86TargetMachine.cpp
  lib/Target/X86/X86VectorWidthInfer.cpp
  test/CodeGen/X86/O0-pipeline.ll
  test/CodeGen/X86/O3-pipeline.ll
  test/CodeGen/X86/prefer-avx256-legalization.ll
  test/CodeGen/X86/required-vector-width.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43306.140358.patch
Type: text/x-patch
Size: 67695 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180329/a8001761/attachment-0001.bin>


More information about the llvm-commits mailing list