artagnon wrote:
> Would be good to test this with a case where we hoist a speculative vector
> intrinsic (and not hoist the remainder/division
I think we hoist based on Instruction::mayHaveSideEffects, which is unrelated
to speculatable in LICM? Before the change, I have the following LICM test: not
sure what I'm missing?
```llvm
define i32 @vp_udiv(<2 x i32> %inv.q, <2 x i32> %inv.d) {
; CHECK-LABEL: define i32 @vp_udiv(
; CHECK-SAME: <2 x i32> [[INV_Q:%.*]], <2 x i32> [[INV_D:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*]]:
; CHECK-NEXT: [[VP_UDIV:%.*]] = call <2 x i32> @llvm.vp.udiv.v2i32(<2 x i32>
[[INV_Q]], <2 x i32> [[INV_D]], <2 x i1> splat (i1 true), i32 2)
; CHECK-NEXT: [[EXTRACT:%.*]] = extractelement <2 x i32> [[VP_UDIV]], i32 0
; CHECK-NEXT: br label %[[LOOP:.*]]
; CHECK: [[LOOP]]:
; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, %[[ENTRY]] ], [ [[IV_NEXT:%.*]],
%[[LOOP]] ]
; CHECK-NEXT: [[LOOP_COND:%.*]] = icmp ult i32 [[IV]], [[EXTRACT]]
; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], 1
; CHECK-NEXT: br i1 [[LOOP_COND]], label %[[LOOP]], label %[[EXIT:.*]]
; CHECK: [[EXIT]]:
; CHECK-NEXT: [[IV_LCSSA:%.*]] = phi i32 [ [[IV]], %[[LOOP]] ]
; CHECK-NEXT: ret i32 [[IV_LCSSA]]
;
entry:
br label %loop
loop:
%iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
%vp.udiv = call <2 x i32> @llvm.vp.udiv.v2i32(<2 x i32> %inv.q, <2 x i32>
%inv.d, <2 x i1> splat (i1 1), i32 2)
%extract = extractelement <2 x i32> %vp.udiv, i32 0
%loop.cond = icmp ult i32 %iv, %extract
%iv.next = add i32 %iv, 1
br i1 %loop.cond, label %loop, label %exit
exit:
ret i32 %iv
}
```
https://github.com/llvm/llvm-project/pull/162334
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits