Index: src/IceCfgNode.cpp |
diff --git a/src/IceCfgNode.cpp b/src/IceCfgNode.cpp |
index 78063e35c71d156509140096f4dc4b23874258b4..cae5d3770e796b9d64a7919efa2b31cc92051682 100644 |
--- a/src/IceCfgNode.cpp |
+++ b/src/IceCfgNode.cpp |
@@ -500,18 +500,22 @@ void CfgNode::doNopInsertion() { |
TargetLowering *Target = Func->getTarget(); |
LoweringContext &Context = Target->getContext(); |
Context.init(this); |
+ Context.setInsertPoint(Context.getCur()); |
+ // Do not insert nop in bundle locked instructions. |
+ bool PauseNopInsertion = false; |
while (!Context.atEnd()) { |
- Target->doNopInsertion(); |
+ if (llvm::isa<InstBundleLock>(Context.getCur())) { |
+ PauseNopInsertion = true; |
+ } else if (llvm::isa<InstBundleUnlock>(Context.getCur())) { |
+ PauseNopInsertion = false; |
+ } |
+ if (!PauseNopInsertion) |
+ Target->doNopInsertion(); |
// Ensure Cur=Next, so that the nops are inserted before the current |
// instruction rather than after. |
- Context.advanceNext(); |
Context.advanceCur(); |
+ Context.advanceNext(); |
} |
- // Insert before all instructions. |
- Context.setInsertPoint(getInsts().begin()); |
- Context.advanceNext(); |
- Context.advanceCur(); |
- Target->doNopInsertion(); |
} |
// Drives the target lowering. Passes the current instruction and the |