[llvm-bugs] [Bug 43898] New: [PeepholeOptimizer] foldRedundantCopy breaks if Copy is changed by TII.foldImmediate
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Nov 4 06:50:07 PST 2019
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: unassignedbugs at nondot.org
Reporter: alex.davies at iinet.net.au
CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191104/daea49f2/attachment.html>
More information about the llvm-bugs
mailing list