When SelectionDAG expands memcpy (or memmove) call into a sequence of load and store instructions, it disregards dereferenceable flag even the source pointer is known to be dereferenceable.
This results in an assertion failure if SelectionDAG commonizes a load instruction generated for memcpy with another load instruction for the source pointer.
This patch makes SelectionDAG to set the dereferenceable flag for the load instructions properly to avoid the assertion failure.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/CodeGen/MachineInstr.cpp | ||
---|---|---|
576 ↗ | (On Diff #103428) | Creating temporary instructions in helper functions is something we try very hard not to do. Please don't do it here. The underlying isDereferenceableAndAlignedPointer implementation function in lib/Analysis/Loads.cpp actually takes a size. Feel free to expose an interface directly to that functionality if necessary. |
lib/CodeGen/MachineInstr.cpp | ||
---|---|---|
576 ↗ | (On Diff #103428) | I added an interface to pass size as a parameter in isDereferenceableAndAlignedPointer and eliminated the temporary instructions in the helper. |
Comment Actions
- added a test case extracted from a large application which causes an assertion failure