[PATCH] D157504: AMDGPU: Check for implicit defs before constant folding instruction
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 9 07:12:43 PDT 2023
arsenm created this revision.
arsenm added a reviewer: AMDGPU.
Herald added subscribers: foad, kerbowa, hiraditya, tpr, dstuttard, yaxunl, jvesely, kzhuravl.
Herald added a project: All.
arsenm requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.
Can't delete the constant folded instruction if scc is used.
In the original testcase, an un-constant folded and made it all the
way to SIFoldOperands. I think this is because a urem with known
bounds emitted during memcpy lowering wasn't appropriately simplified
since it was emitted so late. We should probably try to avoid that in
the first place.
Many GlobalISel tests show regressions for two reasons. First, it's
not setting dead flags in some cases. The reason we care about the
dead flags is compensating for failure to constant fold common
operations in the first place.
Fixes #63986
https://reviews.llvm.org/D157504
Files:
llvm/include/llvm/CodeGen/MachineInstr.h
llvm/lib/CodeGen/MachineInstr.cpp
llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
llvm/test/CodeGen/AMDGPU/GlobalISel/fshl.ll
llvm/test/CodeGen/AMDGPU/GlobalISel/fshr.ll
llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.abs.ll
llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.intersect_ray.ll
llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.wqm.demote.ll
llvm/test/CodeGen/AMDGPU/GlobalISel/saddsat.ll
llvm/test/CodeGen/AMDGPU/GlobalISel/sext_inreg.ll
llvm/test/CodeGen/AMDGPU/GlobalISel/shl.ll
llvm/test/CodeGen/AMDGPU/GlobalISel/ssubsat.ll
llvm/test/CodeGen/AMDGPU/GlobalISel/store-local.128.ll
llvm/test/CodeGen/AMDGPU/GlobalISel/store-local.96.ll
llvm/test/CodeGen/AMDGPU/GlobalISel/uaddsat.ll
llvm/test/CodeGen/AMDGPU/GlobalISel/usubsat.ll
llvm/test/CodeGen/AMDGPU/constant-fold-imm-immreg.mir
llvm/test/CodeGen/AMDGPU/mad-mix-hi.ll
llvm/test/CodeGen/AMDGPU/memcpy-crash-issue63986.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157504.548608.patch
Type: text/x-patch
Size: 226495 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230809/a2b60324/attachment-0001.bin>
More information about the llvm-commits
mailing list