[PATCH] D78355: [LLParser] Delete temporary CallInst when error occurs in ParseCall
Qiu Chaofan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 22 20:06:38 PDT 2020
qiucf updated this revision to Diff 259460.
qiucf added a comment.
Add a test
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78355/new/
https://reviews.llvm.org/D78355
Files:
llvm/lib/AsmParser/LLParser.cpp
llvm/test/CodeGen/Generic/fast-math-flags.ll
Index: llvm/test/CodeGen/Generic/fast-math-flags.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/Generic/fast-math-flags.ll
@@ -0,0 +1,10 @@
+; RUN: not llc < %s 2>&1 | FileCheck %s
+
+; CHECK: error: fast-math-flags specified for call without floating-point scalar or vector return type
+define i64 @test_lrintf(float %f) {
+entry:
+ %0 = tail call fast i64 @llvm.lrint.i64.f32(float %f)
+ ret i64 %0
+}
+
+declare i64 @llvm.lrint.i64.f32(float)
Index: llvm/lib/AsmParser/LLParser.cpp
===================================================================
--- llvm/lib/AsmParser/LLParser.cpp
+++ llvm/lib/AsmParser/LLParser.cpp
@@ -6892,9 +6892,11 @@
CI->setTailCallKind(TCK);
CI->setCallingConv(CC);
if (FMF.any()) {
- if (!isa<FPMathOperator>(CI))
+ if (!isa<FPMathOperator>(CI)) {
+ CI->deleteValue();
return Error(CallLoc, "fast-math-flags specified for call without "
"floating-point scalar or vector return type");
+ }
CI->setFastMathFlags(FMF);
}
CI->setAttributes(PAL);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78355.259460.patch
Type: text/x-patch
Size: 1098 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200423/c8377cbf/attachment-0001.bin>
More information about the llvm-commits
mailing list