[cfe-dev] Canonicalizing conditional loads

Diogo Sampaio via cfe-dev cfe-dev at lists.llvm.org
Wed Aug 18 13:45:42 PDT 2021

our target machine has conditional (predicated) load instructions. However it is hard to generate at dag-select
as clang emits conditional branches to avoid performing the load in most cases.
All these functions perform the same thing, but only the first one does not add a conditional branch instruction.

Is there a way to tell clang to always generate the code as the first function, or perhaps a llvm pass that converts
the conditional branch/load into a select or hoists the load before/after the branch, also using a select?

If not, would anyone else be interested in such thing? Any ideas for which would be the best solution?

Diogo Sampaio

More information about the cfe-dev mailing list