1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00
llvm-mirror/include/llvm/IR/FixedMetadataKinds.def
Juneyoung Lee e7de338270 Add support for !noundef metatdata on loads
This patch adds metadata !noundef and makes load instructions can optionally have it.
A load with !noundef always return a well-defined value (has no undef bit or isn't poison).
If the loaded value isn't well defined, the behavior is undefined.

This metadata can be used to encode the assumption from C/C++ that certain reads of variables should have well-defined values.
It is helpful for optimizing freeze instructions away, because freeze can be removed when its operand has well-defined value, and showing that a load from arbitrary location is well-defined is usually hard otherwise.

The same information can be encoded with llvm.assume with operand bundle; using metadata is chosen because I wasn't sure whether code motion can be freely done when llvm.assume is inserted from clang instead.
The existing codebase already is stripping unknown metadata when doing code motion, so using metadata is UB-safe as well.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D89050
2020-10-17 13:50:10 +09:00

44 lines
2.1 KiB
C++

/*===-- FixedMetadataKinds.def - Fixed metadata kind IDs -------*- C++ -*-=== *\
|*
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|* See https://llvm.org/LICENSE.txt for license information.
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|*
\*===----------------------------------------------------------------------===*/
#ifndef LLVM_FIXED_MD_KIND
#error "LLVM_FIXED_MD_KIND(EnumID, Name, Value) is not defined."
#endif
LLVM_FIXED_MD_KIND(MD_dbg, "dbg", 0)
LLVM_FIXED_MD_KIND(MD_tbaa, "tbaa", 1)
LLVM_FIXED_MD_KIND(MD_prof, "prof", 2)
LLVM_FIXED_MD_KIND(MD_fpmath, "fpmath", 3)
LLVM_FIXED_MD_KIND(MD_range, "range", 4)
LLVM_FIXED_MD_KIND(MD_tbaa_struct, "tbaa.struct", 5)
LLVM_FIXED_MD_KIND(MD_invariant_load, "invariant.load", 6)
LLVM_FIXED_MD_KIND(MD_alias_scope, "alias.scope", 7)
LLVM_FIXED_MD_KIND(MD_noalias, "noalias", 8)
LLVM_FIXED_MD_KIND(MD_nontemporal, "nontemporal", 9)
LLVM_FIXED_MD_KIND(MD_mem_parallel_loop_access,
"llvm.mem.parallel_loop_access", 10)
LLVM_FIXED_MD_KIND(MD_nonnull, "nonnull", 11)
LLVM_FIXED_MD_KIND(MD_dereferenceable, "dereferenceable", 12)
LLVM_FIXED_MD_KIND(MD_dereferenceable_or_null, "dereferenceable_or_null", 13)
LLVM_FIXED_MD_KIND(MD_make_implicit, "make.implicit", 14)
LLVM_FIXED_MD_KIND(MD_unpredictable, "unpredictable", 15)
LLVM_FIXED_MD_KIND(MD_invariant_group, "invariant.group", 16)
LLVM_FIXED_MD_KIND(MD_align, "align", 17)
LLVM_FIXED_MD_KIND(MD_loop, "llvm.loop", 18)
LLVM_FIXED_MD_KIND(MD_type, "type", 19)
LLVM_FIXED_MD_KIND(MD_section_prefix, "section_prefix", 20)
LLVM_FIXED_MD_KIND(MD_absolute_symbol, "absolute_symbol", 21)
LLVM_FIXED_MD_KIND(MD_associated, "associated", 22)
LLVM_FIXED_MD_KIND(MD_callees, "callees", 23)
LLVM_FIXED_MD_KIND(MD_irr_loop, "irr_loop", 24)
LLVM_FIXED_MD_KIND(MD_access_group, "llvm.access.group", 25)
LLVM_FIXED_MD_KIND(MD_callback, "callback", 26)
LLVM_FIXED_MD_KIND(MD_preserve_access_index, "llvm.preserve.access.index", 27)
LLVM_FIXED_MD_KIND(MD_misexpect, "misexpect", 28)
LLVM_FIXED_MD_KIND(MD_vcall_visibility, "vcall_visibility", 29)
LLVM_FIXED_MD_KIND(MD_noundef, "noundef", 30)