[PATCH] D123693: Transform illegal intrinsics to V_ILLEGAL

Leon Clark via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 28 04:34:53 PDT 2022


Leonc added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h:540
+  ILLEGAL,
+
   LAST_AMDGPU_ISD_NUMBER
----------------
bcahoon wrote:
> Will ILLEGAL be removed?
Thanks I missed that one.


================
Comment at: llvm/lib/Target/AMDGPU/SIISelLowering.cpp:8399
+
+  // Add the V_ILLEGAL node to the root chain to prevent its removal.
+  auto Chains = SmallVector<SDValue, 2u>();
----------------
arsenm wrote:
> bcahoon wrote:
> > The v_illegal should have an operand for the chain operand in the original instruction, if one exists.
> >   
> > t0 EntryToken
> > res,ch = intrinsic t0, <other opernads>
> > ->
> > res = undef
> > ch = v_illegal t0
> > 
> > Also, if there is a use of the chain definition in the original instruction, then there is no need to add the code below.
> I'd expect to use the original chain, but it also doesn't really matter given that it's filler anyway
Thanks @bcahoon & @arsenm.

I added a check for `MemSDNode` and pass the chain to `V_ILLEGAL` if it exists.


================
Comment at: llvm/lib/Target/AMDGPU/SIISelLowering.cpp:7837
+  case Intrinsic::amdgcn_image_sample_lz_2d: {
+    if (AMDGPU::isGFX90A(*Subtarget)) {
+      // Replace `image_sample_lz_2d` with `image_sample_2d`.
----------------
rampitec wrote:
> !ST->hasExtendedImageInsts() instead of target check.
I think this is unnecessary. We still need to call `lowerImage` for the return value when it succeeds.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123693



More information about the llvm-commits mailing list