[llvm] [InstCombine] Remove transformation on call instruction where return value need void to non-void conversion (PR #98536)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 1 12:22:37 PDT 2024
================
@@ -0,0 +1,24 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt --passes=instcombine -S < %s | FileCheck %s
+
+define dso_local void @foo() {
+; CHECK-LABEL: define dso_local void @foo() {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: ret void
+;
+entry:
+ ret void
+}
+
+define dso_local i32 @bar() {
+; CHECK-LABEL: define dso_local i32 @bar() {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: [[TMP0:%.*]] = tail call i32 @foo()
+; CHECK-NEXT: [[TMP1:%.*]] = add i32 [[TMP0]], 1
+; CHECK-NEXT: ret i32 [[TMP1]]
+;
+entry:
+ %1 = tail call i32 @foo()
+ %2 = add i32 %1, 1
----------------
nikic wrote:
Can drop the add too :)
https://github.com/llvm/llvm-project/pull/98536
More information about the llvm-commits
mailing list