diff options
| author | Tim Northover <tnorthover@apple.com> | 2015-10-22 17:20:48 +0000 |
|---|---|---|
| committer | Tim Northover <tnorthover@apple.com> | 2015-10-22 17:20:48 +0000 |
| commit | 35ae68001852d0eb7553bf5c40d5959744cc673e (patch) | |
| tree | 1cb9370bcb4875026b85491a3dd1304f98e5a688 | |
| parent | 8fe40e0ed5c121d2a0a2763f1da38dc4a312b245 (diff) | |
| download | bcm5719-llvm-35ae68001852d0eb7553bf5c40d5959744cc673e.tar.gz bcm5719-llvm-35ae68001852d0eb7553bf5c40d5959744cc673e.zip | |
CodeGen: increase bits allocated for LegalizeActions
The array handling CondCodes only allocated 2 bits to describe the
desired action for each type. The new addition of a "LibCall" option
overflowed this and caused corruption for Custom actions.
No in-tree targets have a Custom CondCodeAction, so unfortunately it
can't be tested.
llvm-svn: 251033
| -rw-r--r-- | llvm/include/llvm/Target/TargetLowering.h | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/llvm/include/llvm/Target/TargetLowering.h b/llvm/include/llvm/Target/TargetLowering.h index 1e19e96e46d..3b35e20f8d9 100644 --- a/llvm/include/llvm/Target/TargetLowering.h +++ b/llvm/include/llvm/Target/TargetLowering.h @@ -673,9 +673,9 @@ public: ((unsigned)VT.SimpleTy >> 4) < array_lengthof(CondCodeActions[0]) && "Table isn't big enough!"); // See setCondCodeAction for how this is encoded. - uint32_t Shift = 2 * (VT.SimpleTy & 0xF); - uint32_t Value = CondCodeActions[CC][VT.SimpleTy >> 4]; - LegalizeAction Action = (LegalizeAction) ((Value >> Shift) & 0x3); + uint32_t Shift = 4 * (VT.SimpleTy & 0x7); + uint32_t Value = CondCodeActions[CC][VT.SimpleTy >> 3]; + LegalizeAction Action = (LegalizeAction) ((Value >> Shift) & 0xF); assert(Action != Promote && "Can't promote condition code!"); return Action; } @@ -1375,12 +1375,13 @@ protected: LegalizeAction Action) { assert(VT.isValid() && (unsigned)CC < array_lengthof(CondCodeActions) && "Table isn't big enough!"); - /// The lower 5 bits of the SimpleTy index into Nth 2bit set from the 32-bit - /// value and the upper 27 bits index into the second dimension of the array + assert((unsigned)Action < 0x10 && "too many bits for bitfield array"); + /// The lower 3 bits of the SimpleTy index into Nth 4bit set from the 32-bit + /// value and the upper 29 bits index into the second dimension of the array /// to select what 32-bit value to use. - uint32_t Shift = 2 * (VT.SimpleTy & 0xF); - CondCodeActions[CC][VT.SimpleTy >> 4] &= ~((uint32_t)0x3 << Shift); - CondCodeActions[CC][VT.SimpleTy >> 4] |= (uint32_t)Action << Shift; + uint32_t Shift = 4 * (VT.SimpleTy & 0x7); + CondCodeActions[CC][VT.SimpleTy >> 3] &= ~((uint32_t)0xF << Shift); + CondCodeActions[CC][VT.SimpleTy >> 3] |= (uint32_t)Action << Shift; } /// If Opc/OrigVT is specified as being promoted, the promotion code defaults @@ -1921,10 +1922,10 @@ private: /// For each condition code (ISD::CondCode) keep a LegalizeAction that /// indicates how instruction selection should deal with the condition code. /// - /// Because each CC action takes up 2 bits, we need to have the array size be + /// Because each CC action takes up 4 bits, we need to have the array size be /// large enough to fit all of the value types. This can be done by rounding - /// up the MVT::LAST_VALUETYPE value to the next multiple of 16. - uint32_t CondCodeActions[ISD::SETCC_INVALID][(MVT::LAST_VALUETYPE + 15) / 16]; + /// up the MVT::LAST_VALUETYPE value to the next multiple of 8. + uint32_t CondCodeActions[ISD::SETCC_INVALID][(MVT::LAST_VALUETYPE + 7) / 8]; ValueTypeActionImpl ValueTypeActions; |

