aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/BPF/BPFISelLowering.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target/BPF/BPFISelLowering.cpp')
-rw-r--r--lib/Target/BPF/BPFISelLowering.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Target/BPF/BPFISelLowering.cpp b/lib/Target/BPF/BPFISelLowering.cpp
index 81b0aa7f8b98..5740b49f6a0f 100644
--- a/lib/Target/BPF/BPFISelLowering.cpp
+++ b/lib/Target/BPF/BPFISelLowering.cpp
@@ -578,11 +578,15 @@ BPFTargetLowering::EmitInstrWithCustomInserter(MachineInstr &MI,
.addReg(LHS)
.addReg(MI.getOperand(2).getReg())
.addMBB(Copy1MBB);
- else
+ else {
+ int64_t imm32 = MI.getOperand(2).getImm();
+ // sanity check before we build J*_ri instruction.
+ assert (isInt<32>(imm32));
BuildMI(BB, DL, TII.get(NewCC))
.addReg(LHS)
- .addImm(MI.getOperand(2).getImm())
+ .addImm(imm32)
.addMBB(Copy1MBB);
+ }
// Copy0MBB:
// %FalseValue = ...