https://bugs.llvm.org/show_bug.cgi?id=43898

            Bug ID: 43898
           Summary: [PeepholeOptimizer] foldRedundantCopy breaks if Copy
                    is changed by TII.foldImmediate
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedb...@nondot.org
          Reporter: alex.dav...@iinet.net.au
                CC: llvm-bugs@lists.llvm.org

For all MIs per basic block:

  foldRedundantCopy tracks copy instructions and places them in DenseMap
CopyMIs.

  foldImmediate tracks isMoveImm, and calls foldImmediate on uses of these.
foldImmediate is allowed to change the desc of UseMI - see
ARMBaseInstrInfo.cpp.

On seeing the description for "foldImmediate", it seems logical to optimize
copy instructions - but if you try to do so, it's only a matter of time until
compilation fails, as foldRedundantCopy does not verify that instructions in
CopyMI is still actually a copy instruction.

I figure either (1) do not call foldImmediate on COPYs, if it is recommended
that targets do not perform this optimization here, or (2) add:

  if (!PrevCopy->isCopy())
    return false;

to line 1410 of PeepholeOptimizer.cpp

Cheers :)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to