mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-04-01 12:43:47 +00:00
[FIX] Debug build + instrinsic handling
The ignored intrinsics needed to be ignored in three other places as well. Tests and lnt pass now. llvm-svn: 227092
This commit is contained in:
parent
89814b4762
commit
9e3a5db000
@ -58,6 +58,9 @@ typedef std::vector<ValueMapT> VectorValueMapT;
|
||||
bool canSynthesize(const llvm::Instruction *I, const llvm::LoopInfo *LI,
|
||||
llvm::ScalarEvolution *SE, const llvm::Region *R);
|
||||
|
||||
/// @brief Return true iff @p V is an intrisic we ignore during code generation.
|
||||
bool isIgnoredIntrinsic(const llvm::Value *V);
|
||||
|
||||
/// @brief Generate a new basic block for a polyhedral statement.
|
||||
///
|
||||
/// The only public function exposed is generate().
|
||||
|
@ -103,6 +103,8 @@ bool TempScopInfo::buildScalarDependences(Instruction *Inst, Region *R) {
|
||||
// synthesizable scalars can be generated by the code generator.
|
||||
if (canSynthesize(Inst, LI, SE, R))
|
||||
return false;
|
||||
if (isIgnoredIntrinsic(Inst))
|
||||
return false;
|
||||
|
||||
bool AnyCrossStmtUse = false;
|
||||
BasicBlock *ParentBB = Inst->getParent();
|
||||
|
@ -52,6 +52,30 @@ bool polly::canSynthesize(const Instruction *I, const llvm::LoopInfo *LI,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool polly::isIgnoredIntrinsic(const Value *V) {
|
||||
if (auto *IT = dyn_cast<IntrinsicInst>(V)) {
|
||||
switch (IT->getIntrinsicID()) {
|
||||
// Lifetime markers are supported/ignored.
|
||||
case llvm::Intrinsic::lifetime_start:
|
||||
case llvm::Intrinsic::lifetime_end:
|
||||
// Invariant markers are supported/ignored.
|
||||
case llvm::Intrinsic::invariant_start:
|
||||
case llvm::Intrinsic::invariant_end:
|
||||
// Some misc annotations are supported/ignored.
|
||||
case llvm::Intrinsic::var_annotation:
|
||||
case llvm::Intrinsic::ptr_annotation:
|
||||
case llvm::Intrinsic::annotation:
|
||||
case llvm::Intrinsic::donothing:
|
||||
case llvm::Intrinsic::assume:
|
||||
case llvm::Intrinsic::expect:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
BlockGenerator::BlockGenerator(PollyIRBuilder &B, ScopStmt &Stmt, Pass *P,
|
||||
LoopInfo &LI, ScalarEvolution &SE,
|
||||
isl_ast_build *Build,
|
||||
|
@ -130,7 +130,6 @@ struct IndependentBlocks : public FunctionPass {
|
||||
|
||||
// Split the exit block to hold load instructions.
|
||||
bool splitExitBlock(Region *R);
|
||||
bool isIgnoredIntrinsic(Instruction *Inst);
|
||||
bool onlyUsedInRegion(Instruction *Inst, const Region *R);
|
||||
bool translateScalarToArray(BasicBlock *BB, const Region *R);
|
||||
bool translateScalarToArray(Instruction *Inst, const Region *R);
|
||||
@ -143,30 +142,6 @@ struct IndependentBlocks : public FunctionPass {
|
||||
};
|
||||
}
|
||||
|
||||
bool IndependentBlocks::isIgnoredIntrinsic(Instruction *Inst) {
|
||||
if (auto *IT = dyn_cast<IntrinsicInst>(Inst)) {
|
||||
switch (IT->getIntrinsicID()) {
|
||||
// Lifetime markers are supported/ignored.
|
||||
case llvm::Intrinsic::lifetime_start:
|
||||
case llvm::Intrinsic::lifetime_end:
|
||||
// Invariant markers are supported/ignored.
|
||||
case llvm::Intrinsic::invariant_start:
|
||||
case llvm::Intrinsic::invariant_end:
|
||||
// Some misc annotations are supported/ignored.
|
||||
case llvm::Intrinsic::var_annotation:
|
||||
case llvm::Intrinsic::ptr_annotation:
|
||||
case llvm::Intrinsic::annotation:
|
||||
case llvm::Intrinsic::donothing:
|
||||
case llvm::Intrinsic::assume:
|
||||
case llvm::Intrinsic::expect:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IndependentBlocks::isSafeToMove(Instruction *Inst) {
|
||||
if (Inst->mayReadFromMemory() || Inst->mayWriteToMemory())
|
||||
return false;
|
||||
@ -477,6 +452,8 @@ bool IndependentBlocks::isIndependentBlock(const Region *R,
|
||||
for (Instruction &Inst : *BB) {
|
||||
if (canSynthesize(&Inst, LI, SE, R))
|
||||
continue;
|
||||
if (isIgnoredIntrinsic(&Inst))
|
||||
continue;
|
||||
|
||||
// A value inside the Scop is referenced outside.
|
||||
for (User *U : Inst.users()) {
|
||||
@ -493,6 +470,8 @@ bool IndependentBlocks::isIndependentBlock(const Region *R,
|
||||
continue;
|
||||
|
||||
for (Value *Op : Inst.operands()) {
|
||||
if (isIgnoredIntrinsic(Op))
|
||||
continue;
|
||||
if (isEscapeOperand(Op, BB, R)) {
|
||||
DEBUG(dbgs() << "Instruction in function '";
|
||||
BB->getParent()->printAsOperand(dbgs(), false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user