Reviving TypeSanitizer - a sanitizer to catch type-based aliasing violations

Just rebased the patches again and addressed the current comments.

I also did a quick search of the issue tracker to find strict-alias violations that caused mis-compiles (reported by users) to check if the current implementation catches them.

Caught:
https://github.com/llvm/llvm-project/issues/86685
https://github.com/llvm/llvm-project/issues/68655
https://github.com/llvm/llvm-project/issues/62828
https://github.com/llvm/llvm-project/issues/62544
https://github.com/llvm/llvm-project/issues/47137
https://github.com/llvm/llvm-project/issues/45282

Not caught (Did not check closely yet if they may not be violations)
https://github.com/llvm/llvm-project/issues/78154
https://github.com/llvm/llvm-project/issues/51837

On the SingleSource subset of the test-suite on ARM64 macOS, there currently are the following failures. I had a quick look at some of them (SingleSource/UnitTests/Vectorizer/* and the violations there are in libc++'s random number generator, not yet confirmed if this is a false positive)

Failed Tests (30):
  test-suite :: SingleSource/Benchmarks/BenchmarkGame/fannkuch.test
  test-suite :: SingleSource/Benchmarks/CoyoteBench/fftbench.test
  test-suite :: SingleSource/Benchmarks/Misc-C++/Large/ray.test
  test-suite :: SingleSource/Benchmarks/Misc-C++/stepanov_container.test
  test-suite :: SingleSource/Benchmarks/Misc/flops.test
  test-suite :: SingleSource/Benchmarks/Misc/himenobmtxpa.test
  test-suite :: SingleSource/Benchmarks/Misc/richards_benchmark.test
  test-suite :: SingleSource/Benchmarks/Shootout-C++/Shootout-C++-lists.test
  test-suite :: SingleSource/Benchmarks/Shootout-C++/Shootout-C++-lists1.test
  test-suite :: SingleSource/Benchmarks/Shootout-C++/Shootout-C++-sieve.test
  test-suite :: SingleSource/Benchmarks/Shootout/Shootout-methcall.test
  test-suite :: SingleSource/Regression/C++/EH/Regression-C++-class_hierarchy.test
  test-suite :: SingleSource/Regression/C++/EH/Regression-C++-ctor_dtor_count.test
  test-suite :: SingleSource/Regression/C++/EH/Regression-C++-exception_spec_test.test
  test-suite :: SingleSource/Regression/C++/EH/Regression-C++-inlined_cleanup.test
  test-suite :: SingleSource/Regression/C++/EH/Regression-C++-throw_rethrow_test.test
  test-suite :: SingleSource/Regression/C/Regression-C-2003-05-21-BitfieldHandling.test
  test-suite :: SingleSource/UnitTests/2003-05-02-DependentPHI.test
  test-suite :: SingleSource/UnitTests/2004-11-28-GlobalBoolLayout.test
  test-suite :: SingleSource/UnitTests/2006-01-23-UnionInit.test
  test-suite :: SingleSource/UnitTests/2009-04-16-BitfieldInitialization.test
  test-suite :: SingleSource/UnitTests/2020-01-06-coverage-008.test
  test-suite :: SingleSource/UnitTests/SignlessTypes/Large/cast.test
  test-suite :: SingleSource/UnitTests/Vectorizer/VPlanNativePath/outer-loop-vect.test
  test-suite :: SingleSource/UnitTests/Vectorizer/dependences.test
  test-suite :: SingleSource/UnitTests/Vectorizer/index-select.test
  test-suite :: SingleSource/UnitTests/Vectorizer/recurrences.test
  test-suite :: SingleSource/UnitTests/Vectorizer/runtime-checks.test
  test-suite :: SingleSource/UnitTests/byval-alignment.test
  test-suite :: SingleSource/UnitTests/initp1.test
4 Likes