Index: osprey/be/opt/opt_wn.cxx
===================================================================
--- osprey/be/opt/opt_wn.cxx	(revision 3380)
+++ osprey/be/opt/opt_wn.cxx	(working copy)
@@ -1500,10 +1500,10 @@
 
   if (sym->Bit_size () > 0) {
     if (sym->Field_id() == 0) { 
-      WN_set_operator (rhs, OPR_LDBITS);
+      WN_change_operator (rhs, OPR_LDBITS);
       WN_set_bit_offset_size (rhs, sym->Bit_ofst (), sym->Bit_size ());
   
-      WN_set_operator (copy, OPR_STBITS);
+      WN_change_operator (copy, OPR_STBITS);
       WN_set_bit_offset_size (copy, sym->Bit_ofst (), sym->Bit_size ());
     }
     else { // if field id != 0, then it is MTYPE_BS, not LD_BITS
Index: osprey/be/opt/opt_etable.cxx
===================================================================
--- osprey/be/opt/opt_etable.cxx	(revision 3380)
+++ osprey/be/opt/opt_etable.cxx	(working copy)
@@ -484,7 +484,7 @@
 			      Field_id());
 			      
       if (opt_stab->Bit_size (Aux_id()) > 0) {
-	WN_set_operator (home_wn, OPR_LDBITS);
+	WN_change_operator (home_wn, OPR_LDBITS);
 	WN_set_bit_offset_size (home_wn, Bit_offset (), Bit_size ());
       }
     }
Index: osprey/be/opt/opt_htable_emit.cxx
===================================================================
--- osprey/be/opt/opt_htable_emit.cxx	(revision 3380)
+++ osprey/be/opt/opt_htable_emit.cxx	(working copy)
@@ -349,7 +349,7 @@
 #ifdef TARG_LOONGSON
       // Need to change operator of induction to OPT_LDBITS when induction is BITs variable
       if (iv->Points_to(Opt_stab())->Bit_Size() != 0)
-        WN_set_operator(induction, OPR_LDBITS);
+        WN_change_operator(induction, OPR_LDBITS);
 #endif
       if (Do_rvi() && ST_class(WN_st(induction)) != CLASS_PREG) {
 	Warn_todo("ML_WHIRL_EMITTER::Build_loop_info: do not adjust bitpos by 1" );
Index: osprey/be/opt/opt_sym.cxx
===================================================================
--- osprey/be/opt/opt_sym.cxx	(revision 3380)
+++ osprey/be/opt/opt_sym.cxx	(working copy)
@@ -1727,7 +1727,10 @@
                   OPERATOR_name(opr)));
 	rtype = WN_rtype(twn);
 	desc = WN_desc(twn);
-        WN_set_operator(wn, opr);
+	// reset map_id since OPR_INTCONST is in different mapcat group than OPR_LDID/OPR_LDBITS.
+	if (opr == OPR_INTCONST) 
+	  WN_set_map_id(wn, -1);
+	WN_change_operator(wn, opr);
 	WN_set_rtype(wn, rtype);
 	WN_set_desc(wn, desc);
         if (opr == OPR_INTCONST)
@@ -1760,7 +1763,7 @@
 	opr = WN_operator(twn);
 	rtype = WN_rtype(twn);
 	desc = WN_desc(twn);
-        WN_set_operator(wn, opr);
+        WN_change_operator(wn, opr);
 	WN_set_rtype(wn, rtype);
 	WN_set_desc(wn, desc);
         WN_load_offset(wn) = WN_load_offset(twn);
@@ -1791,7 +1794,7 @@
     if (opr == OPR_TRUEBR && WN_const_val(test) != 0 ||
 	opr == OPR_FALSEBR && WN_const_val(test) == 0) {
       WN_Delete(test);
-      WN_set_operator(wn, OPR_GOTO);
+      WN_change_operator(wn, OPR_GOTO);
       WN_set_rtype(wn, MTYPE_V);
       WN_set_desc(wn, MTYPE_V);
       WN_set_kid_count(wn, 0);
Index: osprey/common/com/wn_core.h
===================================================================
--- osprey/common/com/wn_core.h	(revision 3380)
+++ osprey/common/com/wn_core.h	(working copy)
@@ -668,6 +668,7 @@
 
   friend inline OPERATOR    WN_operator (const WN *);
   friend inline void        WN_set_operator (WN *, OPERATOR);
+  friend inline void        WN_change_operator (WN *, OPERATOR);
   friend inline TYPE_ID     WN_rtype (const WN *);
   friend inline void        WN_set_rtype (WN *, TYPE_ID);
   friend inline INT         WN_kid_count (const WN *);
@@ -809,6 +810,12 @@
 
 inline OPERATOR   WN_operator (const WN* wn) { return wn->common.wn_operator; }
 inline void       WN_set_operator (WN* wn, OPERATOR opr) { wn->common.wn_operator = opr; }
+inline void       WN_change_operator (WN* wn, OPERATOR opr) {
+  Is_True((WN_map_id(wn) == -1 ||
+        OPERATOR_mapcat(WN_operator(wn)) == OPERATOR_mapcat(opr)),
+      ("WN's new operator belongs to a different mapcat in Create_identity_assignment"));
+  WN_set_operator(wn, opr);
+}
 inline TYPE_ID    WN_rtype (const WN* wn) { return wn->common.rtype; }
 inline void       WN_set_rtype (WN* wn, TYPE_ID ty) { wn->common.rtype = ty; }
 inline INT        WN_kid_count (const WN* wn) { return OPERATOR_nkids(WN_operator(wn)) == -1 ? wn->common.kid_count : OPERATOR_nkids(WN_operator(wn)); }
