[llvm] e20331c - [Local] Use combineMetadataForCSE() in patchReplacementInstruction()

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 3 06:31:53 PDT 2023


Author: Nikita Popov
Date: 2023-04-03T15:30:21+02:00
New Revision: e20331cec0a21c4798569ee347de3a697621c9c5

URL: https://github.com/llvm/llvm-project/commit/e20331cec0a21c4798569ee347de3a697621c9c5
DIFF: https://github.com/llvm/llvm-project/commit/e20331cec0a21c4798569ee347de3a697621c9c5.diff

LOG: [Local] Use combineMetadataForCSE() in patchReplacementInstruction()

patchReplacementInstruction() is used for CSE-style transforms.
Avoid the need to maintain two separate lists of known metadata IDs,
which can and do go out of sync.

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/Local.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index 7a43ee0a5128..b32ed2a8c657 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -2822,14 +2822,7 @@ void llvm::patchReplacementInstruction(Instruction *I, Value *Repl) {
   // In general, GVN unifies expressions over 
diff erent control-flow
   // regions, and so we need a conservative combination of the noalias
   // scopes.
-  static const unsigned KnownIDs[] = {
-      LLVMContext::MD_tbaa,            LLVMContext::MD_alias_scope,
-      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_noundef,         LLVMContext::MD_nontemporal};
-  combineMetadata(ReplInst, I, KnownIDs, false);
+  combineMetadataForCSE(ReplInst, I, false);
 }
 
 template <typename RootType, typename DominatesFn>


        


More information about the llvm-commits mailing list