[all-commits] [llvm/llvm-project] 2e8512: [VP] Check if VP ops with functional intrinsics ar...
Luke Lau via All-commits
all-commits at lists.llvm.org
Thu Oct 26 05:46:46 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2e85123bfe8501e08689a27c6cf93203df06654a
https://github.com/llvm/llvm-project/commit/2e85123bfe8501e08689a27c6cf93203df06654a
Author: Luke Lau <luke at igalia.com>
Date: 2023-10-26 (Thu, 26 Oct 2023)
Changed paths:
M llvm/lib/CodeGen/ExpandVectorPredication.cpp
M llvm/test/CodeGen/Generic/expand-vp.ll
Log Message:
-----------
[VP] Check if VP ops with functional intrinsics are speculatable (#69504)
Noticed whilst working on #69494. VP intrinsics whose functional
equivalent is
an intrinsic were being marked as their lanes being non-speculatable,
even if
the underlying intrinsic was speculatable.
This meant that
```llvm
%1 = call <4 x i32> @llvm.vp.umax(<4 x i32> %x, <4 x i32> %y, <4 x i1> %mask, i32 %evl)
```
would be expanded out to
```llvm
%.splatinsert = insertelement <4 x i32> poison, i32 %evl, i64 0
%.splat = shufflevector <4 x i32> %.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%1 = icmp ult <4 x i32> <i32 0, i32 1, i32 2, i32 3>, %.splat
%2 = and <4 x i1> %1, %mask
%3 = call <4 x i32> @llvm.umax.v4i32(<4 x i32> %x, <4 x i32> %y)
```
instead of
```llvm
%1 = call <4 x i32> @llvm.umax.v4i32(<4 x i32> %x, <4 x i32> %y)
```
The cause of this was isSafeToSpeculativelyExecuteWithOpcode checking
the
function attributes for the VP instruction itself, not the functional
intrinsic. Since isSafeToSpeculativelyExecuteWithOpcode expects an
already
materialized instruction, we can't use it directly for the intrinsic
case. So
this fixes it by manually checking the function attributes on the
intrinsic.
More information about the All-commits
mailing list