[PATCH] D126089: [WPD] Try harder to find assumes through phis

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 8 20:24:42 PDT 2022


aeubanks added a comment.

C++ repro

  $ cat /tmp/a.cc
  struct [[clang::lto_visibility_public]] A {
          virtual void f();
  };
  struct [[clang::lto_visibility_public]] B {
          virtual void f();
  };
  
  void f(A*a, B*b, bool c) {
          if (c) a->f();
          else b->f();
  }
  # clang/lld with the following patch since I don't know how to pass -mllvm flags to lld
  diff --git a/llvm/lib/Passes/StandardInstrumentations.cpp b/llvm/lib/Passes/StandardInstrumentations.cpp
  index 4cd2a1ad51e3..e3d861ab60d9 100644
  --- a/llvm/lib/Passes/StandardInstrumentations.cpp
  +++ b/llvm/lib/Passes/StandardInstrumentations.cpp
  @@ -93,7 +93,7 @@ enum class ChangePrinter {
   };
   static cl::opt<ChangePrinter> PrintChanged(
       "print-changed", cl::desc("Print changed IRs"), cl::Hidden,
  -    cl::ValueOptional, cl::init(ChangePrinter::NoChangePrinter),
  +    cl::ValueOptional, cl::init(ChangePrinter::PrintChangedQuiet),
       cl::values(
           clEnumValN(ChangePrinter::PrintChangedQuiet, "quiet",
                      "Run in quiet mode"),
  
  $ ./build/rel/bin/clang++ -O2 -flto=thin -fwhole-program-vtables /tmp/a.cc -shared -o /dev/null -fuse-ld=lld
  # shows that the function becomes just an `unreachable`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126089/new/

https://reviews.llvm.org/D126089



More information about the llvm-commits mailing list