[llvm] r197607 - Correctly handle the degenerated triple "thumb".
Rafael Espindola
rafael.espindola at gmail.com
Wed Dec 18 13:29:44 PST 2013
Author: rafael
Date: Wed Dec 18 15:29:44 2013
New Revision: 197607
URL: http://llvm.org/viewvc/llvm-project?rev=197607&view=rev
Log:
Correctly handle the degenerated triple "thumb".
Fixes a crash in llc where some parts think the target is thumb and others think
it is ARM.
Added:
llvm/trunk/test/CodeGen/Thumb/triple.ll
Modified:
llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp
Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp?rev=197607&r1=197606&r2=197607&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp Wed Dec 18 15:29:44 2013
@@ -89,14 +89,11 @@ std::string ARM_MC::ParseARMTriple(Strin
unsigned Idx = 0;
// FIXME: Enhance Triple helper class to extract ARM version.
- bool isThumb = false;
+ bool isThumb = triple.getArch() == Triple::thumb;
if (Len >= 5 && TT.substr(0, 4) == "armv")
Idx = 4;
- else if (Len >= 6 && TT.substr(0, 5) == "thumb") {
- isThumb = true;
- if (Len >= 7 && TT[5] == 'v')
- Idx = 6;
- }
+ else if (Len >= 7 && TT.substr(0, 6) == "thumbv")
+ Idx = 6;
bool NoCPU = CPU == "generic" || CPU.empty();
std::string ARMArchFeature;
Added: llvm/trunk/test/CodeGen/Thumb/triple.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb/triple.ll?rev=197607&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Thumb/triple.ll (added)
+++ llvm/trunk/test/CodeGen/Thumb/triple.ll Wed Dec 18 15:29:44 2013
@@ -0,0 +1,7 @@
+; RUN: llc < %s -mtriple=thumb | FileCheck %s
+
+; CHECK: .code 16
+
+define void @f() {
+ ret void
+}
More information about the llvm-commits
mailing list