From 72695f7bb7a79e6c43e6d0966f3dba5855026e7a Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 16 Feb 2004 03:53:44 +0000 Subject: Add a test for the "swap idiom", which LLVM should be able to unravel. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11491 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/InstCombine/xor.ll | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/Transforms/InstCombine/xor.ll') diff --git a/test/Transforms/InstCombine/xor.ll b/test/Transforms/InstCombine/xor.ll index 29f0f10..772c480 100644 --- a/test/Transforms/InstCombine/xor.ll +++ b/test/Transforms/InstCombine/xor.ll @@ -3,6 +3,9 @@ ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep 'xor ' +%G1 = global uint 0 +%G2 = global uint 0 + implementation bool %test0(bool %A) { @@ -128,3 +131,14 @@ uint %test19(uint %A, uint %B) { %D = xor uint %C, %A ; A terms cancel, D = B ret uint %D } + +void %test20(uint %A, uint %B) { ; The "swap idiom" + %tmp.2 = xor uint %B, %A + %tmp.5 = xor uint %tmp.2, %B + %tmp.8 = xor uint %tmp.5, %tmp.2 + store uint %tmp.8, uint* %G1 ; tmp.8 = B + store uint %tmp.5, uint* %G2 ; tmp.5 = A + ret void +} + + -- cgit v1.1