[PATCH] D14670: Fix bug 25440: GVN assertion after coercing loads
Weiming Zhao via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 17 10:49:14 PST 2015
weimingz added inline comments.
================
Comment at: lib/Transforms/Scalar/GVN.cpp:1152
@@ -1140,2 +1151,3 @@
+ if (SrcVal->getType()->getScalarType()->isPointerTy()) {
SrcVal = Builder.CreatePtrToInt(SrcVal,
DL.getIntPtrType(SrcVal->getType()));
----------------
creates PtrToInt here, but has the same VN as %sub.ptr.rhs.cast25
================
Comment at: test/Transforms/GVN/pr25440.ll:80
@@ +79,3 @@
+if.then.14: ; preds = %while.end, %while.bodythread-pre-split
+ %v1 = load i32, i32* bitcast (i8** @dfg_text to i32*), align 4
+ %sub.ptr.sub = sub i32 undef, %v1
----------------
try to do PRE here
================
Comment at: test/Transforms/GVN/pr25440.ll:93
@@ +92,3 @@
+ %add.ptr = getelementptr inbounds i8, i8* %v2, i32 undef
+ store i8* %add.ptr, i8** @dfg_text, align 4
+ %sub.ptr.rhs.cast25 = ptrtoint i8* %add.ptr to i32
----------------
finds the load with same addr
================
Comment at: test/Transforms/GVN/pr25440.ll:94
@@ +93,3 @@
+ store i8* %add.ptr, i8** @dfg_text, align 4
+ %sub.ptr.rhs.cast25 = ptrtoint i8* %add.ptr to i32
+ %sub.ptr.sub26 = sub i32 0, %sub.ptr.rhs.cast25
----------------
newly created ptrToInt has the same value, but inserted after it.
http://reviews.llvm.org/D14670
More information about the llvm-commits
mailing list