[llvm-bugs] [Bug 43007] Missed Tail Call Optimization when specifying function return value with __builtin_unreachable or __builtin_assume

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Aug 17 08:38:59 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=43007

David Bolvansky <david.bolvansky at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from David Bolvansky <david.bolvansky at gmail.com> ---
Code assumes(result == 1) but we dont know if
'function_returns_only_1_or_doesnt_return' has side effects or not.

With __attribute__((const)):
extern int function_returns_only_1_or_doesnt_return(int, int)
__attribute__((const));

We get what we want:

define dso_local i32 @foo1(i32 %0, i32 %1) local_unnamed_addr #0 {
  ret i32 1
}

define dso_local i32 @foo2(i32 %0, i32 %1) local_unnamed_addr #0 {
  ret i32 1
}

so I believe this works as expected.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190817/219ea21e/attachment.html>


More information about the llvm-bugs mailing list