mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-30 23:20:54 +00:00
ConstantFold: Fold getelementptr (i32, i32* null, i64 undef) to null.
Transforms/IndVarSimplify/2011-10-27-lftrnull will fail if this regresses. Transforms/GVN/PRE/2011-06-01-NonLocalMemdepMiscompile.ll has been changed to still test what it was trying to test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302446 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d99549318e
commit
30725541b4
@ -2054,7 +2054,8 @@ Constant *llvm::ConstantFoldGetElementPtr(Type *PointeeTy, Constant *C,
|
||||
if (C->isNullValue()) {
|
||||
bool isNull = true;
|
||||
for (unsigned i = 0, e = Idxs.size(); i != e; ++i)
|
||||
if (!cast<Constant>(Idxs[i])->isNullValue()) {
|
||||
if (!isa<UndefValue>(Idxs[i]) &&
|
||||
!cast<Constant>(Idxs[i])->isNullValue()) {
|
||||
isNull = false;
|
||||
break;
|
||||
}
|
||||
|
@ -5,8 +5,7 @@
|
||||
|
||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
|
||||
target triple = "x86_64-apple-macosx10.7.0"
|
||||
|
||||
define i1 @rb_intern() nounwind ssp {
|
||||
define i1 @rb_intern(i8 *%foo) nounwind ssp {
|
||||
; CHECK-LABEL: @rb_intern(
|
||||
|
||||
bb:
|
||||
@ -19,7 +18,7 @@ bb1:
|
||||
br i1 undef, label %bb3, label %bb15
|
||||
|
||||
; CHECK: bb1:
|
||||
; CHECK: [[TMP:%.*]] = phi i8* [ getelementptr (i8, i8* null, i64 undef), %bb10 ], [ null, %bb ]
|
||||
; CHECK: [[TMP:%.*]] = phi i8* [ %tmp14, %bb10 ], [ null, %bb ]
|
||||
|
||||
; CHECK: bb1.bb15_crit_edge:
|
||||
; CHECK: %tmp17.pre = load i8, i8* [[TMP]], align 1
|
||||
@ -41,7 +40,7 @@ bb10:
|
||||
%tmp11 = load i8*, i8** %tmp, align 8
|
||||
%tmp12 = load i8, i8* %tmp11, align 1
|
||||
%tmp13 = zext i8 %tmp12 to i64
|
||||
%tmp14 = getelementptr inbounds i8, i8* null, i64 undef
|
||||
%tmp14 = getelementptr inbounds i8, i8* %foo, i64 undef
|
||||
store i8* %tmp14, i8** %tmp, align 8
|
||||
br label %bb1
|
||||
|
||||
|
@ -6,7 +6,7 @@ target triple = "thumbv7-apple-darwin"
|
||||
|
||||
; CHECK-LABEL: @test(
|
||||
; CHECK: if.end.i126:
|
||||
; CHECK: %exitcond = icmp ne i8* %incdec.ptr.i, getelementptr (i8, i8* null, i32 undef)
|
||||
; CHECK: %exitcond = icmp ne i8* %incdec.ptr.i, null
|
||||
define void @test() nounwind {
|
||||
entry:
|
||||
br label %while.cond
|
||||
|
Loading…
Reference in New Issue
Block a user