Skip to content

Commit 373c0c8

Browse files
committed
fix trap not being allowed (which brought abort into scope)
1 parent c4db4dc commit 373c0c8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

llvm/lib/Target/Xtensa/XtensaISelLowering.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,11 @@ XtensaTargetLowering::XtensaTargetLowering(const TargetMachine &TM,
181181
// make BRCOND legal, its actually only legal for a subset of conds
182182
setOperationAction(ISD::BRCOND, MVT::Other, Legal);
183183

184+
// Xtensa has the BREAK instruction for traps (requires HasDebug).
185+
// Without this, ISD::TRAP is expanded to a call to abort() by default.
186+
if (Subtarget.hasDebug())
187+
setOperationAction(ISD::TRAP, MVT::Other, Legal);
188+
184189
setOperationAction(ISD::BR_CC, MVT::i32, Legal);
185190
setOperationAction(ISD::BR_CC, MVT::i64, Expand);
186191

0 commit comments

Comments
 (0)