[PATCH] D126089: [WPD] Make sure type test is eliminated

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 20 16:06:27 PDT 2022


aeubanks added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp:1929
+      if (!CI->use_empty())
+        CI->replaceAllUsesWith(ConstantInt::getTrue(M.getContext()));
       // We can't use RecursivelyDeleteTriviallyDeadInstructions here because we
----------------
tejohnson wrote:
> The equivalent code in LowerTypeTests::lower() asserts that the users are all phi nodes in this case. Can you add the same check here?
that asserts on [1]. I'm not sure why the assert in LTT never triggers since it does seem like you could potentially do arbitrary things with the result of type tests. if we really wanted to make sure that type tests were only used by assumes, perhaps indirectly through phis, I think that would be more of a verifier check

[1] https://github.com/llvm/llvm-project/blob/8801a5d185fafcb8c03f71ceb717b84c2f08b220/llvm/test/ThinLTO/X86/cache-typeid-resolutions.ll#L32


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