Re-commit r151623 with fix. Only issue special no-return calls if it's a direct call.
[oota-llvm.git] / lib / Target / Mips / MipsAnalyzeImmediate.cpp
index c81c820fa3fb21c7fd39332cf2adb1dd34c44c00..31b669a64b3b85ac2f60b898e4532bc5e4e57ba8 100644 (file)
@@ -1,4 +1,4 @@
-//===-- MipsAnalyzeImmediate.cpp - Analyze immediates ---------------------===//
+//===-- MipsAnalyzeImmediate.cpp - Analyze Immediates ---------------------===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -77,7 +77,7 @@ void MipsAnalyzeImmediate::GetInstSeqLs(int64_t Imm, unsigned RemSize,
 }
 
 // Replace a ADDiu & SLL pair with a LUi.
-// e.g. the following two instructions 
+// e.g. the following two instructions
 //  ADDiu 0x0111
 //  SLL 18
 // are replaced with
@@ -90,7 +90,7 @@ void MipsAnalyzeImmediate::ReplaceADDiuSLLWithLUi(InstSeq &Seq) {
     return;
 
   // Sign-extend and shift operand of ADDiu and see if it still fits in 16-bit.
-  int64_t Imm = (((int64_t)Seq[0].ImmOpnd) << 48) >> 48;
+  int64_t Imm = SignExtend64<16>(Seq[0].ImmOpnd);
   int64_t ShiftedImm = Imm << (Seq[1].ImmOpnd - 16);
 
   if (!isInt<16>(ShiftedImm))
@@ -149,5 +149,5 @@ const MipsAnalyzeImmediate::InstSeq
   // Set Insts to the shortest instruction sequence.
   GetShortestSeq(SeqLs, Insts);
 
-  return Insts;  
+  return Insts;
 }