[InstCombine] Actually combine AA metadata when replacing one load with another
authorBjorn Steinbrink <bsteinbr@gmail.com>
Fri, 10 Jul 2015 22:30:17 +0000 (22:30 +0000)
committerBjorn Steinbrink <bsteinbr@gmail.com>
Fri, 10 Jul 2015 22:30:17 +0000 (22:30 +0000)
Fixes PR24083

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241955 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
test/Transforms/InstCombine/load-combine-metadata.ll

index 1a7a2b183fbc29b244d32d3c01d5a1f17a7dd957..e3179dbeece8db8b9b46016e6fd2ba06e46701f7 100644 (file)
@@ -762,8 +762,6 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) {
         LLVMContext::MD_nonnull,
       };
       combineMetadata(NLI, &LI, KnownIDs);
-      if (AATags)
-        NLI->setAAMetadata(AATags);
     };
 
     return ReplaceInstUsesWith(
index d67f83c1ebcf0b07783b955356881e57af4e50f9..9b9c1fe607b906a9389553065277acb7eb969542 100644 (file)
@@ -3,17 +3,15 @@
 target datalayout = "e-m:e-p:64:64:64-i64:64-f80:128-n8:16:32:64-S128"
 
 ; CHECK-LABEL: @test_load_load_combine_metadata(
-; Check that range metadata is combined and AA metadata is preserved
+; Check that range and AA metadata is combined
 ; CHECK: %[[V:.*]] = load i32, i32* %0
 ; CHECK-SAME: !tbaa !{{[0-9]+}}
 ; CHECK-SAME: !range ![[RANGE:[0-9]+]]
-; CHECK-SAME: !alias.scope !{{[0-9]+}}
-; CHECK-SAME: !noalias !{{[0-9]+}}
 ; CHECK: store i32 %[[V]], i32* %1
 ; CHECK: store i32 %[[V]], i32* %2
 define void @test_load_load_combine_metadata(i32*, i32*, i32*) {
   %a = load i32, i32* %0, !tbaa !8, !range !0, !alias.scope !5, !noalias !6
-  %b = load i32, i32* %0, !range !1
+  %b = load i32, i32* %0, !tbaa !8, !range !1
   store i32 %a, i32* %1
   store i32 %b, i32* %2
   ret void