Skip to content

Commit e7c864d

Browse files
committed
[IR] Add freeze_bit to list of UB safe metadata to preserve
Add freeze_bits to Instruction::dropUBImplyingAttrsAndMetadata. !freeze_bits is safe to maintain as it produces a nondeterministic value when uninitialized memory loads are transformed into register based transactions.
1 parent c1b54d2 commit e7c864d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

llvm/lib/IR/Instruction.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -516,12 +516,14 @@ void Instruction::dropUBImplyingAttrsAndUnknownMetadata(
516516
}
517517

518518
void Instruction::dropUBImplyingAttrsAndMetadata() {
519-
// !annotation metadata does not impact semantics.
520-
// !range, !nonnull and !align produce poison, so they are safe to speculate.
521-
// !noundef and various AA metadata must be dropped, as it generally produces
522-
// immediate undefined behavior.
519+
// !annotation metadata does not impact semantics. !range, !nonnull and !align
520+
// produce poison, so they are safe to speculate. !freeze_bits produces a
521+
// nondeterministic value when uninitialized memory loads are transformed to
522+
// register based transactions. !noundef and various AA metadata must be
523+
// dropped, as it generally produces immediate undefined behavior.
523524
unsigned KnownIDs[] = {LLVMContext::MD_annotation, LLVMContext::MD_range,
524-
LLVMContext::MD_nonnull, LLVMContext::MD_align};
525+
LLVMContext::MD_nonnull, LLVMContext::MD_align,
526+
LLVMContext::MD_freeze_bits};
525527
dropUBImplyingAttrsAndUnknownMetadata(KnownIDs);
526528
}
527529

0 commit comments

Comments
 (0)