Try to constant fold the specified instruction.
Declared in <llvm/Analysis/ConstantFolding.h>
Constant*
ConstantFoldInstruction(
Instruction const* I,
DataLayout const& DL,
TargetLibraryInfo const* TLI = nullptr);
If successful, the constant result is returned, if not, null is returned. Note that this fails if not all of the operands are constant. Otherwise, this function can only fail when attempting to fold instructions like loads and stores, which have no constant expression form.
The folded constant on success, or null on failure.
| Name | Description |
|---|---|
| I | Instruction to attempt to fold. |
| DL | Data layout used for type sizes and pointer widths. |
| TLI | Optional target library info for libcall folding. |