Correct assertion condition
authorShuxin Yang <shuxin.llvm@gmail.com>
Mon, 1 Apr 2013 18:13:05 +0000 (18:13 +0000)
committerShuxin Yang <shuxin.llvm@gmail.com>
Mon, 1 Apr 2013 18:13:05 +0000 (18:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178484 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/Reassociate.cpp
test/Transforms/Reassociate/xor_reassoc.ll

index 493930b3885ad3a65fcf49dd66b51e03bd02e8ff..1f343136e532126e4fde2fca4897a1ee45e0604e 100644 (file)
@@ -199,7 +199,7 @@ namespace {
 }
 
 XorOpnd::XorOpnd(Value *V) {
-  assert(!isa<Constant>(V) && "No constant");
+  assert(!isa<ConstantInt>(V) && "No ConstantInt");
   OrigVal = V;
   Instruction *I = dyn_cast<Instruction>(V);
   SymbolicRank = 0;
index 380eba562c25144a8fd1c1b7323ccf21f0394449..d371a9b5b68f3cee82d6b0eac50e73a42d3611dc 100644 (file)
@@ -149,3 +149,18 @@ define i32 @xor_ra_size2(i32 %x) {
 ;CHECK: %or1 = or i32 %x, 456
 ;CHECK: %xor = xor i32 %or, %or1
 }
+
+
+; ==========================================================================
+;
+;  Xor reassociation bugs
+;  
+; ==========================================================================
+
+@xor_bug1_data = external global <{}>, align 4
+define void @xor_bug1() {
+  %1 = ptrtoint i32* undef to i64
+  %2 = xor i64 %1, ptrtoint (<{}>* @xor_bug1_data to i64)
+  %3 = and i64 undef, %2
+  ret void
+}