mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
InstCombine: Don't assume DataLayout is always available
We tried to get the result of DataLayout::getLargestLegalIntTypeSize but we didn't have a DataLayout. This resulted in opt crashing. This fixes PR21651. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222645 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2095,7 +2095,8 @@ Instruction *InstCombiner::visitSwitchInst(SwitchInst &SI) {
|
||||
// the largest legal integer type. We need to be conservative here since
|
||||
// x86 generates redundant zero-extenstion instructions if the operand is
|
||||
// truncated to i8 or i16.
|
||||
if (BitWidth > NewWidth && NewWidth >= DL->getLargestLegalIntTypeSize()) {
|
||||
if (DL && BitWidth > NewWidth &&
|
||||
NewWidth >= DL->getLargestLegalIntTypeSize()) {
|
||||
IntegerType *Ty = IntegerType::get(SI.getContext(), NewWidth);
|
||||
Builder->SetInsertPoint(&SI);
|
||||
Value *NewCond = Builder->CreateTrunc(SI.getCondition(), Ty, "trunc");
|
||||
|
Reference in New Issue
Block a user