summaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-10-01 05:36:09 +0000
committerChris Lattner <sabre@nondot.org>2010-10-01 05:36:09 +0000
commit2831a194954cb4a79049e8a666d246a9a1662b92 (patch)
treea98de897356d328fa2e8a939ace0f2673abec9bc /lib/CodeGen
parentb0ab5d04dd2e253fa2504208ebb1bfafa3d8a018 (diff)
downloadllvm-2831a194954cb4a79049e8a666d246a9a1662b92.tar.gz
llvm-2831a194954cb4a79049e8a666d246a9a1662b92.tar.bz2
llvm-2831a194954cb4a79049e8a666d246a9a1662b92.tar.xz
fix rdar://8494845 + PR8244 - a miscompile exposed by my patch in r101350
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115294 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/SelectionDAG/DAGCombiner.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index be95c08e2f..ede54e5ed2 100644
--- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -4087,6 +4087,15 @@ SDValue DAGCombiner::ReduceLoadWidth(SDNode *N) {
if ((N0.getValueType().getSizeInBits() & (EVTBits-1)) != 0)
return SDValue();
}
+
+ // If the shift amount is larger than the input type then we're not
+ // accessing any of the loaded bytes. If the load was a zextload/extload
+ // then the result of the shift+trunc is zero/undef (handled elsewhere).
+ // If the load was a sextload then the result is a splat of the sign bit
+ // of the extended byte. This is not worth optimizing for.
+ if (ShAmt >= VT.getSizeInBits())
+ return SDValue();
+
}
}