1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00

For better or worse, load from i1 is assumed to be zero extended. Do not

form a load from i1 from larger loads that may not be zext'd.

llvm-svn: 31933
This commit is contained in:
Chris Lattner 2006-11-27 04:40:53 +00:00
parent c0bdf03e26
commit aa8f67c2b5

View File

@ -2192,7 +2192,12 @@ SDOperand DAGCombiner::visitTRUNCATE(SDNode *N) {
return N0.getOperand(0);
}
// fold (truncate (load x)) -> (smaller load x)
if (ISD::isNON_EXTLoad(N0.Val) && N0.hasOneUse()) {
if (ISD::isNON_EXTLoad(N0.Val) && N0.hasOneUse() &&
// Do not allow folding to i1 here. i1 is implicitly stored in memory in
// zero extended form: by shrinking the load, we lose track of the fact
// that it is already zero extended.
// FIXME: This should be reevaluated.
VT != MVT::i1) {
assert(MVT::getSizeInBits(N0.getValueType()) > MVT::getSizeInBits(VT) &&
"Cannot truncate to larger type!");
LoadSDNode *LN0 = cast<LoadSDNode>(N0);