HomePhabricator

[CodeGenCXX] Treat 'this' as noalias in constructors

Description

[CodeGenCXX] Treat 'this' as noalias in constructors

This is currently a clang extension and a resolution
of the defect report in the C++ Standard.

Differential Revision: https://reviews.llvm.org/D46441

Event Timeline

@AntonBikineev It seems that this patch is causing failures in a ppc64 buildbot http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/ . Do you have any idea on the reason of the problem by looking at the errors?

@AntonBikineev It seems that this patch is causing failures in a ppc64 buildbot http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/ . Do you have any idea on the reason of the problem by looking at the errors?

@inouehrs are you sure this patch is causing these tests to fail? I currently can't see how it might happen.

inouehrs added a comment.EditedOct 15 2018, 6:54 AM

@AntonBikineev When I revoke this patch on my machine, the problem is gone.
I somewhat digged into the problem, although I still cannot catch the true reason.

  • The problem is caused in the constructor of __shared_ptr called from std::_Construct. The call chain for the _Construct is std::__uninitialized_construct_buf, std::__stable_sort.
  • When I disabled EarlyCSE in the __shared_ptr constructor, the problem does not happen.

If a constructor is called from std::Construct, may this pointer potentially alias with other memory references?

Reverted in https://reviews.llvm.org/rL344526 until we can figure this out.

@inouehrs I would be happy to work on the issue and find out what really causes the segfaults. Unfortunately, I don't have a ppc working machine, compiling clang in qemu emulating ppc took me over 3 days. Do you know of any cloud vps services based on power pc?

@AntonBikineev How about GCC Compile Farm? https://cfarm.tetaneutral.net/
Although I have never used it, the GCC Compile Farm provides access to powerpc machines.
I am sorry for the late reply.

@inouehrs thanks a lot, jut was granted with the access to the farm.