diff options
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index b6c6c5a..624907a 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -2713,6 +2713,11 @@ void llvm::combineMetadata(Instruction *K, const Instruction *J, case LLVMContext::MD_preserve_access_index: // Preserve !preserve.access.index in K. break; + case LLVMContext::MD_noundef: + // If K does move, keep noundef if it is present in both instructions. + if (DoesKMove) + K->setMetadata(Kind, JMD); + break; } } // Set !invariant.group from J if J has it. If both instructions have it @@ -2819,7 +2824,8 @@ void llvm::patchReplacementInstruction(Instruction *I, Value *Repl) { LLVMContext::MD_noalias, LLVMContext::MD_range, LLVMContext::MD_fpmath, LLVMContext::MD_invariant_load, LLVMContext::MD_invariant_group, LLVMContext::MD_nonnull, - LLVMContext::MD_access_group, LLVMContext::MD_preserve_access_index}; + LLVMContext::MD_access_group, LLVMContext::MD_preserve_access_index, + LLVMContext::MD_noundef}; combineMetadata(ReplInst, I, KnownIDs, false); } |