[llvm-dev] Matching instruction patterns from a FunctionPass
Félix Cloutier via llvm-dev
llvm-dev at lists.llvm.org
Fri Oct 23 20:53:44 PDT 2015
I'm working on a pass that would need to match a pattern of instructions. In pseudo-IR:
%0 = sub %a, %b
%1 = xor %a, %b
%2 = xor %0, %a
%3 = and %1, %2
After this instruction sequence, %3's most significant bit tells whether the subtraction overflowed. I would like to find occurrences of this pattern from a FunctionPass.
However, this has a couple of possible permutations. And and Xor are both commutative, meaning that there are 8 valid ways to express this. Since I might not be the first person to run into this kind of issue, I was wondering if there is a common way to handle this.
More information about the llvm-dev