[llvm-dev] Comparing constant values of aggregate types for equality
Christer Swahn via llvm-dev
llvm-dev at lists.llvm.org
Thu Jul 27 07:01:49 PDT 2017
This seems to me to be a straight-forward operation and perhaps available
within LLVM's API but I've been unable to find any guidance via google /
I'm looking to do value equality comparison on aggregate types (arrays and
structs), and want to have special handling for when they are constant for
two use cases:
- Creating only a single global constant instead of several when their
values are equal and won't be modified
- Optimizing the value equality operation when both operands are constant
This is trivial with ConstantExpr::getICmp and ConstantExpr::getFCmp for
primitive types, and seems straight-forward to do recursively for structs
and arrays. So I could roll my own but I'm sure this has been done already?
However I can't find any standard implementation, can someone point me in
the right direction?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev