[llvm-dev] RFC: Generalize AssumptionCache to AxiomCache

Sanjoy Das via llvm-dev llvm-dev at lists.llvm.org
Wed Apr 27 15:43:33 PDT 2016


Hi all,

Guard intrinsics[0] are similar in nature to Assume intrinsics, in
that the condition passed to a guard intrinsic call is known to be
true at locations dominated (but *not* post-dominated) by the
call[1].  I'd like to re-use the AssumptionCache infrastructure that
already exists to teach the mid level optimizer to exploit this
property.

The steps I want to take are (not necessarily in this order or split
up this way):

  - Rename AssumptionCache to AxiomCache (or something similar)
  - Maintain two lists in AxiomCache, one for assumptions (exactly the
    same as today) and other for guards (`AxiomCache::guards()`)
  - Change places that check check the `assumptions()` list to also
    check the newly added `guards()` list

I want to maintain `assumptions()` and `guards()` separately since, as
noted above, the way they can be used by the optimizer is different
(guards don't necessarily imply their condition on post-dominance).

Does that sound reasonable?

-- Sanjoy

[0]:
http://llvm.org/docs/LangRef.html#llvm-experimental-guard-intrinsic

[1]: The guard intrinsics checks the condition at runtime and
deoptimizes the current blob of compiled code if the condition is
false.


More information about the llvm-dev mailing list