[PATCH] D109114: [GlobalDCE] Add a mode to VFE that replaces unused vtable slots with a trap function instead of a NULL pointer

Kuba (Brecka) Mracek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 13 14:50:54 PDT 2021


kubamracek added inline comments.


================
Comment at: llvm/test/Transforms/GlobalDCE/virtual-functions-trap.ll:4
+; RUN: opt < %s -globaldce -globaldce -globaldce -S | FileCheck %s
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
----------------
fhahn wrote:
> can you add a comment why there are multiple run lines with different numbers of `globaldce` invocations?
I'm going to drop that, since it looks like the way forward is to avoid emitting the trap function. The explanation why it was there is that in a previous iteration of the trap-function approach, I didn't have the `if (name == kTrapFunctionName) IgnoreDependency = false` change in UpdateGVDependencies, which caused a funny bug: If GlobalDCE is run exactly once, it works, fine, but the second time it runs (and in a typical full optimization pipeline it does run multiple times), it tried to eliminate the trap call as well, causing a F->replaceNonMetadataUsesWith(F) call which is invalid and asserts.


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

https://reviews.llvm.org/D109114



More information about the llvm-commits mailing list