aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/Local.cpp
diff options
context:
space:
mode:
authorChen Li <meloli87@gmail.com>2015-08-07 19:30:12 +0000
committerChen Li <meloli87@gmail.com>2015-08-07 19:30:12 +0000
commiteafbc9dc474e99c95f0625f44aadc1bb64790795 (patch)
treeb4684c137e63933382d67da4a64d5e8f4ca0eb7b /llvm/lib/Transforms/Utils/Local.cpp
parentc1c1f534ecf0660da82ecd967970dabbfdb4e06a (diff)
downloadllvm-eafbc9dc474e99c95f0625f44aadc1bb64790795.zip
llvm-eafbc9dc474e99c95f0625f44aadc1bb64790795.tar.gz
llvm-eafbc9dc474e99c95f0625f44aadc1bb64790795.tar.bz2
[ConstantFoldTerminator] Preserve make.implicit metadata when converting SwitchInst to BranchInst
Summary: llvm::ConstantFoldTerminator function can convert SwitchInst with single case (and default) to a conditional BranchInst. This patch adds support to preserve make.implicit metadata on this conversion. Reviewers: sanjoy, weimingz, chenli Subscribers: mcrosier, llvm-commits Differential Revision: http://reviews.llvm.org/D11841 llvm-svn: 244348
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index 3483032..310aab4 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -229,6 +229,11 @@ bool llvm::ConstantFoldTerminator(BasicBlock *BB, bool DeleteDeadConditions,
SIDef->getValue().getZExtValue()));
}
+ // Update make.implicit metadata to the newly-created conditional branch.
+ MDNode *MakeImplicitMD = SI->getMetadata(LLVMContext::MD_make_implicit);
+ if (MakeImplicitMD)
+ NewBr->setMetadata(LLVMContext::MD_make_implicit, MakeImplicitMD);
+
// Delete the old switch.
SI->eraseFromParent();
return true;