[PATCH] D11355: Fix for PR24179 - mem2reg generates incorrect code

Gil Rapaport gil.rapaport at intel.com
Mon Jul 20 08:38:02 PDT 2015


gilr created this revision.
gilr added reviewers: sanjoy, mkuper.
gilr added a subscriber: llvm-commits.

Patch implements the logic described in main comment of promoteSingleBlockAlloca for loads not preceded by a store:
- If there are no stores before the load, it is (still) replaced by an undef (test2 in the added lit test)
- IF there are any stores, but none preceding the load we bail out and let the rest of Mem2Reg's machinery handle this alloca, as the load may be affected by a following store, depending on the CFG (test1 in the added lit test).

http://reviews.llvm.org/D11355

Files:
  lib/Transforms/Utils/PromoteMemoryToRegister.cpp
  test/Transforms/Mem2Reg/pr24179.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11355.30161.patch
Type: text/x-patch
Size: 4499 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150720/27102cae/attachment.bin>


More information about the llvm-commits mailing list