diff options
author | Richard Sandiford <rsandifo@linux.vnet.ibm.com> | 2013-08-20 09:38:48 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@linux.vnet.ibm.com> | 2013-08-20 09:38:48 +0000 |
commit | 8c20158fb0e1e5d747077f065eb0170c5af1fbfa (patch) | |
tree | a5028d38ab70ecdac91c2e7d4cb257931f18e978 /lib/Target/SystemZ/SystemZSelectionDAGInfo.h | |
parent | 74e81aae7c07b0619a77a5a0a56fdb954ce4b8fd (diff) | |
download | llvm-8c20158fb0e1e5d747077f065eb0170c5af1fbfa.tar.gz llvm-8c20158fb0e1e5d747077f065eb0170c5af1fbfa.tar.bz2 llvm-8c20158fb0e1e5d747077f065eb0170c5af1fbfa.tar.xz |
[SystemZ] Use SRST to optimize memchr
SystemZTargetLowering::emitStringWrapper() previously loaded the character
into R0 before the loop and made R0 live on entry. I'd forgotten that
allocatable registers weren't allowed to be live across blocks at this stage,
and it confused LiveVariables enough to cause a miscompilation of f3 in
memchr-02.ll.
This patch instead loads R0 in the loop and leaves LICM to hoist it
after RA. This is actually what I'd tried originally, but I went for
the manual optimisation after noticing that R0 often wasn't being hoisted.
This bug forced me to go back and look at why, now fixed as r188774.
We should also try to optimize null checks so that they test the CC result
of the SRST directly. The select between null and the SRST GPR result could
then usually be deleted as dead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188779 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/SystemZ/SystemZSelectionDAGInfo.h')
-rw-r--r-- | lib/Target/SystemZ/SystemZSelectionDAGInfo.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Target/SystemZ/SystemZSelectionDAGInfo.h b/lib/Target/SystemZ/SystemZSelectionDAGInfo.h index 26d648893e..281d1e291d 100644 --- a/lib/Target/SystemZ/SystemZSelectionDAGInfo.h +++ b/lib/Target/SystemZ/SystemZSelectionDAGInfo.h @@ -47,6 +47,11 @@ public: MachinePointerInfo Op2PtrInfo) const LLVM_OVERRIDE; virtual std::pair<SDValue, SDValue> + EmitTargetCodeForMemchr(SelectionDAG &DAG, SDLoc DL, SDValue Chain, + SDValue Src, SDValue Char, SDValue Length, + MachinePointerInfo SrcPtrInfo) const LLVM_OVERRIDE; + + virtual std::pair<SDValue, SDValue> EmitTargetCodeForStrcpy(SelectionDAG &DAG, SDLoc DL, SDValue Chain, SDValue Dest, SDValue Src, MachinePointerInfo DestPtrInfo, |