mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
Fix pr14893.
When simplifycfg moves an instruction, it must drop metadata it doesn't know is still valid with the preconditions changes. In particular, it must drop the range and tbaa metadata. The patch implements this with an utility function to drop all metadata not in a white list. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200322 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2154,6 +2154,14 @@ bool llvm::FoldBranchToCommonDest(BranchInst *BI) {
|
||||
Instruction *NewBonus = 0;
|
||||
if (BonusInst) {
|
||||
NewBonus = BonusInst->clone();
|
||||
|
||||
// If we moved a load, we cannot any longer claim any knowledge about
|
||||
// its potential value. The previous information might have been valid
|
||||
// only given the branch precondition.
|
||||
// For an analogous reason, we must also drop all the metadata whose
|
||||
// semantics we don't understand.
|
||||
NewBonus->dropUnknownMetadata(LLVMContext::MD_dbg);
|
||||
|
||||
PredBlock->getInstList().insert(PBI, NewBonus);
|
||||
NewBonus->takeName(BonusInst);
|
||||
BonusInst->setName(BonusInst->getName()+".old");
|
||||
|
Reference in New Issue
Block a user