[PATCH] D66606: IR. Change strip* family of functions to not look through aliases.

Peter Collingbourne via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 22 10:53:10 PDT 2019


pcc created this revision.
pcc added a reviewer: rnk.
Herald added subscribers: cfe-commits, aheejin, hiraditya, jgravelle-google, sbc100, dschuff, srhines.
Herald added projects: clang, LLVM.

I noticed another instance of the issue where references to aliases were
being replaced with aliasees, this time in InstCombine. In the instance that
I saw it turned out to be only a QoI issue (a symbol ended up being missing
from the symbol table due to the last reference to the alias being removed,
preventing HWASAN from symbolizing a global reference), but it could easily
have manifested as incorrect behaviour.

Since this is the third such issue encountered (previously: D65118 <https://reviews.llvm.org/D65118>, D65314 <https://reviews.llvm.org/D65314>)
it seems to be time to address this common error/QoI issue once and for all
and make the strip* family of functions not look through aliases.

Includes a test for the specific issue that I saw, but no doubt there are
other similar bugs fixed here.

As with D65118 <https://reviews.llvm.org/D65118> this has been tested to make sure that the optimization isn't
load bearing. I built Clang, Chromium for Linux, Android and Windows as well
as the test-suite and there were no size regressions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D66606

Files:
  clang/lib/CodeGen/CGExpr.cpp
  llvm/include/llvm/IR/Value.h
  llvm/lib/Analysis/ConstantFolding.cpp
  llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
  llvm/lib/Analysis/StackSafetyAnalysis.cpp
  llvm/lib/CodeGen/Analysis.cpp
  llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  llvm/lib/IR/Constants.cpp
  llvm/lib/IR/Module.cpp
  llvm/lib/IR/Value.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyLowerGlobalDtors.cpp
  llvm/lib/Transforms/IPO/ConstantMerge.cpp
  llvm/lib/Transforms/IPO/GlobalOpt.cpp
  llvm/test/Transforms/InstCombine/bitcast-alias-function.ll
  llvm/test/Transforms/InstCombine/bitcast-function.ll
  llvm/test/Transforms/InstCombine/gep-alias.ll
  llvm/test/Transforms/InstCombine/pr39177.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66606.216671.patch
Type: text/x-patch
Size: 33030 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190822/eaf5acb0/attachment-0001.bin>


More information about the cfe-commits mailing list