[PATCH] D58359: [Analysis] fold load of untouched alloca to undef

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 18 14:50:44 PST 2019


spatel created this revision.
spatel added reviewers: efriedma, fhahn, reames.
Herald added subscribers: hiraditya, eraman, Prazek, mcrosier.
Herald added a project: LLVM.

This is not stated explicitly in the LangRef, but loading directly from an alloca should always fold to undef?
We already do this fold more generally in GVN::AnalyzeLoadAvailability() (but apparently not in NewGVN), so I'm assuming it's just an oversight that it was not included in FindAvailableLoadedValue().

The diffs here result from calling FindAvailableLoadedValue() from instcombine's visitLoadInst(). I tried to salvage existing regression tests to still provide coverage for their original bugs by removing the now undef alloca+load patterns.


https://reviews.llvm.org/D58359

Files:
  llvm/lib/Analysis/Loads.cpp
  llvm/test/Transforms/Inline/byval-tail-call.ll
  llvm/test/Transforms/InstCombine/and-or-icmps.ll
  llvm/test/Transforms/InstCombine/apint-shift.ll
  llvm/test/Transforms/InstCombine/getelementptr.ll
  llvm/test/Transforms/InstCombine/multiple-uses-load-bitcast-select.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58359.187274.patch
Type: text/x-patch
Size: 9713 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190218/e00d1690/attachment.bin>


More information about the llvm-commits mailing list