From 6662fd0f1558988bec57a94158dd4d67f3d8e177 Mon Sep 17 00:00:00 2001 From: Shuxin Yang Date: Mon, 1 Apr 2013 18:13:05 +0000 Subject: [PATCH] Correct assertion condition llvm-svn: 178484 --- llvm/lib/Transforms/Scalar/Reassociate.cpp | 2 +- llvm/test/Transforms/Reassociate/xor_reassoc.ll | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp index 493930b3885a..1f343136e532 100644 --- a/llvm/lib/Transforms/Scalar/Reassociate.cpp +++ b/llvm/lib/Transforms/Scalar/Reassociate.cpp @@ -199,7 +199,7 @@ namespace { } XorOpnd::XorOpnd(Value *V) { - assert(!isa(V) && "No constant"); + assert(!isa(V) && "No ConstantInt"); OrigVal = V; Instruction *I = dyn_cast(V); SymbolicRank = 0; diff --git a/llvm/test/Transforms/Reassociate/xor_reassoc.ll b/llvm/test/Transforms/Reassociate/xor_reassoc.ll index 380eba562c25..d371a9b5b68f 100644 --- a/llvm/test/Transforms/Reassociate/xor_reassoc.ll +++ b/llvm/test/Transforms/Reassociate/xor_reassoc.ll @@ -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 +}