Skip to content

Commit

Permalink
Revert "fixup! Turn llvm-simdloop into a loop pass"
Browse files Browse the repository at this point in the history
This reverts commit 0cfa740a5f224ab0de070e0d31c11d7f6ed16669.
  • Loading branch information
vchuravy committed Jul 25, 2023
1 parent c0cf78d commit 0f734eb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 23 deletions.
15 changes: 2 additions & 13 deletions src/llvm-simdloop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,8 @@ static bool processLoop(Loop &L, OptimizationRemarkEmitter &ORE) JL_NOTSAFEPOINT
BasicBlock *Lh = L.getHeader();
LLVM_DEBUG(dbgs() << "LSL: loop header: " << *Lh << "\n");

if (LoopID->getNumOperands() <= 1) {
LLVM_DEBUG(dbgs() << "LSL: Returning early due to few operands" << *LoopID << "\n");
return false;
}
MDNode *MDs = dyn_cast<MDNode>(LoopID->getOperand(1));

if (!MDs) {
LLVM_DEBUG(dbgs() << "LSL: Returning early due to no Metadata attached" << *LoopID << "\n");
return false;
}

for (unsigned i = 0, ie = MDs->getNumOperands(); i < ie; ++i) {
Metadata *Op = MDs->getOperand(i);
for (unsigned i = 0, ie = LoopID->getNumOperands(); i < ie; ++i) {
Metadata *Op = LoopID->getOperand(i);
const MDString *S = dyn_cast<MDString>(Op);
if (S) {
LLVM_DEBUG(dbgs() << "LSL: found " << S->getString() << "\n");
Expand Down
17 changes: 7 additions & 10 deletions test/llvmpasses/simdloop.ll
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ loop:
store double %cval, double *%bptr
%nexti = add i64 %i, 1
%done = icmp sgt i64 %nexti, 500
br i1 %done, label %loopdone, label %loop, !llvm.loop !2
br i1 %done, label %loopdone, label %loop, !llvm.loop !1
loopdone:
ret void
}
Expand All @@ -40,7 +40,7 @@ loop:
; CHECK: fsub reassoc contract double %v, %aval
%nexti = add i64 %i, 1
%done = icmp sgt i64 %nexti, 500
br i1 %done, label %loopdone, label %loop, !llvm.loop !2
br i1 %done, label %loopdone, label %loop, !llvm.loop !1
loopdone:
ret double %nextv
}
Expand Down Expand Up @@ -79,17 +79,14 @@ for.body: ; preds = %for.body, %entry
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond = icmp eq i64 %indvars.iv.next, 48
; CHECK: br {{.*}} !llvm.loop [[LOOP:![0-9]+]]
br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !4
br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !2

for.end: ; preds = %for.body
%1 = load i32, i32* %a, align 4
ret i32 %1
}

!0 = distinct !{!0, !1}
!1 = !{!"julia.simdloop"}
!2 = distinct !{!2, !3}
!3 = !{!"julia.simdloop", !"julia.ivdep"}
!4 = distinct !{!4, !5}
!5 = !{!"julia.simdloop", !"julia.ivdep", !6}
!6 = !{!"llvm.loop.vectorize.disable", i1 0}
!0 = distinct !{!0, !"julia.simdloop"}
!1 = distinct !{!1, !"julia.simdloop", !"julia.ivdep"}
!2 = distinct !{!2, !"julia.simdloop", !"julia.ivdep", !3}
!3 = !{!"llvm.loop.vectorize.disable", i1 0}

0 comments on commit 0f734eb

Please sign in to comment.