[PATCH] D78847: [LV] Fix recording of BranchTakenCount for FoldTail

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 10 17:01:42 PDT 2020


Ayal added a comment.

In D78847#2028708 <https://reviews.llvm.org/D78847#2028708>, @anhtuyen wrote:

> Hello,


[snip]

> In this example, the operand[0] (%induction) correctly has type i64, but the loop bound (14) is of vector type <1 x i64>
> 
> There might be multiple ways to address this assert failure. I list below a few simple ones for your reference: they might or might not be a good solution at all.
> 
> 1. Option 1: Not to generate the icmp instructions for %induction. In the particular case of this testcase, these instructions seem to be redundant.
> 2. Option 2: If we are to generate the icmp instructions above, can we set the BackedgeTakenCount to the State depending on the type of the first operand? In cases like this one when the first operand is not a vector type, using Value *TCMO instead of Value *VTCMO might be an option.
> 
>   I will open a Bugzzila and copy its link to this page when my password reset goes through.
> 
>   Thanks, Anh

Yes, thanks for catching this!
One quick fix is indeed to set VTCMO to TCMO when State->VF == 1, instead of "splatting" it into a vector of a single element.
Thinking if fold-tail-by-masking should be restricted to work for VF>1 only, given that only vectors (loads/stores) get masked.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78847





More information about the llvm-commits mailing list