diff --git a/indra/llprimitive/llmaterial.cpp b/indra/llprimitive/llmaterial.cpp
index a219ac14501a9fee140e004bbbfb132ba6aca9d5..90e544dea1c251da23c574541fc09562caaf4bf4 100644
--- a/indra/llprimitive/llmaterial.cpp
+++ b/indra/llprimitive/llmaterial.cpp
@@ -281,7 +281,7 @@ void LLMaterial::setSpecularRotation(F32 rot)
     mSpecularRotation = rot;
 }
 
-const LLColor4U LLMaterial::getSpecularLightColor() const
+const LLColor4U& LLMaterial::getSpecularLightColor() const
 {
     return mSpecularLightColor;
 }
diff --git a/indra/llprimitive/llmaterial.h b/indra/llprimitive/llmaterial.h
index 83c86c81d559ebd550092642a7a3d2a17524445f..c5848ea535ce1c46aafcb8214744bceb96310e8e 100644
--- a/indra/llprimitive/llmaterial.h
+++ b/indra/llprimitive/llmaterial.h
@@ -109,7 +109,7 @@ class LLMaterial final : public LLRefCount
     F32         getSpecularRotation() const;
     void        setSpecularRotation(F32 rot);
 
-    const LLColor4U getSpecularLightColor() const;
+    const LLColor4U& getSpecularLightColor() const;
     void        setSpecularLightColor(const LLColor4U& color);
     U8          getSpecularLightExponent() const;
     void        setSpecularLightExponent(U8 exponent);
diff --git a/indra/llprimitive/lltextureentry.h b/indra/llprimitive/lltextureentry.h
index d8528b2b7fe94cdaad872679cc331fe56068cdaf..aaa06a3bf6993ac62123e2e1b6e39153e1c4574b 100644
--- a/indra/llprimitive/lltextureentry.h
+++ b/indra/llprimitive/lltextureentry.h
@@ -162,7 +162,7 @@ class LLTextureEntry final
 	U8	 getMediaTexGen() const { return mMediaFlags; }
     F32  getGlow() const { return mGlow; }
 	const LLMaterialID& getMaterialID() const { return mMaterialID; };
-	const LLMaterialPtr getMaterialParams() const { return mMaterial; };
+	const LLMaterialPtr& getMaterialParams() const { return mMaterial; };
 
     // *NOTE: it is possible for hasMedia() to return true, but getMediaData() to return NULL.
     // CONVERSELY, it is also possible for hasMedia() to return false, but getMediaData()
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 0b1fec4c579c661f6e24e1c8e863b634d0a55849..2c08cee7ba8e9bde2f3f59ad4b802d3f06b706a8 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -6304,9 +6304,9 @@ void LLPipeline::calcNearbyLights(LLCamera& camera)
                     fade -= LIGHT_FADE_TIME;
                 }
             }
-            cur_nearby_lights.insert(Light(drawable, dist, fade));
+            cur_nearby_lights.emplace(drawable, dist, fade);
 		}
-		mNearbyLights = cur_nearby_lights;
+		mNearbyLights = std::move(cur_nearby_lights);
 				
 		// FIND NEW LIGHTS THAT ARE IN RANGE
 		light_set_t new_nearby_lights;