Stream: t-compiler/help

Topic: Unnecessary clone optimization

Christian Poveda (Jul 10 2020 at 17:21, on Zulip):

Does the compiler do any optimization if the user cloned a value that is dropped after the clone?

Jonas Schievink (Jul 10 2020 at 17:22, on Zulip):

LLVM is free to optimize away either if it can prove that the observable behavior doesn't change

Christian Poveda (Jul 10 2020 at 17:24, on Zulip):

do you know where I can read a little more about how llvm proves that the change would be unobservable?

bjorn3 (Jul 10 2020 at 18:52, on Zulip):

@Christian Poveda This would probably involve inlining combined with in the case of memory allocations special knowledge about the observable behaviour of malloc, free and memcpy.

Last update: Sep 28 2020 at 15:00UTC