diff options
author | Arnold Schwaighofer <aschwaighofer@apple.com> | 2014-06-26 19:51:19 +0000 |
---|---|---|
committer | Arnold Schwaighofer <aschwaighofer@apple.com> | 2014-06-26 19:51:19 +0000 |
commit | c2d93c404820178d55f440d4aa46e75d4b5c7b64 (patch) | |
tree | 9b7fc72267dce99c537c439ee88b0a7fc0f52774 /lib | |
parent | db1c4942760e926a6c606b924d47ec18d513b674 (diff) | |
download | llvm-c2d93c404820178d55f440d4aa46e75d4b5c7b64.tar.gz llvm-c2d93c404820178d55f440d4aa46e75d4b5c7b64.tar.bz2 llvm-c2d93c404820178d55f440d4aa46e75d4b5c7b64.tar.xz |
GVN: Preserve invariant.load metadata
If both instructions to be replaced are marked invariant the resulting
instruction is invariant.
rdar://13358910
Fix by Erik Eckstein!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211801 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Scalar/GVN.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index 56781d44aa..106eba099c 100644 --- a/lib/Transforms/Scalar/GVN.cpp +++ b/lib/Transforms/Scalar/GVN.cpp @@ -1798,6 +1798,10 @@ static void patchReplacementInstruction(Instruction *I, Value *Repl) { case LLVMContext::MD_fpmath: ReplInst->setMetadata(Kind, MDNode::getMostGenericFPMath(IMD, ReplMD)); break; + case LLVMContext::MD_invariant_load: + // Only set the !invariant.load if it is present in both instructions. + ReplInst->setMetadata(Kind, IMD); + break; } } } |