From 99042473d075b10c275f357682aec8bbb8fc1667 Mon Sep 17 00:00:00 2001 From: Sanjoy Das Date: Sun, 17 Apr 2016 04:30:43 +0000 Subject: [PATCH] Fix a typo in rL265762 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit I accidentally replaced `mayBeOverridden` with `!isInterposable`. Remove the negation and add a test case that would've caught this. Many thanks to HÃ¥kan Hjort for spotting this! llvm-svn: 266551 --- .../Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp | 2 +- llvm/test/Transforms/InstCombine/mem-gep-zidx.ll | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp index d27f107..c855663 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp @@ -640,7 +640,7 @@ static bool isObjectSizeLessThanOrEq(Value *V, uint64_t MaxSize, } if (GlobalAlias *GA = dyn_cast(P)) { - if (!GA->isInterposable()) + if (GA->isInterposable()) return false; Worklist.push_back(GA->getAliasee()); continue; diff --git a/llvm/test/Transforms/InstCombine/mem-gep-zidx.ll b/llvm/test/Transforms/InstCombine/mem-gep-zidx.ll index cf021b1..4499051 100644 --- a/llvm/test/Transforms/InstCombine/mem-gep-zidx.ll +++ b/llvm/test/Transforms/InstCombine/mem-gep-zidx.ll @@ -4,6 +4,7 @@ target triple = "powerpc64-unknown-linux-gnu" @f.a = private unnamed_addr constant [1 x i32] [i32 12], align 4 @f.b = private unnamed_addr constant [1 x i32] [i32 55], align 4 +@f.c = linkonce unnamed_addr alias [1 x i32], [1 x i32]* @f.b define signext i32 @test1(i32 signext %x) #0 { entry: @@ -44,5 +45,16 @@ entry: ; CHECK: getelementptr inbounds [1 x i32], [1 x i32]* %p, i64 0, i64 0 } +define signext i32 @test4(i32 signext %x, i1 %y) #0 { +entry: + %idxprom = sext i32 %x to i64 + %arrayidx = getelementptr inbounds [1 x i32], [1 x i32]* @f.c, i64 0, i64 %idxprom + %0 = load i32, i32* %arrayidx, align 4 + ret i32 %0 + +; CHECK-LABEL: @test4 +; CHECK: getelementptr inbounds [1 x i32], [1 x i32]* @f.c, i64 0, i64 %idxprom +} + attributes #0 = { nounwind readnone } -- 2.7.4