[PATCH] D76976: Make NewGVN aware of aligned_alloc

Uday Bondhugula via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 28 01:02:51 PDT 2020


bondhugula created this revision.
bondhugula added reviewers: jdoerfert, xbolva00.
Herald added subscribers: llvm-commits, hiraditya, Prazek.
Herald added a project: LLVM.

Make the New GVN pass aware of aligned_alloc.

Signed-off-by: Uday Bondhugula <uday at polymagelabs.com>

Depends on D76975 <https://reviews.llvm.org/D76975>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76976

Files:
  llvm/lib/Transforms/Scalar/NewGVN.cpp


Index: llvm/lib/Transforms/Scalar/NewGVN.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/NewGVN.cpp
+++ llvm/lib/Transforms/Scalar/NewGVN.cpp
@@ -1470,7 +1470,8 @@
   // undef value.  This can happen when loading for a fresh allocation with no
   // intervening stores, for example.  Note that this is only true in the case
   // that the result of the allocation is pointer equal to the load ptr.
-  if (isa<AllocaInst>(DepInst) || isMallocLikeFn(DepInst, TLI)) {
+  if (isa<AllocaInst>(DepInst) || isMallocLikeFn(DepInst, TLI) ||
+      isAlignedAllocLikeFn(DepInst, TLI)) {
     return createConstantExpression(UndefValue::get(LoadType));
   }
   // If this load occurs either right after a lifetime begin,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76976.253307.patch
Type: text/x-patch
Size: 765 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200328/1d3fe7d3/attachment.bin>


More information about the llvm-commits mailing list