[llvm] r245207 - [GMR] isNonEscapingGlobalNoAlias() should look through Bitcasts/GEPs when looking at loads.
Michael Kuperstein via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 17 03:06:08 PDT 2015
Author: mkuper
Date: Mon Aug 17 05:06:08 2015
New Revision: 245207
URL: http://llvm.org/viewvc/llvm-project?rev=245207&view=rev
Log:
[GMR] isNonEscapingGlobalNoAlias() should look through Bitcasts/GEPs when looking at loads.
This fixes yet another case from PR24288.
Differential Revision: http://reviews.llvm.org/D12064
Modified:
llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp
llvm/trunk/test/Analysis/GlobalsModRef/nonescaping-noalias.ll
Modified: llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp?rev=245207&r1=245206&r2=245207&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp (original)
+++ llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp Mon Aug 17 05:06:08 2015
@@ -651,7 +651,7 @@ bool GlobalsModRef::isNonEscapingGlobalN
if (auto *LI = dyn_cast<LoadInst>(Input)) {
// A pointer loaded from a global would have been captured, and we know
// that the global is non-escaping, so no alias.
- if (isa<GlobalValue>(LI->getPointerOperand()))
+ if (isa<GlobalValue>(GetUnderlyingObject(LI->getPointerOperand(), *DL)))
continue;
// Otherwise, a load could come from anywhere, so bail.
Modified: llvm/trunk/test/Analysis/GlobalsModRef/nonescaping-noalias.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/GlobalsModRef/nonescaping-noalias.ll?rev=245207&r1=245206&r2=245207&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/GlobalsModRef/nonescaping-noalias.ll (original)
+++ llvm/trunk/test/Analysis/GlobalsModRef/nonescaping-noalias.ll Mon Aug 17 05:06:08 2015
@@ -62,6 +62,7 @@ entry:
}
@g3 = internal global i32 1
+ at g4 = internal global [10 x i32*] zeroinitializer
define i32 @test4(i32* %param, i32 %n, i1 %c1, i1 %c2, i1 %c3) {
; Ensure that we can fold a store to a load of a global across a store to
@@ -86,7 +87,7 @@ loop:
%iv = phi i32 [ 0, %entry ], [ %inc, %loop ]
%ptr = phi i32* [ %ptr3, %entry ], [ %ptr5, %loop ]
store i32 7, i32* %ptr
- %ptr4 = load i32*, i32** @g2
+ %ptr4 = load i32*, i32** getelementptr ([10 x i32*], [10 x i32*]* @g4, i32 0, i32 1)
%ptr5 = select i1 %c2, i32* %ptr4, i32* %call
%inc = add i32 %iv, 1
%test = icmp slt i32 %inc, %n
More information about the llvm-commits
mailing list