[PATCH] D22918: [Loop Vectorizer] Support predication of div/rem

Gil Rapaport via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 12 14:01:18 PDT 2016


gilr added inline comments.

================
Comment at: test/Transforms/LoopVectorize/if-pred-non-void.ll:136-138
@@ +135,5 @@
+
+if.then:                                          ; preds = %for.body
+  %rsd = sdiv i32 %psd, %lsd
+  br label %if.end
+
----------------
mssimpso wrote:
> Thanks for adding the additional "future" test. I don't think it will exercise the non-insert case, though. I'm very sorry for not being more clear previously. Here, %rsd will always have to be inserted into a vector since it will be directly used by a select instruction, which will remain vectorized. I didn't think of this when I last commented. But I think if you add an additional instruction, this should produce the desired effect. Something like:
> 
> ```
> if.then:
>   %tmp = sdiv i32 %psd, %lsd
>   %rsd = sdiv i32 %tmp, %lsd
>   br label %if.end
> ```
> 
> When I ran the modified test with this patch and the scalar patch, the non-insert case was used for %tmp and the insert case was used for %rsd. This makes sense becase %tmp is only used by %rsd (will be scalar), and %rsd will again feed the vector select.
> 
Argh, sorry about that. Your explanation was clear - just a hasty implementation on my side :(
Yes, the second sdiv should go under the same condition - will fix.


https://reviews.llvm.org/D22918





More information about the llvm-commits mailing list