Skip to content

Commit f7e30b7

Browse files
committed
Use isSafeToMoveBefore
1 parent c59741a commit f7e30b7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "llvm/IR/Dominators.h"
2222
#include "llvm/IR/IntrinsicsAMDGPU.h"
2323
#include "llvm/Transforms/InstCombine/InstCombiner.h"
24+
#include "llvm/Transforms/Utils/CodeMoverUtils.h"
2425
#include <optional>
2526

2627
using namespace llvm;
@@ -507,8 +508,10 @@ GCNTTIImpl::hoistLaneIntrinsicThroughOperand(InstCombiner &IC,
507508
LaneID = II.getOperand(1);
508509
// Check LaneID is available at Op, otherwise we can't move the readlane
509510
// higher.
510-
if (!IC.getDominatorTree().dominates(LaneID, Op))
511-
return nullptr;
511+
if (auto *LaneIDInst = dyn_cast<Instruction>(LaneID)) {
512+
if (!isSafeToMoveBefore(*LaneIDInst, *Op, IC.getDominatorTree()))
513+
return nullptr;
514+
}
512515
}
513516

514517
const auto DoIt = [&](unsigned OpIdx,

0 commit comments

Comments
 (0)