Index: llvm/lib/Target/ARM/ARMFastISel.cpp =================================================================== --- llvm/lib/Target/ARM/ARMFastISel.cpp +++ llvm/lib/Target/ARM/ARMFastISel.cpp @@ -2566,8 +2566,12 @@ return SelectCall(&I, "memset"); } case Intrinsic::trap: { - BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, TII.get( - Subtarget->useNaClTrap() ? ARM::TRAPNaCl : ARM::TRAP)); + unsigned Opcode; + if (Subtarget->isThumb()) + Opcode = ARM::tTRAP; + else + Opcode = Subtarget->useNaClTrap() ? ARM::TRAPNaCl : ARM::TRAP; + BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, TII.get(Opcode)); return true; } } Index: llvm/test/CodeGen/ARM/load_store_opt_clobber_cpsr.mir =================================================================== --- llvm/test/CodeGen/ARM/load_store_opt_clobber_cpsr.mir +++ llvm/test/CodeGen/ARM/load_store_opt_clobber_cpsr.mir @@ -30,4 +30,4 @@ renamable $r1 = tLDRi renamable $r4, 1, 14, $noreg :: (load 4) bb.2: liveins: $r4 - TRAP + tTRAP