diff options
author | Chris Lattner <sabre@nondot.org> | 2006-11-27 04:40:53 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-11-27 04:40:53 +0000 |
commit | bc4cf8d5b137d43a1d6fde8238184e47efe162be (patch) | |
tree | 029aa58511dbd86bb025d64aa5b15ac2960a5acd /lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | f9908172e980aab15a36bd110ccdbc5f7afa44f6 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31933 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 44990690b5..99de15c936 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -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); |