[llvm-bugs] [Bug 20801] Devirtualization fails for loop, while succeeds for a scalar call of the same method

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 5 08:21:28 PST 2017


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

Fedor Sergeev <fedor.v.sergeev at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fedor.v.sergeev at gmail.com
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #10 from Fedor Sergeev <fedor.v.sergeev at gmail.com> ---
I can confirm that devirtualization does happen with clang -Ofast
-fstrict-vtable-pointers (and still does not happen with just -Ofast).

] clang++ --version
clang version 5.0.1 (https://github.com/llvm-mirror/clang
d8199c9eaa2e16c7b64b6c18fe88d4339321496e) (https://github.com/llvm-mirror/llvm
8baf891c0f1426d89835f878ba94cb198d93b155)
Target: x86_64-unknown-linux-gnu
Thread model: posix

] clang++  devirt-loop.cpp -Ofast -fstrict-vtable-pointers -emit-llvm -o - -S |
sed -n "/define.*Vector/,/^}/p" 
define i32 @_Z6Vectori(i32) local_unnamed_addr #0 {
  %2 = icmp sgt i32 %0, 0
  %3 = mul i32 %0, 123
  %4 = select i1 %2, i32 %3, i32 0
  ret i32 %4
}
] clang++  devirt-loop.cpp  -Ofast -emit-llvm -o - -S | sed -n
"/define.*Vector/,/^}/p" | grep call
  %2 = tail call i8* @_Znwm(i64 8) #4
  %8 = tail call i32 @_ZN1A1fEv(%class.A* nonnull %3)
  %18 = tail call i32 %17(%class.A* nonnull %3)
]

-- 
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/20171205/6e3e39e6/attachment.html>


More information about the llvm-bugs mailing list