| Index: src/IceCfgNode.cpp
|
| diff --git a/src/IceCfgNode.cpp b/src/IceCfgNode.cpp
|
| index f23ae0feade7250b0f04e784cf50f66ab79e716e..9d925507eadc8317f2c5eb4841ffd636c95dbcc8 100644
|
| --- a/src/IceCfgNode.cpp
|
| +++ b/src/IceCfgNode.cpp
|
| @@ -1106,6 +1106,11 @@ public:
|
| return llvm::cast<InstBundleLock>(getBundleLockStart())->getOption() ==
|
| InstBundleLock::Opt_AlignToEnd;
|
| }
|
| + bool isPadToEnd() const {
|
| + assert(isInBundleLockRegion());
|
| + return llvm::cast<InstBundleLock>(getBundleLockStart())->getOption() ==
|
| + InstBundleLock::Opt_PadToEnd;
|
| + }
|
| // Check whether the entire bundle_lock region falls within the same bundle.
|
| bool isSameBundle() const {
|
| assert(isInBundleLockRegion());
|
| @@ -1171,7 +1176,17 @@ public:
|
| }
|
| }
|
| }
|
| - // Update bookkeeping when rolling back for the second pass.
|
| + // If pad_to_end is specified, add padding such that the first instruction
|
| + // after the instruction sequence starts starts at a bundle boundary.
|
| + void padForPadToEnd() {
|
| + assert(isInBundleLockRegion());
|
| + if (isPadToEnd()) {
|
| + if (intptr_t Offset = getPostAlignment()) {
|
| + Asm->padWithNop(BundleSize - Offset);
|
| + SizeSnapshotPre = Asm->getBufferSize();
|
| + }
|
| + }
|
| + } // Update bookkeeping when rolling back for the second pass.
|
| void rollback() {
|
| assert(isInBundleLockRegion());
|
| Asm->setBufferSize(SizeSnapshotPre);
|
| @@ -1260,6 +1275,7 @@ void CfgNode::emitIAS(Cfg *Func) const {
|
| // If align_to_end is specified, make sure the next instruction begins
|
| // the bundle.
|
| assert(!Helper.isAlignToEnd() || Helper.getPostAlignment() == 0);
|
| + Helper.padForPadToEnd();
|
| Helper.leaveBundleLockRegion();
|
| Retrying = false;
|
| } else {
|
|
|