[PATCH] D34726: AMDGPU/SI: Don not insert an instruction into worklist twice in movetovalu

Changpeng Fang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 15:29:32 PDT 2017


cfang added a reviewer: alfred.j.huang.
cfang marked 2 inline comments as done.
cfang added a comment.

This is the shortest test I can get! The instruction in question is the "and".  It is first put
in the list because of tmp3, and the second time by tmp13.

define amdgpu_kernel void @in_worklist_once() #0 {
bb:

  %tmp = load i64, i64* undef
  br label %bb1

bb1:                                              ; preds = %bb1, %bb

  %tmp2 = phi i64 [ undef, %bb ], [ %tmp16, %bb1 ]
  %tmp3 = phi i64 [ %tmp, %bb ], [ undef, %bb1 ]
  %tmp11 = lshr i64 %tmp2, 14
  %tmp13 = xor i64 %tmp11, %tmp2
  %tmp15 = and i64 %tmp3, %tmp13
  %tmp16 = xor i64 %tmp15, %tmp3
  br label %bb1

}



================
Comment at: lib/Target/AMDGPU/SIInstrInfo.cpp:3947
+      // Do not add to worklist twice!
+      if(Worklist.end() == llvm::find(Worklist, &MI))
+        Worklist.push_back(&MI);
----------------
arsenm wrote:
> arsenm wrote:
> > Missing space
> I think the worklist can be pretty big. A brute force search through is probably bad.
What's your suggestion for the search in smallvector?


https://reviews.llvm.org/D34726





More information about the llvm-commits mailing list