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

Matthew Simpson via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 11 14:26:02 PDT 2016


mssimpso 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
+
----------------
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.



https://reviews.llvm.org/D22918





More information about the llvm-commits mailing list