[PATCH] D117999: [NewGVN] FIx phi-of-ops in the presence of memory read operations

Nuno Lopes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 23 11:19:22 PST 2022


nlopes created this revision.
nlopes added reviewers: asbirlea, fhahn.
Herald added subscribers: bollu, hiraditya.
nlopes requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The phi-of-ops functionality has a function `OpIsSafeForPHIOfOps` to determine when it's safe to create the new phi. But this function only checks for the obvious dominator conditions and ignores memory.
This patch takes the conservative approach and disables phi-of-ops whenever there's a load that doesn't dominate the phi, as its value may be affected by a store inside the loop.

This can be improved later to check aliasing between the load/stores. I've added a few tests that show the missed cases.

fixes https://github.com/llvm/llvm-project/issues/53277


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117999

Files:
  llvm/lib/Transforms/Scalar/NewGVN.cpp
  llvm/test/Transforms/NewGVN/phi-of-ops-loads.ll
  llvm/test/Transforms/NewGVN/storeoverstore.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117999.402357.patch
Type: text/x-patch
Size: 8323 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220123/8dcf8272/attachment.bin>


More information about the llvm-commits mailing list