[PATCH] D88363: [CodeGen] Improve likelihood attribute branch weights

Jeremy Morse via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 8 05:54:16 PDT 2020


jmorse added a comment.

In D88363#2317241 <https://reviews.llvm.org/D88363#2317241>, @Mordante wrote:

> Can you explain the kind of issues you're having?

At the shallowest level, our -O1 produces different IR and fails the test, which is more or less our problem; however my understanding is that tests in the LLVM project / subprojects should aim to test as little amount of code as code possible. Relying on all of -O1 makes it a brittle test -- changes to any optimisation pass enabled in -O1 could cause this test to fail spuriously.

Instead, I believe the test should be in two parts:

- One checking clang produces the correct /unoptimised/ IR output
- One or more checking that the consuming IR passes do-the-right-thing

An example is (some of) the TBAA tests -- as you suggest, they're using `-O1 -disable-llvm-passes` to check that clang produces stores with !tbaa metadata attached. Then over in the LLVM optimisation passes there are tests checking that GVN / LICM etc correctly consume TBAA metadata. Note that I'm unfamiliar with how branch weights work, but I believe the principle is the same.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88363



More information about the cfe-commits mailing list