From fd2bc11248f76b2131a1630761ea43ce01ec010d Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Thu, 26 Apr 2018 10:26:17 +0000 Subject: [LoopInterchange] Ignore debug intrinsics during legality checks. Reviewers: aprantl, mcrosier, karthikthecool Reviewed By: aprantl Subscribers: mattd, vsk, #debug-info, llvm-commits Differential Revision: https://reviews.llvm.org/D45379 llvm-svn: 330931 --- llvm/lib/Transforms/Scalar/LoopInterchange.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'llvm/lib/Transforms') diff --git a/llvm/lib/Transforms/Scalar/LoopInterchange.cpp b/llvm/lib/Transforms/Scalar/LoopInterchange.cpp index 45d76fdb7c9..b10ec265891 100644 --- a/llvm/lib/Transforms/Scalar/LoopInterchange.cpp +++ b/llvm/lib/Transforms/Scalar/LoopInterchange.cpp @@ -923,7 +923,8 @@ bool LoopInterchangeLegality::currentLimitations() { // instruction. bool FoundInduction = false; - for (const Instruction &I : llvm::reverse(*InnerLoopLatch)) { + for (const Instruction &I : + llvm::reverse(InnerLoopLatch->instructionsWithoutDebug())) { if (isa(I) || isa(I) || isa(I) || isa(I)) continue; @@ -976,10 +977,9 @@ bool LoopInterchangeLegality::canInterchangeLoops(unsigned InnerLoopId, }); return false; } - // Check if outer and inner loop contain legal instructions only. for (auto *BB : OuterLoop->blocks()) - for (Instruction &I : *BB) + for (Instruction &I : BB->instructionsWithoutDebug()) if (CallInst *CI = dyn_cast(&I)) { // readnone functions do not prevent interchanging. if (CI->doesNotReadMemory()) -- cgit v1.2.3