[PATCH] D59995: [LV] Exclude loop-invariant inputs from scalar cost computation.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 5 08:56:47 PDT 2019


fhahn updated this revision to Diff 208191.
fhahn marked an inline comment as done.
fhahn added a comment.
Herald added a subscriber: rogfer01.

Addressed Ayal's comments, thanks and sorry for the long delay, it somehow dropped off my radar.

In D59995#1502129 <https://reviews.llvm.org/D59995#1502129>, @Ayal wrote:

> Good point. Does the test case pass w/o this patch?


Yes both tests fail with the patch.

The only thing that cannot be tested is the combination of intrinsic taking struct
values, but that should be fine.

> 
> 
>>> Seems like `getVectorIntrinsicCost` also requires fixing?
>> 
>> Yep, I'll update it in a second. In practice, I don't think there are any intrinsics that take struct types, but maybe in the future it might become a problem.
>> 
>>> Would be good to hoist such invariant instructions
>>> 
>>>   %a = extractvalue { i64, i64 } %sv, 0
>>>   %b = extractvalue { i64, i64 } %sv, 1
>>>    
>>> 
>>> out of the loop before LV, or at-least have LV recognize them as uniform.
>> 
>> Yep, I can look into that as a follow up. LICM should hoist those things, but I think in general we cannot guarantee that all loop-invariant instructions are hoisted out before LoopVectorize (the test case came from a fuzzer). Do you think we should try to hoist them in LV? I would assume a later run of LICM will hoist them.
> 
> The thought was to check LICM, and check LV's uniform analysis.

I am not entirely sure I understand what you mean here. I checked LICM and it will
hoist the problematic case here, but I do not think we should rely on that, as
there might be other reasons why LICM decided against hoisting (or LICM is not run).

Currently they are not marked as uniform in LV, but I can fix that in a follow-up
patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59995/new/

https://reviews.llvm.org/D59995

Files:
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h
  llvm/test/Transforms/LoopVectorize/AArch64/extractvalue-no-scalarization-required.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59995.208191.patch
Type: text/x-patch
Size: 18207 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190705/1693217e/attachment.bin>


More information about the llvm-commits mailing list