[PATCH] D29688: InstCombine: Remove dead code

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 7 14:45:25 PST 2017


arsenm created this revision.
Herald added a subscriber: wdng.

This is checking for a situation which I don't think can happen.
Before this the alignment is already explicitly set, and
non-0 sized allocas are sorted before, so any sized alloca
seen should have already been visited to set the alignment.


https://reviews.llvm.org/D29688

Files:
  lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp


Index: lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
===================================================================
--- lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
+++ lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
@@ -259,11 +259,9 @@
           return &AI;
         }
 
-        // If the alignment of the entry block alloca is 0 (unspecified),
-        // assign it the preferred alignment.
-        if (EntryAI->getAlignment() == 0)
-          EntryAI->setAlignment(
-              DL.getPrefTypeAlignment(EntryAI->getAllocatedType()));
+        assert(EntryAI->getAlignment() != 0 &&
+               "alignment should already have been set if missing");
+
         // Replace this zero-sized alloca with the one at the start of the entry
         // block after ensuring that the address will be aligned enough for both
         // types.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29688.87526.patch
Type: text/x-patch
Size: 886 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170207/c1c69a7b/attachment.bin>


More information about the llvm-commits mailing list