[PATCH] D138526: [SimpleLoopUnswitch] unswitch selects

Joshua Cao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 6 18:05:30 PDT 2023


caojoshua updated this revision to Diff 520135.
caojoshua edited the summary of this revision.
caojoshua added a comment.

I found that the previous implementation was completely broken on inserting freeze instructions. We were creating freeze instructions, but not inserting it as the condition for the branch instruction. In other words, we were creating a dead freeze instruction. This issue was not caught earlier because existing logic to insert freeze on branch instructions covered most cases.

I factored out the freeze logic from unswitchNontrivialInvariants to shouldInsertFreeze. This will allow the select-converted-branch get a freeze inserted just like other branches. I added some comments here which I'm not 100% sure is accurate. Would appreciate review on wording for these.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138526

Files:
  llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
  llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-freeze.ll
  llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-select.ll
  llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-trivial-select.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138526.520135.patch
Type: text/x-patch
Size: 46607 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230507/6cd2b1e1/attachment-0001.bin>


More information about the llvm-commits mailing list