[InstCombine] Revert r238452: Fold IntToPtr and PtrToInt into preceding loads.
authorQuentin Colombet <qcolombet@apple.com>
Wed, 3 Feb 2016 18:04:13 +0000 (18:04 +0000)
committerQuentin Colombet <qcolombet@apple.com>
Wed, 3 Feb 2016 18:04:13 +0000 (18:04 +0000)
commit7ec03dc7f80e73dc60960fe163e20bf3da19c969
treea7f038b399101f9c923d6207ae50377a2bf23984
parentac29f01788e381b2a8560536997d44dfee87086d
[InstCombine] Revert r238452: Fold IntToPtr and PtrToInt into preceding loads.

According to git bisect, this is the root cause of a miscompile for Regex in
libLLVMSupport. I am still working on reducing a test case.
The actual bug may be elsewhere and this commit just exposed it.

Anyway, at the moment, to reproduce, follow these steps:
1. Build clang and libLTO in release mode.
2. Create a new build directory <stage2> and cd into it.
3. Use clang and libLTO from #1 to build llvm-extract in Release mode + asserts
   using -O2 -flto
4. Run llvm-extract  -ralias '.*bar' -S test/Other/extract-alias.ll

Result:
program doesn't contain global named '.*bar'!

Expected result:
@a0a0bar = alias void ()* @bar
@a0bar = alias void ()* @bar

declare void @bar()

Note: In step #3, if you don't use lto or asserts, the miscompile disappears.
llvm-svn: 259674
llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
llvm/test/Transforms/InstCombine/load-bitcast32.ll [deleted file]
llvm/test/Transforms/InstCombine/load-bitcast64.ll [deleted file]
llvm/test/Transforms/InstCombine/memset_chk-1.ll